EchoTex_Payroll/HRM.DA/DA/ess/ProfileUpdateRequestDA.cs

433 lines
26 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Ease.Core.DataAccess;
using Ease.Core.DataAccess.SQL;
using HRM.BO;
using HRM.BO.ess;
using Microsoft.Data.SqlClient;
namespace HRM.DA
{
public class ProfileUpdateRequestDA
{
public ProfileUpdateRequestDA()
{
}
internal static IDataReader GetById(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM ProfileUpdateRequest WHERE purID=%n ", id);
}
internal static IDataReader GetAllByEmpId(TransactionContext tc, int id)
{
return tc.ExecuteReader(
"SELECT * FROM ProfileUpdateRequest WHERE RequestEmpID=%n order by Requestdate desc", id);
}
internal static int GetAllByEmpIdAndStatus(TransactionContext tc, int empId, EnumPURequestStatus status)
{
string sql =
SQLParser.MakeSQL(
@"SELECT count(*) FROM ProfileUpdateRequest WHERE RequestEmpID=%n And PURequestStatus=%n",
empId, status);
return Convert.ToInt32(tc.ExecuteScalar(sql));
}
internal static int TotalProfileUpdateRequested(TransactionContext tc)
{
string sql =
SQLParser.MakeSQL(
@"SELECT count(*) FROM ProfileUpdateRequest WHERE PURequestStatus=%n",
EnumPURequestStatus.Requested);
return Convert.ToInt32(tc.ExecuteScalar(sql));
}
internal static void UpdateStatusToApproved(TransactionContext tc, int purId,int? approvedby,DateTime approvedDate)
{
string sql = SQLParser.MakeSQL(@"update profileUpdateRequest set PURequestStatus=2,APPROVEBY=%n,APPROVEDATE=%d where purId=%n", approvedby, approvedDate, purId);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateStatusToRejected(TransactionContext tc, int purId)
{
string sql = SQLParser.MakeSQL(@"update profileUpdateRequest set PURequestStatus=3 where purId=%n", purId);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader GetAll(TransactionContext tc)
{
return tc.ExecuteReader(
"SELECT * FROM ProfileUpdateRequest where PURequestStatus=1 order by Requestdate desc");
}
internal static void UpdateMobileNo(TransactionContext tc, ProfileUpdateRequest item)
{
string sql = SQLParser.MakeSQL(@"UPDATE Employee SET MOBILENO=%s where employeeid=%n",
item.MobileNo, item.RequestEmpID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateNationalId(TransactionContext tc, ProfileUpdateRequest item)
{
string sql = SQLParser.MakeSQL(@"UPDATE Employee SET NATIONALID=%s where employeeid=%n",
item.NationalID, item.RequestEmpID);
tc.ExecuteNonQuery(sql);
}
/*internal static string NationalIdExistingData(TransactionContext tc, ProfileUpdateRequest item)
{
string ans = tc.ExecuteScalar("select nationalId from employee where EMPLOYEEID=%n", item.RequestEmpID);
return ans;
}*/
internal static void UpdateBloodGroup(TransactionContext tc, ProfileUpdateRequest item)
{
string sql = SQLParser.MakeSQL(@"UPDATE Employee SET BLOODGROUP=%n where employeeid=%n",
item.BloodGroup, item.RequestEmpID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateTIN(TransactionContext tc, ProfileUpdateRequest item)
{
string sql = SQLParser.MakeSQL(@"UPDATE Employee SET TINNO=%s where employeeid=%n",
item.TIN, item.RequestEmpID);
tc.ExecuteNonQuery(sql);
}
internal static void PassportNO(TransactionContext tc, ProfileUpdateRequest item)
{
string sql = SQLParser.MakeSQL(@"UPDATE Employee SET PASSPORTNO=%s where employeeid=%n",
item.PassportNo, item.RequestEmpID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdatePresentContact(TransactionContext tc, EmpContact item)
{
string sql = SQLParser.MakeSQL(@"Update EmpContact SET
ContactID=%n,
PresentAddress= %s, PresentDistrictID= %n, PresentThanaID= %n,
PresentTelephone= %s, PRESENTMOBILE= %s
WHERE EmployeeID = %n",
item.ID, item.PresentAddress, DataReader.GetNullValue(item.PresentDistrictID),
DataReader.GetNullValue(item.PresentThanaID), item.PresentTelephone,
DataReader.GetNullValue(item.PresentMobile), item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
public static void UpdatePermanentContact(TransactionContext tc, EmpContact item)
{
string sql = SQLParser.MakeSQL(@"Update EmpContact SET
ContactID=%n, ParmanentAddress= %s, ParmanentDistrictID= %n,
ParmanentThanaID= %n, ParmanentTelephone= %s,
PARMANENTMOBILE= %s
WHERE EmployeeID = %n",
item.ID, item.PermanentAddress, DataReader.GetNullValue(item.PermanentDistrictID),
DataReader.GetNullValue(item.PermanentThanaID), item.PermanentTelephone,
DataReader.GetNullValue(item.PermanentMobile), item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
public static void UpdateEmergencyContact(TransactionContext tc, EmpContact item)
{
string sql = SQLParser.MakeSQL(@"Update EmpContact SET
ContactID=%n, EmergencyContactAddress= %s,
EmergencyContactPerson= %s, EmergencyTelephone= %s,
EMERGENCYMOBILE= %s, CPRELATIONID= %n
WHERE EmployeeID=%n",
item.ID, item.EmergencyContactAddress, item.EmergencyContactPerson, item.EmergencyTelephone,
DataReader.GetNullValue(item.EmergencyMobile), DataReader.GetNullValue(item.ContactPersonRelationId, 0)
, item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateParentsInfo(TransactionContext tc, Employee item)
{
string sql = SQLParser.MakeSQL(
@"UPDATE Employee SET MOTHERNAME=%s, MOTHEROCCUPATIONID=%n, FATHEROCCUPATIONID=%n, FATHERNAME=%s
where employeeid=%n",
item.MotherName, item.MotherOccupationId, item.FatherOccupationId, item.FatherName, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateProfilePercentage(TransactionContext tc, int empId)
{
SqlParameter[] p = new SqlParameter[1];
p[0] = SqlHelperExtension.CreateInParam("@empId", SqlDbType.Int, empId);
tc.ExecuteNonQuery(CommandType.StoredProcedure, "[dbo].[ProfileComplitionPercentCalcuate]", p);
}
internal static void UpdateSpouse(TransactionContext tc, EmpSpouse item)
{
string sql = SQLParser.MakeSQL(
@"UPDATE EmpSpouse SET Name=%s, EDUCATIONLEVELID=%n, OCCUPATIONID=%n, MARRIAGEDATE=%d
where employeeid=%n",
item.Name, item.EducationLevelID, item.OccupationID, item.MarriageDate, item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL(@"delete from ProfileUpdateRequest where purid=%n", id);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateChildren(TransactionContext tc, EmpChildren item)
{
string sql = SQLParser.MakeSQL(@"UPDATE EMPCHILDREN
SET NAME = %s,
GENDER = %n,
BIRTHDATE = %d,
MARITALSTATUS = %n,
OCCUPATIONID = %n,
PASSPORTNO = %s,
PASSPORTISSUEPLACE = %s,
PASSPORTISSUEDATE = %d,
PASSPORTEXPDATE = %d
WHERE EMPLOYEEID = %n",
item.Name, item.Gender, item.BirthDate, item.MaritalStatus, item.OccupationID, item.PassportNo,
item.PassportIssuePlace, item.PassportIssueDate,
item.PassportExpDate, item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateAcademic(TransactionContext tc, EmpAcademic item)
{
string sql = SQLParser.MakeSQL(@"UPDATE dbo.EMPACADEMIC
SET INSTITUTENAME = %s,
EDUCATIONTYPEID = %n,
EDUCATIONLEVELID = %n,
DISCIPLINEID = %n,
INSTITUTIONID = %n,
PASSINGYEAR = %n,
GPAORMARKS = %n,
OUTOF = %n,
RESULTTYPEID = %n
WHERE EMPLOYEEID = %n",
item.InstituteName, item.EducationTypeID, item.EducationLevelID, item.DisciplineID, item.InstitutionID,
item.PassingYear, item.GPAOrMarks, item.OutOf,
item.ResultTypeID, item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateNominee(TransactionContext tc, EmpNominee item)
{
string sql = SQLParser.MakeSQL(@"UPDATE EMPNOMINEE
SET
NOMINATIONPURPOSEID = %n,
NAME = %s,
RELATIONID = %n,
PERCENTAGE = %n,
OCCUPATIONID = %n,
ADDRESS = %s,
TELEPHONE = %s,
EMAILADDRESS = %s,
NOMINATIONDATE = %d,
BIRTHDATE = %d,
WHERE
EMPLOYEEID = %n",
item.NominationPurposeID, item.Name, item.RelationID, item.Percentage, item.OccupationID, item.Address,
item.TelePhone, item.EmailAddress,
item.NominationDate, item.BirthDate, item.EmployeeID);
tc.ExecuteNonQuery(sql);
}
internal static void Insert(TransactionContext tc, ProfileUpdateRequest item)
{
string sSql = SQLParser.MakeSQL(
@"INSERT INTO ProfileUpdateRequest (purId, Requestdate, PURequestType, PURequestStatus, RequestEmpID, RequestRemarks, RequestDescription, Approvedate, ApproveBy, ApproveRemarks,
PastInfo, MobileNo, NationalID, BloodGroup, TIN, PassportNo, PassportIssuePlace, PassportIssuedate, PassportExpirydate,
FatherName, FatherOccupationID, MotherName, MotherOccupationID, PermanentAddress, PermanentDistrictID, PermanentThanaID,
PermanentLandPhone, PermanentMobile, PresentAddress, PresentDistrictID, PresentThanaID, PresentLandPhone, PresentMobile,
EmergencyContactPerson, EmergencyAddress, EmergencyLandPhone, EmergencyMobileNo, EmergencyRelationID, SpouseName,
SpouseEducationLevelID, SpouseOccupationID, SpouseMarriagedate, ChildName, ChildGender, ChildBirthdate, ChildOccupationID,
ChildMaritalStatus, ChildPassportNo, ChildPassportIssuePlace, ChildPassportIssuedate, ChildPassportExpirydate,
AcademicEducationTypeID, AcademicDegreeID, AcademicDisciplineID, AcademicUniversityBoardID, AcademicInstitute,
AcademicExamHeldOn, AcademicPassingYear, AcademicResultID, AcademicGPA, AcademicOutOf, AcademicHeightsEducation,
NomineeTypeID, Nominationdate, NomineeName, NomineeRelationID, NomineePercent, NomineedateOfBirth, NomineeOccupationID,
NomineeAddress, NomineeTelephone, NomineeEmail, CreatedBy, CreationDate, ModifiedBy, ModifiedDate, EmployeeNo,
EmployeeName, trainingTypeId, natureOfTrainingId, trainingTitle, trainingDescription, trainingInstitutionId,
trainingInstituteName, trainingFromDate, trainingToDate,
trainingCountryId,trainingSponsoredType, trainingAchievement, trainingMonth,
trainingDay, trainingHour, trainingfees, trainingOtherCost,
experienceEmployer, experienceBusinessType, experienceEmployerContactInfo,
experienceDesignation, experienceAddress, experienceRole, experienceTelephone, experienceFrom, experienceTo, adminRemarks)
VALUES (%n, %d, %n, %n, %n, %s, %s, %d, %n, %s, %s, %s, %s, %n, %s, %s, %s, %d, %d, %s, %n, %s, %n, %s, %n, %n, %s, %s,
%s, %n, %n, %s, %s, %s, %s, %s, %s, %n, %s, %n, %n, %d, %s, %n, %d, %n, %n, %s, %s, %d, %d, %n, %n, %n, %n, %s, %s, %n,
%n, %n, %n, %n, %n, %d, %s, %n, %n, %d, %n, %s, %s, %s, %n, %d, %n, %d, %s, %s, %n, %n, %s, %s, %n, %s, %d, %d,
%n, %n, %s,%n, %n, %n,%n, %n,
%s, %s, %s, %s, %s, %s, %s, %d, %d, %s)",
item.ID, item.RequestDate, item.PURequestType, item.PURequestStatus, item.RequestEmpID,
item.RequestRemarks, item.RequestDescription, item.ApproveDate, item.ApproveBy, item.ApproveRemarks,
item.PastInfo, item.MobileNo, item.NationalID, item.BloodGroup, item.TIN, item.PassportNo,
item.ChildPassportIssuePlace, item.PassportIssueDate, item.PassportExpiryDate, item.FatherName,
item.FatherOccupationID, item.MotherName, item.MotherOccupationID, item.PermanentAddress,
item.PermanentDistrictID, item.PermanentThanaID, item.PermanentLandPhone, item.PermanentMobile,
item.PresentAddress, item.PresentDistrictID, item.PresentThanaID, item.PresentLandPhone,
item.PresentMobile, item.EmergencyContactPerson, item.EmergencyAddress, item.EmergencyLandPhone,
item.EmergencyMobileNo, item.EmergencyRelationID, item.SpouseName, item.SpouseEducationLevelID,
item.SpouseOccupationID, item.SpouseMarriageDate, item.ChildName, item.ChildGender, item.ChildBirthDate,
item.ChildOccupationID, item.ChildMaritalStatus, item.ChildPassportNo, item.ChildPassportIssuePlace,
item.ChildPassportIssueDate, item.ChildPassportExpiryDate, item.AcademicEducationTypeID,
item.AcademicDegreeID, item.AcademicDisciplineID, item.AcademicUniversityBoardID,
item.AcademicInstitute, item.AcademicExamHeldOn, item.AcademicPassingYear, item.AcademicResultID,
item.AcademicGPA, item.AcademicOutOf, item.AcademicHeightsEducation, item.NomineeTypeID,
item.NominationDate, item.NomineeName, item.NomineeRelationID, item.NomineePercent,
item.NomineeDateOfBirth, item.NomineeOccupationID, item.NomineeAddress, item.NomineeTelephone,
item.NomineeEmail, item.CreatedBy, item.CreatedDate, item.ModifiedBy, item.ModifiedDate, item.EmployeeNo,
item.EmployeeName, item.TrainingTypeId, item.NatureOfTrainingId, item.TrainingTitle, item.TrainingDescription,
item.TrainingInstitutionId, item.TrainingInstituteName, item.TrainingFromDate, item.TrainingToDate,
item.TrainingCountryId, item.TrainingSponsoredType, item.TrainingAchievement, item.TrainingMonth,
item.TrainingDay, item.TrainingHour, item.Trainingfees, item.TrainingOtherCost,
item.ExperienceEmployer, item.ExperienceBusinessType, item.ExperienceEmployerContactInfo, item.ExperienceDesignation,
item.ExperienceAddress, item.ExperienceRole, item.ExperienceTelephone, item.ExperienceFrom, item.ExperienceTo, item.AdminRemarks);
tc.ExecuteNonQuery(sSql);
}
internal static void RejectEmployeeRequestBulk(TransactionContext tc, string ids, int rejectedby, DateTime RejectedTime)
{
string sql = SQLParser.MakeSQL(@"update ProfileUpdateRequest set PURequestStatus=3,Approvedate = %d,
ApproveBy = %n where purId in (%q)", RejectedTime, rejectedby, ids);
tc.ExecuteNonQuery(sql);
}
internal static void Update(TransactionContext tc, ProfileUpdateRequest item)
{
string sSql = SQLParser.MakeSQL(@"UPDATE ProfileUpdateRequest
SET
Requestdate = %d,
PURequestType = %n,
PURequestStatus = %n,
RequestEmpID = %n,
RequestRemarks = %s,
RequestDescription = %s,
Approvedate = %d,
ApproveBy = %n,
ApproveRemarks = %s,
PastInfo = %s,
MobileNo = %s,
NationalID = %s,
BloodGroup = %n,
TIN = %s,
PassportNo = %s,
PassportIssuePlace = %s,
PassportIssuedate = %d,
PassportExpirydate = %d,
FatherName = %s,
FatherOccupationID = %n,
MotherName = %s,
MotherOccupationID = %n,
PermanentAddress = %s,
PermanentDistrictID = %n,
PermanentThanaID = %n,
PermanentLandPhone = %s,
PermanentMobile = %s,
PresentAddress = %s,
PresentDistrictID = %n,
PresentThanaID = %n,
PresentLandPhone = %s,
PresentMobile = %s,
EmergencyContactPerson = %s,
EmergencyAddress = %s,
EmergencyLandPhone = %s,
EmergencyMobileNo = %s,
EmergencyRelationID = %n,
SpouseName = %s,
SpouseEducationLevelID = %n,
SpouseOccupationID = %n,
SpouseMarriagedate = %d,
ChildName = %s,
ChildGender = %n,
ChildBirthdate = %d,
ChildOccupationID = %n,
ChildMaritalStatus = %n,
ChildPassportNo = %s,
ChildPassportIssuePlace = %s,
ChildPassportIssuedate = %d,
ChildPassportExpirydate = %d,
AcademicEducationTypeID = %n,
AcademicDegreeID = %n,
AcademicDisciplineID = %n,
AcademicUniversityBoardID = %n,
AcademicInstitute = %s,
AcademicExamHeldOn = %s,
AcademicPassingYear = %n,
AcademicResultID = %n,
AcademicGPA = %n,
AcademicOutOf = %n,
AcademicHeightsEducation = %n,
NomineeTypeID = %n,
Nominationdate = %d,
NomineeName = %s,
NomineeRelationID = %n,
NomineePercent = %n,
NomineedateOfBirth = %d,
NomineeOccupationID = %n,
NomineeAddress = %s,
NomineeTelephone = %s,
NomineeEmail = %s,
CreatedBy = %n,
CreationDate = %s,
ModifiedBy = %n,
ModifiedDate = %s,
EmployeeNo = %s,
EmployeeName = %s,
trainingTypeId = %n,
natureOfTrainingId = %n,
trainingTitle = %s,
trainingDescription = %s,
trainingInstitutionId = %n,
trainingInstituteName = %s,
trainingFromDate = %d,
trainingToDate = %d,
trainingCountryId = %n,
trainingSponsoredType = %n,
trainingAchievement = %s,
trainingMonth = %n,
trainingDay = %n,
trainingHour = %n,
trainingfees = %n,
trainingOtherCost = %n,
experienceEmployer = %s,
experienceBusinessType = %s,
experienceEmployerContactInfo = %s,
experienceDesignation = %s,
experienceAddress = %s,
experienceRole = %s,
experienceTelephone = %s,
experienceFrom = %d,
experienceTo = %d,
adminRemarks = %s
where purId = %n", item.RequestDate, item.PURequestType, item.PURequestStatus,
item.RequestEmpID, item.RequestRemarks, item.RequestDescription, item.ApproveDate, item.ApproveBy,
item.ApproveRemarks, item.PastInfo, item.MobileNo, item.NationalID, item.BloodGroup, item.TIN,
item.PassportNo, item.ChildPassportIssuePlace, item.PassportIssueDate, item.PassportExpiryDate,
item.FatherName, item.FatherOccupationID, item.MotherName, item.MotherOccupationID,
item.PermanentAddress,
item.PermanentDistrictID, item.PermanentThanaID, item.PermanentLandPhone, item.PermanentMobile,
item.PresentAddress, item.PresentDistrictID, item.PresentThanaID, item.PresentLandPhone,
item.PresentMobile,
item.EmergencyContactPerson, item.EmergencyAddress, item.EmergencyLandPhone, item.EmergencyMobileNo,
item.EmergencyRelationID, item.SpouseName, item.SpouseEducationLevelID, item.SpouseOccupationID,
item.SpouseMarriageDate, item.ChildName, item.ChildGender, item.ChildBirthDate, item.ChildOccupationID,
item.ChildMaritalStatus, item.ChildPassportNo, item.ChildPassportIssuePlace,
item.ChildPassportIssueDate,
item.ChildPassportExpiryDate, item.AcademicEducationTypeID, item.AcademicDegreeID,
item.AcademicDisciplineID, item.AcademicUniversityBoardID, item.AcademicInstitute,
item.AcademicExamHeldOn,
item.AcademicPassingYear, item.AcademicResultID, item.AcademicGPA, item.AcademicOutOf,
item.AcademicHeightsEducation, item.NomineeTypeID, item.NominationDate, item.NomineeName,
item.NomineeRelationID, item.NomineePercent, item.NomineeDateOfBirth, item.NomineeOccupationID,
item.NomineeAddress, item.NomineeTelephone, item.NomineeEmail, item.CreatedBy, item.CreatedDate,
item.ModifiedBy, item.ModifiedDate, item.EmployeeNo, item.EmployeeName, item.TrainingTypeId, item.NatureOfTrainingId,
item.TrainingTitle, item.TrainingDescription, item.TrainingInstitutionId, item.TrainingInstituteName, item.TrainingFromDate, item.TrainingToDate,
item.TrainingCountryId, item.TrainingSponsoredType, item.TrainingAchievement, item.TrainingMonth,
item.TrainingDay, item.TrainingHour, item.Trainingfees, item.TrainingOtherCost,
item.ExperienceEmployer, item.ExperienceBusinessType, item.ExperienceEmployerContactInfo, item.ExperienceDesignation,
item.ExperienceAddress, item.ExperienceRole, item.ExperienceTelephone, item.ExperienceFrom, item.ExperienceTo, item.AdminRemarks, item.ID);
tc.ExecuteNonQuery(sSql);
}
}
}