1603 lines
91 KiB
C#
1603 lines
91 KiB
C#
using System;
|
|
using System.Data;
|
|
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using Microsoft.AspNetCore.Routing.Template;
|
|
using Microsoft.Data.SqlClient;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public partial class HREmployeeDA
|
|
{
|
|
#region parent's functions
|
|
|
|
#region Get function
|
|
|
|
public static IDataReader GetEmployees(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee where EmployeeID = %n", empID);
|
|
}
|
|
|
|
public static IDataReader GetEmployeeByCode(TransactionContext tc, string employeeNo)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee where employeeNo = %s", employeeNo);
|
|
}
|
|
|
|
internal static IDataReader GetAllHREmps(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("Select * From Employee");
|
|
}
|
|
|
|
public static IDataReader GetByEmployeeNo(TransactionContext tc, string code, int payrolltypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee where EmployeeNo = %s AND PAYROLLTYPEID =%n", code,
|
|
payrolltypeid);
|
|
}
|
|
|
|
public static bool IsExists(string TableName, string ColName, string sCode, TransactionContext tc)
|
|
{
|
|
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM " + TableName + " WHERE " + ColName + "=%s", sCode);
|
|
return (Convert.ToInt32(ob) > 0);
|
|
}
|
|
|
|
public static IDataReader GetUserGroups(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee Where UserGroups IS Not NULL");
|
|
}
|
|
|
|
public static IDataReader GetEmployeeByIds(TransactionContext tc, string ids)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee where EmployeeID in (%q)", ids);
|
|
}
|
|
|
|
public static string GetSubordinateIDs(TransactionContext tc, int nodeID)
|
|
{
|
|
string subordinatesIDs = string.Empty;
|
|
|
|
DataSet ds = tc.ExecuteDataSet("Select NodeID from RAHierarchyNode where parentNodeID=%n", nodeID);
|
|
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
if (subordinatesIDs.Length > 0)
|
|
subordinatesIDs = subordinatesIDs + ",";
|
|
|
|
subordinatesIDs = subordinatesIDs + row.ItemArray[0].ToString();
|
|
string str = GetSubordinateIDs(tc, (int)row.ItemArray[0]);
|
|
if (str.Length > 0)
|
|
subordinatesIDs = subordinatesIDs + ",";
|
|
subordinatesIDs = subordinatesIDs + str;
|
|
}
|
|
|
|
return subordinatesIDs;
|
|
}
|
|
|
|
public static int GetNewID(TransactionContext tc)
|
|
{
|
|
return tc.GenerateID("Employee", "EmployeeID");
|
|
}
|
|
|
|
public static int GetNewID(TransactionContext tc, string tableName, string columnName)
|
|
{
|
|
return tc.GenerateID(tableName, columnName);
|
|
}
|
|
|
|
public static bool IsExists(TransactionContext tc, string sSearch)
|
|
{
|
|
string str = SQLParser.MakeSQL("SELECT COUNT(*) FROM Employee %q", sSearch);
|
|
object obj = tc.ExecuteScalar(str);
|
|
return Convert.ToInt32(obj) > 0;
|
|
}
|
|
|
|
public static IDataReader GetEmployees(TransactionContext tc, string sQuery)
|
|
{
|
|
return tc.ExecuteReader(sQuery, "");
|
|
}
|
|
|
|
public static DataSet GetSubordinatesEmps(TransactionContext tc, string Queries)
|
|
{
|
|
DataSet ds = tc.ExecuteDataSet(Queries);
|
|
return ds;
|
|
}
|
|
|
|
internal static IDataReader GetEmpWorkPlanSetup(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmployeeWorkPlanSetup WHERE EmployeeID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region update function
|
|
|
|
public static void UpdatePassword(TransactionContext tc, string password, int id)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Employee SET DESKTOPUSERPASS = %s WHERE EmployeeID=%n", password, id);
|
|
}
|
|
|
|
public static void Update(TransactionContext tc, HREmployee item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Update Employee SET NAME=%s,GENDER=%n,BIRTHDATE=%d,
|
|
TINNO=%s,JOININGDATE=%d,CATEGORYID=%n,
|
|
FATHERNAME=%s,RELIGIONID=%n,MARITALSTATUSID=%n,
|
|
MotherName=%s,FatherOccupationID=%n,mobileNo=%s,
|
|
MotherOccupationID=%n,BirthPlace=%s,BloodGroup=%n,
|
|
PassportNo=%s,Photograph=%s,NationalityID=%n,ShortName=%s,
|
|
EMAILADDRESS=%s,DATEOFCONFIRMATION=%d,EMPSIGNATURE=%s,
|
|
FunctionID=%n,FirstName=%s,MiddleName=%s,LastName=%s,
|
|
CompanyID=%n,GLOBALID=%s,NationalID=%s,DrivingLicenceNo =%s,
|
|
PassportIssuePlace=%s,PassportIssueDate=%d,PassportExpDate=%d,
|
|
Role=%n,FileNo=%s,ProfileComplitionPercent=%n, PersonType=%n, linemanagerid=%n, geid=%s, extrafield1=%s, extrafield2=%n,
|
|
extrafield3=%s, extrafield4=%s, extrafield5=%s, vendorCode=%s, InsuranceId=%s, inclusionDate=%d, Height=%s, Banglaname=%u , FatherNameBangla=%u, MotherNameBangla=%u, SpouseName = %s, SpouseNameBangla = %u
|
|
WHERE EmployeeID=%n",
|
|
item.Name, item.Gender, DataReader.GetNullValue(item.BirthDate), item.TinNo, item.JoiningDate,
|
|
DataReader.GetNullValue(item.CategoryID, 0), item.FatherName, item.ReligionID,
|
|
item.MaritalStatus, item.MotherName, DataReader.GetNullValue(item.FatherOccupationID, 0),
|
|
item.MobileNo, DataReader.GetNullValue(item.MotherOccupationID, 0), item.BirthPlace, item.BloodGroup,
|
|
item.PassportNo,
|
|
item.PhotoPath, item.NationalityID, item.NickName, item.EmailAddress,
|
|
DataReader.GetNullValue(item.ConfirDate),
|
|
DataReader.GetNullValue(item.Signature), item.FunctionID, item.FirstName,
|
|
item.MiddleName, item.LastName, item.CompanyID, item.GlobalID,
|
|
item.NationalID,
|
|
item.DrivingLicenceNo, item.PassportIssuePlace, DataReader.GetNullValue(item.PassportIssueDate),
|
|
DataReader.GetNullValue(item.PassportExpDate), (int)item.Role, DataReader.GetNullValue(item.FileNo),
|
|
item.ProfileComplitionPercent, item.PersonType, item.LineManagerID, item.GeId, item.ExtraField1, item.ExtraField2, item.ExtraField3,
|
|
item.ExtraField4, item.ExtraField5, item.VendorCode, item.InsuranceId, DataReader.GetNullValue(item.InclusionDate), item.Height, item.BanglaName, item.FatherNameBangla, item.MotherNameBangla, item.SpouseName, item.SpouseNameBangla, item.ID);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void UpdateForIntegration(TransactionContext tc, HREmployee item)
|
|
{
|
|
string sSql = SQLParser.MakeSQL(
|
|
"Update Employee Set GlobalID=%s, OneViewID=%s, EmployeeNo=%s, Name=%s, Gender=%n, BirthDate=%d, "
|
|
+ "JoiningDate=%d, EmailAddress=%s, MobileNo=%s, TinNo=%s, CategoryID=%n, "
|
|
+ "ForeignExPat=%n, IsConfirmed=%n, Status=%n, BranchID=%n, AccountNo=%s, "
|
|
+ "DepartmentID=%n, LocationID=%n, ReligionID=%n, MaritalStatusID=%n, DesignationID=%n, GradeID=%n, "
|
|
+ "BasicSalary=%n, DesigDescription=%s, DateOfConfirmation=%d, ModifiedBy=%n, "
|
|
+ "ModifiedDate=%d, PassportNo=%s, NationalityID=%n, FatherName=%s, MotherName=%s, FirstName=%s, MiddleName=%s, LastName=%s, BIRTHPLACE=%s, NationalID=%s, "
|
|
+ "PassportIssueDate=%d, PassportExpDate=%d, PayrollTypeID=%n, OutPayPaymentMode=%n, Height=%s Where EmployeeID=%n",
|
|
item.GlobalID, item.OneviewID, item.EmployeeNo, item.Name, (int)(item.Gender),
|
|
DataReader.GetNullValue(item.BirthDate),
|
|
DataReader.GetNullValue(item.JoiningDate), item.EmailAddress, item.MobileNo, item.TinNo,
|
|
DataReader.GetNullValue(item.CategoryID, 0),
|
|
item.ForeignExPat, item.IsConfirmed, (int)item.Status, item.BranchID,
|
|
item.AccountNo,
|
|
item.DepartmentID, item.LocationID,
|
|
item.ReligionID, (int)(item.MaritalStatus),
|
|
item.DesignationID, item.GradeID,
|
|
item.BasicSalary, DataReader.GetNullValue(item.DescriptionText),
|
|
item.ConfirDate, item.ModifiedBy,
|
|
item.ModifiedDate, item.PassportNo,
|
|
item.NationalityID, item.FatherName, item.MotherName, item.FirstName,
|
|
item.MiddleName, item.LastName,
|
|
item.BirthPlace, item.NationalID, item.PassportIssueDate,
|
|
item.PassportExpDate, item.PayrollTypeID, item.Height,
|
|
(int)EnumPaymentMode.BankTransfer, item.ID);
|
|
|
|
tc.ExecuteNonQuery(sSql);
|
|
}
|
|
|
|
public static void Update(TransactionContext tc, EmpContact item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Update EmpContact SET
|
|
EmployeeID = %n, PermanentAddress= %s, PermanentDistrictID= %n,
|
|
PermanentThanaID= %n, PermanentTelephone= %s,
|
|
PresentAddress= %s, PresentDistrictID= %n, PresentThanaID= %n,
|
|
PresentTelephone= %s, Mobile= %s, PersonalEmail= %s,
|
|
OfficialEMail= %s, Fax= %s, EmergencyContactAddress= %s,
|
|
EmergencyContactPerson= %s, EmergencyTelephone= %s,
|
|
PARMANENTMOBILE= %s, PRESENTMOBILE= %s, PERSONALTELEPHONE= %s,
|
|
EMERGENCYMOBILE= %s, CPRELATIONID= %n, PermanentAddressInBangla=%u, PresentAddressInBangla=%u
|
|
WHERE ContactID=%n",
|
|
item.EmployeeID, item.PermanentAddress, DataReader.GetNullValue(item.PermanentDistrictID),
|
|
DataReader.GetNullValue(item.PermanentThanaID), item.PermanentTelephone,
|
|
item.PresentAddress, DataReader.GetNullValue(item.PresentDistrictID),
|
|
DataReader.GetNullValue(item.PresentThanaID), item.PresentTelephone, item.Mobile, item.PersonalEmail,
|
|
item.OfficalEmail, item.Fax, item.EmergencyContactAddress, item.EmergencyContactPerson,
|
|
item.EmergencyTelephone, DataReader.GetNullValue(item.PermanentMobile),
|
|
DataReader.GetNullValue(item.PresentMobile), DataReader.GetNullValue(item.PersonalTelephone),
|
|
DataReader.GetNullValue(item.EmergencyMobile), DataReader.GetNullValue(item.ContactPersonRelationId, 0),
|
|
item.PermanentAddressInBangla, item.PresentAddressInBangla, item.ID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void UpdateForEmpLifeCycle(TransactionContext tc, HREmployee item, int EmpID)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
"Update Employee SET Role=%n, GradeID=%n,CategoryID=%n,CompanyID=%n,FunctionID=%n,DesignationID=%n,LocationID=%n,DepartmentID=%n,BasicSalary=%n,GrossSalary=%n,Status=%n, crgid=%n WHERE EmployeeID=%n",
|
|
(int)item.Role,
|
|
item.GradeID, item.CategoryID,
|
|
item.CompanyID, item.FunctionID,
|
|
item.DesignationID, item.LocationID,
|
|
item.DepartmentID, item.BasicSalary, item.GrossSalary, item.Status, item.CrgId, EmpID);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
|
|
public static void updateLineManagerByOrganogram(TransactionContext tc, int EmpID, int nodeid)
|
|
{
|
|
// set employee line manager
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid=(" +
|
|
//" SELECT orgemp.employeeid FROM ORGANOGRAM org, ORGANEMPLOYEE orgemp WHERE orgemp.nodeid =" +
|
|
//" (Select ogone.parentid from ORGANOGRAM ogone, ORGANEMPLOYEE ogeone where ogone.OrganogramID=%n and ogone.organogramid=ogeone.nodeid)" +
|
|
//" and org.organogramid=orgemp.nodeid) " +
|
|
//" where employee.employeeid=%n ", nodeid, EmpID);
|
|
|
|
// // set me as line-manager of my team
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid= %n where employee.employeeid in " +
|
|
// " (select orgemp.employeeid from ORGANOGRAM org, ORGANEMPLOYEE orgemp where org.parentid=%n and org.OrganogramID=orgemp.nodeid) " +
|
|
//" ", EmpID, nodeid);
|
|
|
|
}
|
|
|
|
public static void updateLineManagerOnlyByOrganogram(TransactionContext tc, OrganogramBasic item)
|
|
{
|
|
|
|
|
|
// tc.ExecuteNonQuery("update employee set linemanagerid= " +
|
|
// "(select p.employeeid from ORGANEMPLOYEE p where p.nodeid=%n ) where employeeid = " +
|
|
// " (select og.employeeid from ORGANEMPLOYEE og where og.nodeid=%n ) " +
|
|
//" ", item.ParentID, item.ID);
|
|
}
|
|
|
|
|
|
|
|
public static void updateRoceRemoveLineManagerByOrganogram(TransactionContext tc, int EmpID)
|
|
{
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid=null" +
|
|
//" where employee.employeeid=%n ", EmpID);
|
|
|
|
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid = null where employee.employeeid in (" +
|
|
// " SELECT orgemp.employeeid FROM ORGANOGRAM org, ORGANEMPLOYEE orgemp WHERE org.parentid in " +
|
|
// " (select ogtemp.OrganogramID from ORGANOGRAM ogtemp, ORGANEMPLOYEE ogemptemp where ogemptemp.Employeeid=%n and ogtemp.OrganogramID=ogemptemp.nodeid) " +
|
|
// " and org.OrganogramID=orgemp.nodeid)", EmpID);
|
|
}
|
|
|
|
public static void updateRoceRemoveLineManagerByEmployee(TransactionContext tc, int empid)
|
|
{
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid=null" +
|
|
//" where employee.employeeid =%n", empid);
|
|
|
|
|
|
// tc.ExecuteNonQuery("update employee set employee.linemanagerid = null " +
|
|
// "where employee.linemanagerid =%n " +
|
|
// " ", empid);
|
|
}
|
|
|
|
public static void UpdateForSelfService(TransactionContext tc, HREmployee item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
"Update Employee SET TINNO=%s,USERID=%n,PassportNo=%s,NationalID=%s WHERE EmployeeID=%n",
|
|
item.TinNo, item.ID, item.PassportNo, item.NationalID, item.ID);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void UpdateForSelfService(TransactionContext tc, EmpContact contact)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"Update EmpContact SET PresentAddress=%s, PresentDistrictID=%n, PresentThanaID=%n, PresentTelephone=%s, PresentMobile=%s,Mobile=%s,
|
|
PersonalEmail=%s, OfficialEMail=%s, Fax=%s,PersonalTelephone=%s, EmergencyContactAddress=%s, EmergencyContactPerson=%s, EmergencyTelephone=%s,
|
|
PermanentAddress=%s,PermanentDistrictID=%n,PermanentThanaID=%n,PermanentMobile=%s, PermanentAddressInBangla=%u,PresentAddressInBangla=%u
|
|
WHERE EmployeeID=%n",
|
|
contact.PresentAddress, contact.PresentDistrictID, contact.PresentThanaID, contact.PresentTelephone,
|
|
contact.PresentMobile, contact.Mobile, contact.PersonalEmail, contact.OfficalEmail,
|
|
contact.PersonalTelephone, contact.Fax, contact.EmergencyContactAddress, contact.EmergencyContactPerson,
|
|
contact.EmergencyTelephone, contact.PermanentAddress, contact.PermanentDistrictID,
|
|
contact.PermanentThanaID, contact.PermanentMobile, contact.PermanentAddressInBangla, contact.PresentAddressInBangla, contact.EmployeeID);
|
|
tc.ExecuteNonQuery(sql);
|
|
|
|
sql = SQLParser.MakeSQL("Update Employee SET EMAILADDRESS=%s WHERE EmployeeID=%n", contact.OfficalEmail,
|
|
contact.EmployeeID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void UpdateStatus(TransactionContext tc, int EmployeeID, EnumEmployeeStatus status)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Employee SET Status= %n WHERE EmployeeID=%n",
|
|
(int)status, EmployeeID);
|
|
}
|
|
|
|
public static void UpdateConfirm(TransactionContext tc, int EmployeeID, int status)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Employee SET isConfirmed= %n WHERE EmployeeID=%n",
|
|
status, EmployeeID);
|
|
}
|
|
|
|
public static void UpdatePFInfo(TransactionContext tc, int EmployeeID, EnumPFMembershipType eType, DateTime dt)
|
|
{
|
|
if (eType == EnumPFMembershipType.Live)
|
|
|
|
tc.ExecuteNonQuery("UPDATE Employee SET pFMemberType= %n,pfMemberShipDt=%d WHERE EmployeeID=%n",
|
|
(int)eType, dt, EmployeeID);
|
|
else
|
|
tc.ExecuteNonQuery("UPDATE Employee SET pFMemberType= 0,pfMemberShipDt= null WHERE EmployeeID=%n",
|
|
EmployeeID);
|
|
|
|
}
|
|
|
|
public static void UpdateEndofContact(TransactionContext tc, int EmployeeID, DateTime dt)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Employee SET ENDOFCONTRACTDATE= %d WHERE EmployeeID=%n",
|
|
dt, EmployeeID);
|
|
}
|
|
|
|
public static void UpdatemiddleOfMonthDiscontinue(TransactionContext tc, int EmployeeID,
|
|
EnumEmployeeStatus status, DateTime endofContactDate)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE Employee SET status=%n, MonthStatusUpdate= %n, endOfContractDate=%d WHERE EmployeeID=%n",
|
|
EnumEmployeeStatus.Live, (int)status, endofContactDate, EmployeeID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region insert function
|
|
|
|
internal static void Insert(TransactionContext tc, HREmployee item)
|
|
{
|
|
if (item.CreatedBy == 0) item.CreatedBy = 1;
|
|
string sSql = SQLParser.MakeSQL(
|
|
"INSERT INTO Employee(EmployeeID, globalID, employeeNo, name, gender, birthDate,PhotoPath, "
|
|
+ "joiningDate, endOfContractDate, emailAddress, mobileNo, tinNo, categoryID, "
|
|
+ "foreignExPat, continueGratuity, taxCircle, isConfirmed, status, isShownInTaxSheet, "
|
|
+ "pFMemberType, pfMemberShipDt, branchID, accountNo, outPayBranchID, outPayAccountNo, "
|
|
+ "departmentID, locationID, religionID, maritalStatusID, designationID, gradeID, "
|
|
+ "basicSalary, EmpHistoryID, prevBasic, paymentMode, fatherName, isEligibleOT, "
|
|
+ "desigDescription, desktopUserPass, payrollTypeID, IsAutoProcess, cardID, grossSalary, "
|
|
+ "payScaleId, taxAmount, dateOfConfirmation, CreatedBy, "
|
|
+ "CreationDate,MonthStatusUpdate, ShortName, BloodGroup, PassportNo,"
|
|
+ "NationalityID, FatherOccupationID, MotherName, MotherOccupationID,EMPSIGNATURE,FunctionID,"
|
|
+ "CompanyID,FirstName,MiddleName,LastName,BIRTHPLACE,NationalID,"
|
|
+ "DrivingLicenceNo,PassportIssuePlace,PassportIssueDate,PassportExpDate,Role,FileNo,"
|
|
+ "OutPayPaymentMode,ProfileStatus,ProfileComplitionPercent,PersonType, linemanagerid, geid, "
|
|
+ "extrafield1, extrafield2, extrafield3, extrafield4, extrafield5, vendorCode, InsuranceId, "
|
|
+ "inclusionDate, Height, Banglaname, FatherNameBangla, MotherNameBangla, SpouseName, SpouseNameBangla)"
|
|
+ " VALUES(%n, %s, %s, %s, %n, %d,%s, "
|
|
+ " %d, %d, %s, %s, %s, %n, "
|
|
+ " %n, %n, %n, %n, %n, %n, "
|
|
+ " %n, %d, %n, %s, %n, %s, "
|
|
+ " %n, %n, %n, %n, %n, %n, "
|
|
+ " %n, %n, %n, %n, %s, %n, "
|
|
+ " %s, %s, %n, %n, %n, %n, "
|
|
+ " %n, %n, %d,%n, "
|
|
+ " %d, %n, %s, %n, %s,"
|
|
+ " %n, %n, %s, %n,%s,%n,%n,%s,%s,%s,%s,%s,%s,%s,"
|
|
+ "%d,%d,%n,%s,%n,%n,%n,%n, %n, %s, %s, %n, %s, %s, %s, "
|
|
+ "%s, %s, %d, %s, %u, %u, %u, %s, %s)",
|
|
item.ID, item.GlobalID,
|
|
item.EmployeeNo, item.Name, item.Gender, DataReader.GetNullValue(item.BirthDate), item.PhotoPath,
|
|
DataReader.GetNullValue(item.JoiningDate), DataReader.GetNullValue(item.EndOfContractDate),
|
|
item.EmailAddress, item.MobileNo, item.TinNo, DataReader.GetNullValue(item.CategoryID, 0),
|
|
item.ForeignExPat, item.ContinueGratuity, (int)item.TaxCircle, item.IsConfirmed, item.Status,
|
|
item.IsShownInTaxSheet,
|
|
item.PFMemberType, DataReader.GetNullValue(item.PFMemberShiptDate),
|
|
item.BranchID, item.AccountNo,
|
|
item.OutPayBranchID, item.OutPayAccountNo,
|
|
item.DepartmentID, item.LocationID,
|
|
item.ReligionID, item.MaritalStatus,
|
|
item.DesignationID, item.GradeID,
|
|
item.BasicSalary, item.CurrentHistoryID, item.PrevBasic, item.PaymentMode,
|
|
item.FatherName, item.IsEligibleOT,
|
|
item.DescriptionText, item.DesktopUserPass, item.PayrollTypeID,
|
|
item.IsAutoProcess, item.CardID, item.GrossSalary,
|
|
item.PayScaleId, item.TaxAmount, DataReader.GetNullValue(item.ConfirDate),
|
|
item.CreatedBy,
|
|
item.CreatedDate, item.MonthStatusUpdate, item.NickName, item.BloodGroup, item.PassportNo,
|
|
item.NationalityID, DataReader.GetNullValue(item.FatherOccupationID, 0),
|
|
item.MotherName, DataReader.GetNullValue(item.MotherOccupationID, 0),
|
|
DataReader.GetNullValue(item.Signature), item.FunctionID,
|
|
item.CompanyID,
|
|
item.FirstName, item.MiddleName, item.LastName, item.BirthPlace, item.NationalID, item.DrivingLicenceNo,
|
|
item.PassportIssuePlace, DataReader.GetNullValue(item.PassportIssueDate),
|
|
DataReader.GetNullValue(item.PassportExpDate), (int)item.Role, item.FileNo,
|
|
(int)EnumPaymentMode.BankTransfer, item.ProfileStatus, item.ProfileComplitionPercent, item.PersonType, item.LineManagerID, item.GeId, item.ExtraField1, item.ExtraField2, item.ExtraField3,
|
|
item.ExtraField4, item.ExtraField5, item.VendorCode, item.InsuranceId, DataReader.GetNullValue(item.InclusionDate), item.Height, item.BanglaName, item.FatherNameBangla, item.MotherNameBangla, item.SpouseName, item.SpouseNameBangla);
|
|
tc.ExecuteNonQuery(sSql);
|
|
}
|
|
|
|
internal static void InsertForIntegration(TransactionContext tc, HREmployee item)
|
|
{
|
|
string sSql = SQLParser.MakeSQL(
|
|
"INSERT INTO Employee(EmployeeID, GlobalID, OneViewID, EmployeeNo, Name, Gender, BirthDate, "
|
|
+ "JoiningDate, EmailAddress, MobileNo, TinNo, CategoryID, "
|
|
+ "ForeignExPat, IsConfirmed, Status, BranchID, AccountNo, "
|
|
+ "DepartmentID, LocationID, ReligionID, MaritalStatusID, DesignationID, GradeID, "
|
|
+ "BasicSalary, DesigDescription, DateOfConfirmation, CreatedBy, "
|
|
+ "CreationDate, PassportNo, NationalityID, FatherName, MotherName, FirstName, MiddleName, LastName, BIRTHPLACE, NationalID, "
|
|
+ "PassportIssueDate, PassportExpDate, PayrollTypeID, OutPayPaymentMode,ProfileStatus, Height, FatherNameBangla, MotherNameBangla )"
|
|
+ " VALUES(%n, %s, %s, %s, %s, %n, %d, "
|
|
+ "%d, %s, %s, %s, %n, "
|
|
+ "%n, %n, %n, %n, %s, "
|
|
+ "%n, %n, %n, %n, %n, %n, "
|
|
+ "%n, %s, %d, %n, %d, %s, "
|
|
+ "%n, %s, %s, %s, %s, %s, %s, %s, %d, %d, %n, %n,%n, %s, %u, %u)", item.ID, item.GlobalID, item.OneviewID,
|
|
item.EmployeeNo, item.Name, (int)(item.Gender), item.BirthDate,
|
|
item.JoiningDate, item.EmailAddress, item.MobileNo, item.TinNo,
|
|
item.CategoryID,
|
|
item.ForeignExPat, item.IsConfirmed, (int)(item.Status), item.BranchID,
|
|
item.AccountNo,
|
|
item.DepartmentID, item.LocationID,
|
|
item.ReligionID, (int)(item.MaritalStatus),
|
|
item.DesignationID, item.GradeID,
|
|
item.BasicSalary, item.DescriptionText, item.ConfirDate,
|
|
item.CreatedBy,
|
|
item.CreatedDate, item.PassportNo, item.NationalityID, item.FatherName,
|
|
item.MotherName, item.FirstName,
|
|
item.MiddleName, item.LastName, item.BirthPlace, item.NationalID,
|
|
item.PassportIssueDate,
|
|
item.PassportExpDate, item.PayrollTypeID,
|
|
(int)EnumPaymentMode.BankTransfer, item.ProfileStatus, item.Height, item.FatherNameBangla, item.MotherNameBangla);
|
|
|
|
tc.ExecuteNonQuery(sSql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpContact item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT INTO EmpContact(" +
|
|
"EmployeeID, ContactID, PARMANENTADDRESS, PARMANENTDISTRICTID, PARMANENTTHANAID, PARMANENTTELEPHONE," +
|
|
" PresentAddress, PresentDistrictID, PresentThanaID, PresentTelephone, Mobile, PersonalEmail," +
|
|
" OfficialEMail, Fax, EmergencyContactAddress, EmergencyContactPerson, EmergencyTelephone, PARMANENTMOBILE, " +
|
|
" PRESENTMOBILE, PERSONALTELEPHONE, EMERGENCYMOBILE, CPRELATIONID,ProfileStatus,PermanentAddressInBangla,PresentAddressInBangla,PermanentPostCodeNo,PresentPostCodeNo, PresentPOInBangla, ParmanentPOInBangla)" +
|
|
" VALUES(" +
|
|
" %n, %n, %s, %n, %n, %s, " +
|
|
" %s, %n, %n, %s, %s, %s," +
|
|
" %s, %s, %s, %s, %s, %s," +
|
|
" %s, %s, %s, %n,%n, %u, %u, %s, %s, %u, %u)",
|
|
item.EmployeeID, item.ID, item.PermanentAddress, DataReader.GetNullValue(item.PermanentDistrictID, 0),
|
|
DataReader.GetNullValue(item.PermanentThanaID, 0), item.PermanentTelephone,
|
|
item.PresentAddress, DataReader.GetNullValue(item.PresentDistrictID, 0),
|
|
DataReader.GetNullValue(item.PresentThanaID, 0), item.PresentTelephone, item.Mobile, item.PersonalEmail,
|
|
item.OfficalEmail, item.Fax, item.EmergencyContactAddress, item.EmergencyContactPerson,
|
|
item.EmergencyTelephone, DataReader.GetNullValue(item.PermanentMobile),
|
|
DataReader.GetNullValue(item.PresentMobile), DataReader.GetNullValue(item.PersonalTelephone),
|
|
DataReader.GetNullValue(item.EmergencyMobile),
|
|
DataReader.GetNullValue(item.ContactPersonRelationId, 0), item.ProfileStatus, item.PermanentAddressInBangla, item.PresentAddressInBangla, item.PermanentPostCodeNo, item.PresentPostCodeNo, item.PresentPOInBangla, item.ParmanentPOInBangla);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
|
|
public static void update(TransactionContext tc, EmpContact item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("Update EmpContact set " +
|
|
"PARMANENTADDRESS =%s , PARMANENTDISTRICTID =%n, PARMANENTTHANAID =%n, PARMANENTTELEPHONE=%s," +
|
|
" PresentAddress=%s, PresentDistrictID=%n, PresentThanaID=%n, PresentTelephone=%s, Mobile =%s, PersonalEmail=%s," +
|
|
" OfficialEMail=%s, Fax=%s, EmergencyContactAddress=%s, EmergencyContactPerson=%s, EmergencyTelephone=%s, PARMANENTMOBILE=%s, " +
|
|
" PRESENTMOBILE=%s, PERSONALTELEPHONE=%s, EMERGENCYMOBILE=%s, CPRELATIONID=%n,ProfileStatus=%n,PermanentAddressInBangla=%u,PresentAddressInBangla=%u,PermanentPostCodeNo=%s,PresentPostCodeNo=%s, PresentPOInBangla = %u, ParmanentPOInBangla = %u" +
|
|
" where EmployeeID =%n and ContactID =%n ",
|
|
item.PermanentAddress, DataReader.GetNullValue(item.PermanentDistrictID, 0),
|
|
DataReader.GetNullValue(item.PermanentThanaID, 0), item.PermanentTelephone,
|
|
item.PresentAddress, DataReader.GetNullValue(item.PresentDistrictID, 0),
|
|
DataReader.GetNullValue(item.PresentThanaID, 0), item.PresentTelephone, item.Mobile, item.PersonalEmail,
|
|
item.OfficalEmail, item.Fax, item.EmergencyContactAddress, item.EmergencyContactPerson,
|
|
item.EmergencyTelephone, DataReader.GetNullValue(item.PermanentMobile),
|
|
DataReader.GetNullValue(item.PresentMobile), DataReader.GetNullValue(item.PersonalTelephone),
|
|
DataReader.GetNullValue(item.EmergencyMobile),
|
|
DataReader.GetNullValue(item.ContactPersonRelationId, 0), item.ProfileStatus, item.PermanentAddressInBangla, item.PresentAddressInBangla, item.PermanentPostCodeNo, item.PresentPostCodeNo, item.PresentPOInBangla, item.ParmanentPOInBangla, item.EmployeeID, item.ID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpSpouse spouse)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT INTO EmpSpouse(" +
|
|
"EmployeeID, SpouseID, MarriageDate, Name, EducationLevelID, OccupationID,PassportNo,PassportIssuePlace,PassportIssueDate,PassportExpDate," +
|
|
"ProfileStatus, InsuranceId, InclusionDate, DateOfBirth, nameinbangla) " +
|
|
"VALUES(%n, %n, %d, %s, %n, %n,%s,%s,%d,%d," +
|
|
"%n,%s, %d, %d, %u)",
|
|
spouse.EmployeeID, spouse.ID, DataReader.GetNullValue(spouse.MarriageDate), spouse.Name,
|
|
DataReader.GetNullValue(spouse.EducationLevelID, 0),
|
|
DataReader.GetNullValue(spouse.OccupationID, 0), spouse.PassportNo, spouse.PassportIssuePlace,
|
|
DataReader.GetNullValue(spouse.PassportIssueDate),
|
|
DataReader.GetNullValue(spouse.PassportExpDate), (int)spouse.ProfileStatus, (string)spouse.InsuranceId, DataReader.GetNullValue(spouse.InclusionDate), DataReader.GetNullValue(spouse.DateOfBirth), spouse.Nameinbangla);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void update(TransactionContext tc, EmpSpouse spouse)
|
|
{
|
|
string sql = SQLParser.MakeSQL("update EmpSpouse set" +
|
|
" MarriageDate=%d, Name=%s, EducationLevelID=%n, OccupationID=%n,PassportNo=%s,PassportIssuePlace=%s,PassportIssueDate=%d,PassportExpDate=%d,ProfileStatus=%n, InsuranceId=%s, InclusionDate=%d, DateOfBirth=%d, nameinbangla=%u " +
|
|
" where EmployeeID =%n and SpouseID=%n ", spouse.MarriageDate, spouse.Name,
|
|
DataReader.GetNullValue(spouse.EducationLevelID, 0),
|
|
DataReader.GetNullValue(spouse.OccupationID, 0), spouse.PassportNo, spouse.PassportIssuePlace,
|
|
DataReader.GetNullValue(spouse.PassportIssueDate),
|
|
DataReader.GetNullValue(spouse.PassportExpDate), spouse.ProfileStatus, spouse.InsuranceId,
|
|
spouse.InclusionDate, spouse.DateOfBirth, spouse.Nameinbangla,
|
|
spouse.EmployeeID, spouse.ID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
|
|
public static void Insert(TransactionContext tc, EmpChildren child)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpChildren(" +
|
|
"EmployeeID, ChildID, Name, Gender, BirthDate, MaritalStatus, OccupationID,PassportNo,PassportIssuePlace,PassportIssueDate,PassportExpDate,ProfileStatus, InsuranceId, InclusionDate,NID,EDUCATIONLEVELID )" +
|
|
"VALUES(%n, %n, %s, %n, %d, %n, %n, %s, %s, %d, %d, %n, %s, %d, %s, %n)",
|
|
child.EmployeeID, child.ID, child.Name, child.Gender, DataReader.GetNullValue(child.BirthDate),
|
|
child.MaritalStatus,
|
|
DataReader.GetNullValue(child.OccupationID, 0), child.PassportNo, child.PassportIssuePlace,
|
|
child.PassportIssueDate,
|
|
child.PassportExpDate, child.ProfileStatus, child.InsuranceId, child.InclusionDate, child.NID, child.EDUCATIONLEVELID);
|
|
}
|
|
|
|
public static void update(TransactionContext tc, EmpChildren child)
|
|
{
|
|
tc.ExecuteNonQuery("update EmpChildren set" +
|
|
" Name=%s, Gender=%n, BirthDate=%d, MaritalStatus=%n, OccupationID=%n,PassportNo=%s,PassportIssuePlace=%s,PassportIssueDate=%d,PassportExpDate=%d,ProfileStatus=%n, InsuranceId=%s, InclusionDate=%d " +
|
|
" where EmployeeID=%n and ChildID=%n",
|
|
child.Name, child.Gender, DataReader.GetNullValue(child.BirthDate),
|
|
child.MaritalStatus,
|
|
DataReader.GetNullValue(child.OccupationID, 0), child.PassportNo, child.PassportIssuePlace,
|
|
child.PassportIssueDate,
|
|
child.PassportExpDate, child.ProfileStatus, child.InsuranceId, child.InclusionDate,
|
|
child.EmployeeID, child.ID);
|
|
}
|
|
|
|
|
|
public static void Insert(TransactionContext tc, EmpExperience experience)
|
|
{
|
|
if (experience.LastJob == true)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE dbo.EMPEXPERIENCE SET LASTJOB = 0 WHERE EMPLOYEEID = %n", experience.EmployeeID);
|
|
}
|
|
|
|
tc.ExecuteNonQuery("INSERT INTO EmpExperience(" +
|
|
"EmployeeID, ExperienceID, Employer, ContactPerson, Address, Telephone," +
|
|
" EmployerActivity, Designation, JobDescription, FromDate, ToDate, LastJob,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %n, %s, %s, %s, %s," +
|
|
" %s, %s, %s, %d, %d, %n,%n)", experience.EmployeeID, experience.ID, experience.Employer,
|
|
experience.ContactPerson, experience.Address, experience.Telephone,
|
|
experience.EmployerActivity, experience.Designation, experience.JobDescription,
|
|
DataReader.GetNullValue(experience.FromDate),
|
|
DataReader.GetNullValue(experience.ToDate), experience.LastJob, experience.ProfileStatus);
|
|
}
|
|
|
|
public static void update(TransactionContext tc, EmpExperience experience)
|
|
{
|
|
if (experience.LastJob == true)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE dbo.EMPEXPERIENCE SET LASTJOB = 0 WHERE EMPLOYEEID = %n", experience.EmployeeID);
|
|
}
|
|
|
|
tc.ExecuteNonQuery("Update EmpExperience set" +
|
|
" Employer=%s, ContactPerson=%s, Address=%s, Telephone=%s," +
|
|
" EmployerActivity=%s, Designation=%s, JobDescription=%s, FromDate=%d, ToDate=%d, LastJob=%b,ProfileStatus=%n" +
|
|
" where EmployeeID=%n and ExperienceID=%n" +
|
|
" " +
|
|
" ", experience.Employer,
|
|
experience.ContactPerson, experience.Address, experience.Telephone,
|
|
experience.EmployerActivity, experience.Designation, experience.JobDescription,
|
|
DataReader.GetNullValue(experience.FromDate),
|
|
DataReader.GetNullValue(experience.ToDate), experience.LastJob, experience.ProfileStatus, experience.EmployeeID, experience.ID);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpTraining training)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpTraining(" +
|
|
" EmpTrainingID,EmployeeID, Name, Description, CountryID, InstitutionID," +
|
|
" TrainingPlace, ACHIEVEMENT, Fees, OtherCost, Fromdate, ToDate," +
|
|
" TrainingMonth, TrainingDay, TrainingHour, NatureOfTrainingID, TrainingTypeID, TrainingCompletedFrom, ProfileStatus)" +
|
|
"VALUES(" +
|
|
" %n, %n, %s, %s, %n, %n," +
|
|
" %s, %s, %n, %n, %d, %d, " +
|
|
" %n, %n, %n, %n, %n, %n,%n)",
|
|
training.ID, training.EmployeeID, training.Name, training.Description,
|
|
DataReader.GetNullValue(training.CountryID, 0), DataReader.GetNullValue(training.InstitutionID, 0),
|
|
training.Place, training.Achievement, training.Fees, training.OtherCost,
|
|
DataReader.GetNullValue(training.FromDate), DataReader.GetNullValue(training.ToDate),
|
|
training.TrainingMonth, training.TrainingDay, training.TrainingHour,
|
|
DataReader.GetNullValue(training.NatureOfTrainingID, 0),
|
|
DataReader.GetNullValue(training.TrainingTypeID, 0), training.TrainingCompletedFrom,
|
|
training.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpAcademic academic)
|
|
{
|
|
if (academic.LastLevel == true)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE dbo.EMPACADEMIC SET LASTLEVEL = 0 WHERE employeeid = %n", academic.EmployeeID);
|
|
}
|
|
|
|
tc.ExecuteNonQuery("INSERT INTO EmpAcademic(" +
|
|
" AcademicID,EmployeeID, EducationLevelID, DisciplineID, InstitutionID, PassingYear," +
|
|
" CLASSORDIVISION, GPAOrMarks, LastLevel, OutOf, ResultTypeID, InstituteName,EducationTypeID,PhotoPath,DocSubmissionDate,ProfileStatus, ExamHeldOn)" +
|
|
" VALUES(" +
|
|
" %n, %n, %n, %n, %n, %n," +
|
|
" %s, %n, %n, %n, %n, %s,%n,%s,%d,%n,%n)",
|
|
academic.ID, academic.EmployeeID, academic.EducationLevelID,
|
|
DataReader.GetNullValue(academic.DisciplineID, 0), DataReader.GetNullValue(academic.InstitutionID, 0),
|
|
DataReader.GetNullValue(academic.PassingYear),
|
|
DataReader.GetNullValue(academic.ClassOrDivision), academic.GPAOrMarks, academic.LastLevel,
|
|
academic.OutOf, DataReader.GetNullValue(academic.ResultTypeID, 0),
|
|
DataReader.GetNullValue(academic.InstituteName), DataReader.GetNullValue(academic.EducationTypeID, 0),
|
|
academic.PhotoPath, academic.DocSubmissionDate, academic.ProfileStatus, academic.ExamDate);
|
|
}
|
|
|
|
public static void update(TransactionContext tc, EmpAcademic academic)
|
|
{
|
|
if (academic.LastLevel == true)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE dbo.EMPACADEMIC SET LASTLEVEL = 0 WHERE employeeid = %n", academic.EmployeeID);
|
|
}
|
|
|
|
tc.ExecuteNonQuery("Update EmpAcademic " +
|
|
" set EducationLevelID=%n, DisciplineID=%n, InstitutionID=%n, PassingYear=%n," +
|
|
" CLASSORDIVISION=%s, GPAOrMarks=%n, LastLevel=%b, OutOf=%n, ResultTypeID=%n, InstituteName=%s,EducationTypeID=%s,PhotoPath=%s,DocSubmissionDate=%d,ProfileStatus=%n, ExamHeldOn = %n " +
|
|
" where AcademicID =%n and EmployeeID =%n ", academic.EducationLevelID,
|
|
DataReader.GetNullValue(academic.DisciplineID, 0), DataReader.GetNullValue(academic.InstitutionID, 0),
|
|
DataReader.GetNullValue(academic.PassingYear),
|
|
DataReader.GetNullValue(academic.ClassOrDivision), academic.GPAOrMarks, academic.LastLevel,
|
|
academic.OutOf, DataReader.GetNullValue(academic.ResultTypeID, 0),
|
|
DataReader.GetNullValue(academic.InstituteName), DataReader.GetNullValue(academic.EducationTypeID, 0),
|
|
academic.PhotoPath, academic.DocSubmissionDate, academic.ProfileStatus, academic.ExamDate,
|
|
academic.ID, academic.EmployeeID);
|
|
}
|
|
|
|
|
|
public static void Insert(TransactionContext tc, EmpAchievement item)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT INTO EmpAchivement(EmployeeID, EmpAchivementID, AchivementID, ProfileStatus) VALUES (%n, %n, %n,%n)", item.EmployeeID, item.ID, item.AchievementID, item.ProfileStatus);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpHobby item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpHobby(EmployeeID, EmpHobbyID, HobbyID,ProfileStatus)" +
|
|
" VALUES(%n, %n, %n,%n)", item.EmployeeID, item.ID, item.HobbyID, item.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpOtherTalent item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpOtherTalent(EmployeeID, EmpOtherTalentID, OtherTalentID,ProfileStatus)" +
|
|
" VALUES(%n, %n, %n,%n)", item.EmployeeID, item.ID, item.OtherTalentID,
|
|
item.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpCurricularActivity item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO EmpExtraCurricularActivity (EmployeeID, EmpExtraCurricularActivityID, ExtraCurricularActivityID,ProfileStatus) " +
|
|
" VALUES(%n, %n, %n,%n)", item.EmployeeID, item.ID, item.CurricularActivityID, item.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpAllergy item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpAllergy(EMPALLERGYID, EmployeeID, ALLERGYID,ProfileStatus)" +
|
|
" VALUES(%n, %n, %n,%n)", item.ID, item.EmployeeID, item.AllergyID, item.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpPublication publication)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpPUBLICATION(" +
|
|
" PUBLICATIONID, EmployeeID, TITLE, DESCRIPTION, REMARKS, PUBLICATIONDATE, " +
|
|
" PUBLICATIONTYPE, PUBLISHERSNAME,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %n, %s, %s, %s, %d," +
|
|
" %s, %s,%n)",
|
|
DataReader.GetNullValue(publication.ID), DataReader.GetNullValue(publication.EmployeeID, 0),
|
|
DataReader.GetNullValue(publication.Title), DataReader.GetNullValue(publication.Description),
|
|
DataReader.GetNullValue(publication.Remarks), DataReader.GetNullValue(publication.PublicationDate),
|
|
publication.PublicationType, publication.PublishersName, publication.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpReference reference)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpReference(" +
|
|
"EmployeeID, ReferenceID, Name, OccupationID, Address, Telephone," +
|
|
" EmailAddress, RelationID,ReferenceMobile,ProfileStatus)" +
|
|
"VALUES(" +
|
|
" %n, %n, %s, %n, %s, %s," +
|
|
" %s, %n, %s,%n)",
|
|
reference.EmployeeID, reference.ID, reference.Name, DataReader.GetNullValue(reference.OccupationID, 0),
|
|
reference.Address, reference.Telephone,
|
|
reference.EmailAddress, DataReader.GetNullValue(reference.RelationID, 0), reference.ReferenceMobile,
|
|
reference.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpNominee nominee)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpNominee(" +
|
|
"EmployeeID, NomineeID, NominationPurposeID, NominationDate, Name, RelationID, " +
|
|
" Percentage, BirthDate, OccupationID, Address, TelePhone," +
|
|
" EmailAddress)" +
|
|
" VALUES(" +
|
|
" %n, %n, %n, %d, %s, %n," +
|
|
" %n, %d, %n, %s, %s, %s)",
|
|
nominee.EmployeeID, nominee.ID, nominee.NominationPurposeID,
|
|
DataReader.GetNullValue(nominee.NominationDate), nominee.Name,
|
|
DataReader.GetNullValue(nominee.RelationID, 0),
|
|
nominee.Percentage, DataReader.GetNullValue(nominee.BirthDate),
|
|
DataReader.GetNullValue(nominee.OccupationID, 0), nominee.Address, nominee.TelePhone,
|
|
nominee.EmailAddress);
|
|
}
|
|
|
|
public static void Update(TransactionContext tc, EmpNominee nominee)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE [dbo].[EMPNOMINEE]
|
|
SET [NOMINEEID] = %n
|
|
,[NOMINATIONPURPOSEID] = %n
|
|
,[NAME] = %s
|
|
,[RELATIONID] = %n
|
|
,[PERCENTAGE] = %n
|
|
,[OCCUPATIONID] = %n
|
|
,[ADDRESS] = %s
|
|
,[TELEPHONE] = %s
|
|
,[EMAILADDRESS] = %s
|
|
WHERE NOMINEEID = %n", nominee.ID, nominee.NominationPurposeID, nominee.Name, nominee.RelationID,
|
|
nominee.Percentage, nominee.OccupationID, nominee.Address, nominee.TelePhone, nominee.EmailAddress,
|
|
nominee.ID);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpHospitalization item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpHospitalization(" +
|
|
" HospitalizationID,EmployeeID, RegistrationDate, RegisteredPerson, RelationId, BirthDate, " +
|
|
" OccupationId, Address, Photograph, Telephone, Email,Mobile,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %n, %d, %s, %n, %d," +
|
|
" %n, %s, %s, %s, %s,%s,%n)",
|
|
item.ID, item.EmployeeID, DataReader.GetNullValue(item.RegistrationDate), item.RegisteredPerson,
|
|
DataReader.GetNullValue(item.RelationId, 0), DataReader.GetNullValue(item.BirthDate),
|
|
DataReader.GetNullValue(item.OccupationID, 0), DataReader.GetNullValue(item.Address),
|
|
DataReader.GetNullValue(item.Photograph),
|
|
DataReader.GetNullValue(item.Telephone), DataReader.GetNullValue(item.Email),
|
|
DataReader.GetNullValue(item.Mobile), item.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpGuarantor guarantor)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpGuarantor(" +
|
|
" GUARANTORID, EmployeeID, NAME, OCCUPATIONID, ADDRESS, TELEPHONE," +
|
|
" EMAILADDRESS, CATEGORYDOCID, DOCUMENTPATH, MOBILE,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %n, %s, %n, %s, %s," +
|
|
" %s, %n, %s, %s,%n)",
|
|
guarantor.ID, guarantor.EmployeeID, guarantor.Name, guarantor.OccupationID, guarantor.Address,
|
|
guarantor.Telephone,
|
|
guarantor.EmailAddress, DataReader.GetNullValue(guarantor.CategotyDocId, 0), guarantor.DocumentPath,
|
|
guarantor.GuarantorMobile, guarantor.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpLanguage language)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpLanguage(" +
|
|
" EmpLanguageID, LanguageName, SpokenStatus, WrittenStatus,EmployeeID,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %s, %n, %n, %n,%n)",
|
|
language.ID, language.LanguageName, language.SpokenStatus, language.WrittenStatus, language.EmployeeID,
|
|
language.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpRelative relative)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpRelative(" +
|
|
" EmpRelativeID, Name, Designation, RelationID, JoiningDate, EndDate,EmployeeID,EmpNo,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %s, %s, %n, %d, %d, %n,%s,%n)",
|
|
relative.ID, relative.Name, relative.Designation, relative.RelationID,
|
|
DataReader.GetNullValue(relative.JoiningDate),
|
|
DataReader.GetNullValue(relative.EndDate), relative.EmployeeID, DataReader.GetNullValue(relative.EmpNo),
|
|
relative.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpMembership membership)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpMembership(" +
|
|
" EmpMembershipID, Organization, Activity, FromDate, EndDate,EmployeeID,OrganizationType,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %s, %s, %d, %d, %n,%n,%n)",
|
|
membership.ID, membership.Organization, membership.Activity, membership.FromDate,
|
|
DataReader.GetNullValue(membership.EndDate), membership.EmployeeID,
|
|
membership.OrganizationType, membership.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpRelation relation)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpRelation(" +
|
|
" EmpRelationID, Name, Relation, Occupation,EmployeeID,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %s, %n, %n, %n,%n)",
|
|
relation.ID, relation.Name, relation.RelationID, relation.OccupationID, relation.EmployeeID,
|
|
relation.ProfileStatus);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, EmpHRQuestionAnswer questionAnswer)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpHRQuestionAnswer(" +
|
|
" EmpHRQuestionAnswerID, QuestionaryID, QuestionNo, QAnswer,EmployeeID,Question,ProfileStatus)" +
|
|
" VALUES(" +
|
|
" %n, %n, %s, %s, %n,%s,%n)",
|
|
questionAnswer.ID, questionAnswer.QuestionaryID, questionAnswer.QuestionNo, questionAnswer.QAnswer,
|
|
questionAnswer.EmployeeID,
|
|
questionAnswer.QuestionDes, questionAnswer.ProfileStatus);
|
|
}
|
|
|
|
//internal static void Insert(TransactionContext tc, EmpWorkPlanSetup item)
|
|
//{
|
|
// tc.ExecuteNonQuery(
|
|
// "INSERT INTO EmployeeWorkPlanSetup(EmployeeWorkPlanSetupID,EmployeeID, ShiftID, StartDate, WorkPlanGroupID, WeekEndOn, CreatedBy, CreatedDate,ProfileStatus)" +
|
|
// " VALUES(%n, %n, %n, %d, %n, %n, %n, %d)", item.ID, item.EmployeeID, item.ShiftID,
|
|
// DataReader.GetNullValue(item.StartDate), item.WorkPlanGroupID,
|
|
// item.WeekEndOn, item.CreatedBy, DataReader.GetNullValue(item.CreatedDate), item.ProfileStatus);
|
|
//}
|
|
|
|
public static void Insert(TransactionContext tc, Achievement achievement)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT ACHIEVEMENT (ACHIEVEMENTID, CODE, DESCRIPTION, SequenceNO, Status, CreatedBy, CreationDate, ModifiedBy, ModifiedDate, INACTIVEDATE) VALUES (%n, %s, %s, %n, %n, %n, %d, %n, %d, NULL)", achievement.ID, achievement.Code, achievement.Description, achievement.Sequence, achievement.Status, achievement.CreatedBy, achievement.CreatedDate, achievement.ModifiedBy, achievement.ModifiedDate, null);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, ExtraCurricularActivity extraCurricularActivity)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT ExtraCurricularActivity (EXTRACURRICULARACTIVITYID, CODE, DESCRIPTION, SequenceNO, Status, CreatedBy, CreationDate, ModifiedBy, ModifiedDate, INACTIVEDATE) VALUES (%n, %s, %s, %n, %n, %n, %d, %n, %d, NULL)", extraCurricularActivity.ID, extraCurricularActivity.Code, extraCurricularActivity.Description, extraCurricularActivity.Sequence, extraCurricularActivity.Status, extraCurricularActivity.CreatedBy, extraCurricularActivity.CreatedDate, extraCurricularActivity.ModifiedBy, extraCurricularActivity.ModifiedDate, null);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, Hobby hobby)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT Hobby (HOBBYID, CODE, DESCRIPTION, SequenceNO, Status, CreatedBy, CreationDate, ModifiedBy, ModifiedDate, INACTIVEDATE) VALUES (%n, %s, %s, %n, %n, %n, %d, %n, %d, NULL)", hobby.ID, hobby.Code, hobby.Description, hobby.Sequence, hobby.Status, hobby.CreatedBy, hobby.CreatedDate, hobby.ModifiedBy, hobby.ModifiedDate, null);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
public static void Insert(TransactionContext tc, OtherTalent otherTalent)
|
|
{
|
|
string sql = SQLParser.MakeSQL("INSERT OtherTalent (OTHERTALENTID, CODE, DESCRIPTION, SequenceNO, Status, CreatedBy, CreationDate, ModifiedBy, ModifiedDate, INACTIVEDATE) VALUES (%n, %s, %s, %n, %n, %n, %d, %n, %d, NULL)", otherTalent.ID, otherTalent.Code, otherTalent.Description, otherTalent.Sequence, otherTalent.Status, otherTalent.CreatedBy, otherTalent.CreatedDate, otherTalent.ModifiedBy, otherTalent.ModifiedDate, null);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
public static void Delete(TransactionContext tc, String tableName, string columnName, int empID)
|
|
{
|
|
string query = "Delete from " + tableName + " Where " + columnName + " = %n";
|
|
tc.ExecuteNonQuery(query, empID);
|
|
}
|
|
|
|
public static void DeleteChildData(TransactionContext tc, string tableName, string columnName, int id)
|
|
{
|
|
string sql = "Delete from " + tableName + " where " + columnName + " = %n";
|
|
tc.ExecuteNonQuery(sql, id);
|
|
}
|
|
|
|
public static void Delete(TransactionContext tc, int empID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM Employee", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Child's Get
|
|
|
|
#region EmpContact Get
|
|
|
|
public static IDataReader GetEmpContact(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpContact where EmployeeID = %n", empID);
|
|
}
|
|
|
|
public static IDataReader GetEmpContact(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpContact");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpSpouse Get
|
|
|
|
public static IDataReader GetEmpSpouse(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpSpouse where EmployeeID = %n ORDER BY SPOUSEID desc", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpChildren Get
|
|
|
|
public static IDataReader GetEmpChildrens(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpChildren where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpPublications Get
|
|
|
|
public static IDataReader GetEmpPublications(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpPublication where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpReferences Get
|
|
|
|
public static IDataReader GetEmpReferences(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpReference where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpExperiences Get
|
|
|
|
public static IDataReader GetEmpExperiences(TransactionContext tc, int empID)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"select [EMPLOYEEID], [EXPERIENCEID], [EMPLOYER], [CONTACTPERSON], [ADDRESS], [TELEPHONE], [EMPLOYERACTIVITY]
|
|
,[DESIGNATION], [JOBDESCRIPTION], [FROMDATE], [TODATE], [LASTJOB], [COUNTRYID], [Department], [JoiningDesignation]
|
|
,[EmailAddress], [ContactPersonMail],[ProfileStatus],
|
|
CONCAT(CAST(DATEDIFF(MONTH, [FROMDATE], ISNULL([TODATE], GETDATE())) / 12.0 AS DECIMAL(5,1)), ' Year(s)') AS TotalServiceYears,
|
|
iif(isnull(empfileuploadid, 0) > 0, 1, 0) HasAttachment
|
|
from empexperience ex
|
|
left join empfileupload eu on eu.empid = ex.employeeid and eu.referenceid = ex.experienceId and eu.fileType = 11 where ex.employeeid=%n order by [EXPERIENCEID] desc", empID);
|
|
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpTrainings Get
|
|
|
|
public static IDataReader GetEmpTrainings(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader(@"
|
|
SELECT [EMPTRAININGID]
|
|
,[EMPLOYEEID]
|
|
,[NAME]
|
|
,[DESCRIPTION]
|
|
,[COUNTRYID]
|
|
,[INSTITUTIONID]
|
|
,[TRAININGPLACE]
|
|
,[ACHIEVEMENT]
|
|
,[FEES]
|
|
,[OTHERCOST]
|
|
,[FROMDATE]
|
|
,[TODATE]
|
|
,[CONFIRMATIONDATE]
|
|
,[SPONSOREDTYPE]
|
|
,[NATUREOFTRAININGID]
|
|
,[TRAININGTYPEID]
|
|
,[TRAININGCOMPLETEDFROM]
|
|
,[TRAININGID]
|
|
,[TRAININGSCHEDULEID]
|
|
,[TRAININGMONTH]
|
|
,[TRAININGDAY]
|
|
,[TRAININGHOUR]
|
|
,[IsCertificateReceived]
|
|
,[CertificateAttachmentPath]
|
|
,[ProfileStatus]
|
|
, iif(isnull(empfileuploadid, 0) > 0, 1, 0) HasAttachment
|
|
from emptraining et
|
|
left join empfileupload eu on eu.empid = et.employeeid and
|
|
eu.referenceid = et.trainingid
|
|
and eu.fileType = 8
|
|
where et.employeeid = %n order by et.Emptrainingid desc", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpNominees Get
|
|
|
|
public static IDataReader GetEmpNominees(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader(@"SELECT [NOMINEEID]
|
|
,[NOMINATIONPURPOSEID]
|
|
,[NAME]
|
|
,[RELATIONID]
|
|
,[PERCENTAGE]
|
|
,[OCCUPATIONID]
|
|
,[ADDRESS]
|
|
,[PHOTOPATH]
|
|
,[TELEPHONE]
|
|
,[EMAILADDRESS]
|
|
,[SIGNATURE]
|
|
,[EMPLOYEEID]
|
|
,[NOMINEENAME]
|
|
,[NOMINEERELATION]
|
|
,[NOMINEEDOB]
|
|
,[NOMINEEOCCUPATION]
|
|
,[NOMINEEADDR]
|
|
,[PURPOSE]
|
|
,[NOMINEEPERCENT]
|
|
,[NOMINATIONDATE]
|
|
,[BIRTHDATE]
|
|
,[NOMINATIONENDDATE]
|
|
,[IsMinor]
|
|
,[NID]
|
|
,[NIDPath]
|
|
,iif(isnull(eu.empfileuploadid, 0) > 0, 1, 0) HasPicture
|
|
,iif(isnull(eu2.empfileuploadid, 0) > 0, 1, 0) HasSignature
|
|
from [EMPNOMINEE] en
|
|
left join empfileupload eu on eu.empid = en.employeeid and eu.referenceid = en.NOMINEEID and eu.fileType = 13
|
|
left join empfileupload eu2 on eu2.empid = en.employeeid and eu2.referenceid = en.NOMINEEID and eu2.fileType = 14
|
|
where en.employeeid=%n order by en.nomineeid desc", empID);
|
|
}
|
|
|
|
public static DataTable GetNomineesForEss(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"SELECT n.NOMINEEID, n.EMPLOYEEID, np.DESCRIPTION NominationPurpose, name, r.DESCRIPTION Relation, n.PERCENTAGE, n.ADDRESS,
|
|
n.TELEPHONE, n.emailAddress,
|
|
iif(isnull(eu.empfileuploadid, 0) > 0, 1, 0) HasPicture,
|
|
iif(isnull(eu2.empfileuploadid, 0) > 0, 1, 0) HasSignature
|
|
FROM EMPNOMINEE n
|
|
LEFT JOIN NOMINATIONPURPOSE np ON n.NOMINATIONPURPOSEID = np.NOMINATIONPURPOSEID
|
|
LEFT JOIN PERSONRELATION r ON n.RELATIONID = r.RELATIONID
|
|
LEFT JOIN empfileupload eu on eu.empid = n.employeeid and eu.referenceid = n.NOMINEEID and eu.fileType = 13
|
|
LEFT JOIN empfileupload eu2 on eu2.empid = n.employeeid and eu2.referenceid = n.NOMINEEID and eu2.fileType = 14
|
|
WHERE n.EMPLOYEEID = %n", employeeId);
|
|
return tc.ExecuteDataTable(sql);
|
|
}
|
|
|
|
public static DataTable GetTrainingForEss(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT tp.DESCRIPTION as TrainingType,nt.DESCRIPTION as NatureOfTraining,t.EMPTRAININGID, t.employeeId, t.NAME as Name, t.DESCRIPTION as Description, i.NAME as Institution, ISNULL(c.NAME,'') as CountryName, t.FEES as Fees, t.OTHERCOST as OtherCost, t.FROMDATE as FromDate, t.TODATE as ToDate,iif(isnull(eu.empfileuploadid, 0) > 0, 1, 0) HasAttachment FROM EMPTRAINING t left join INSTITUTION i ON i.INSTITUTIONID = t.INSTITUTIONID left join TRAININGTYPE tp on t.TRAININGTYPEID = tp.TRAININGTYPEID left join NATUREOFTRAINING nt on t.NATUREOFTRAININGID = nt.NATUREOFTRAININGID left join COUNTRY c on t.COUNTRYID = c.COUNTRYID left join empfileupload eu on eu.empid = t.employeeid and eu.REFERENCEID = t.EMPTRAININGID and eu.FILETYPE = 8 where t.employeeId = %n order by t.EMPTRAININGID desc", employeeId);
|
|
return tc.ExecuteDataTable(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpAcademics Get
|
|
|
|
public static IDataReader GetEmpAcademics(TransactionContext tc, int empID)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT [INSTITUTENAME]
|
|
,[EDUCATIONTYPEID]
|
|
,[ACADEMICID]
|
|
,[EMPLOYEEID]
|
|
,[EDUCATIONLEVELID]
|
|
,[EDUCATIONTYPEID]
|
|
,[DISCIPLINEID]
|
|
,[INSTITUTIONID]
|
|
,[PASSINGYEAR]
|
|
,[ExamHeldOn]
|
|
,[CLASSORDIVISION]
|
|
,[GPAORMARKS]
|
|
,[LASTLEVEL]
|
|
,[OUTOF]
|
|
,[RESULTTYPEID]
|
|
,[PHOTOPATH]
|
|
,[DOCSUBMISSIONDATE]
|
|
,[LastLevelNonTech]
|
|
,[ProfileStatus]
|
|
, iif(isnull(empfileuploadid, 0) > 0, 1, 0) HasAttachment
|
|
from[EMPACADEMIC] ea
|
|
left join empfileupload eu on eu.empid = ea.employeeid and
|
|
eu.referenceid = ea.ACADEMICID and eu.fileType = 10 where ea.employeeid = %n order by ea.ACADEMICID desc", empID);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static DataSet GetSelfServiceAcademic(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT e.employeeId AS EmployeeId, a.AcademicId, e.employeeNo AS EmployeeNo, e.name AS EmployeeName, a.institutename AS InstituteName,
|
|
(SELECT description FROM EDUCATIONTYPE WHERE a.EDUCATIONTYPEID = EDUCATIONTYPEID) AS EducationType,
|
|
(SELECT description FROM EDUCATIONLEVEL WHERE a.educationlevelId = educationlevelId) AS EducationLevel,
|
|
(SELECT description FROM DISCIPLINE WHERE a.disciplineId = disciplineId) AS Discipline,
|
|
(SELECT name FROM INSTITUTION WHERE a.institutionid=INSTITUTIONID) AS Institute,
|
|
a.passingYear AS PassingYear,
|
|
(SELECT DESCRIPTION FROM RESULTTYPE WHERE RESULTTYPEID=a.resulttypeid) AS ResultType, IIF(f.empfileuploadId is null, 0 , 1) hasAttachment
|
|
FROM EMPACADEMIC a
|
|
LEFT JOIN EMPLOYEE e ON a.EMPLOYEEID=e.EMPLOYEEID
|
|
Left Join empfileupload f on f.empid = a.EMPLOYEEID AND f.referenceid = a.ACADEMICID AND f.fileType=10
|
|
where a.employeeId = %n order by a.AcademicId desc", employeeId);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
|
|
internal static DataSet GetSelfServiceFamilyInfo(TransactionContext tc, int employeeId)
|
|
{
|
|
DataSet ds = new DataSet();
|
|
string sql = SQLParser.MakeSQL(@"SELECT e.employeeId, s.spouseId, e.employeeNo, e.Name AS 'EmployeeName', s.NAME AS 'SpouseName', ed.description AS 'EducationLevel', s.DateOfBirth, s.MarriageDate,
|
|
oc.DESCRIPTION AS 'Occupation', s.PASSPORTNO AS PassportNo, s.PASSPORTISSUEDATE AS 'PassportIssueDate', s.PASSPORTEXPDATE AS 'PassportExpDate',
|
|
s.NID, s.InsuranceId, s.InclusionDate
|
|
FROM EMPSPOUSE s LEFT JOIN EMPLOYEE e ON s.EMPLOYEEID=e.EMPLOYEEID
|
|
LEFT JOIN EDUCATIONLEVEL ed ON s.EDUCATIONLEVELID=ed.EDUCATIONLEVELID
|
|
LEFT JOIN OCCUPATION oc ON s.OCCUPATIONID=oc.OCCUPATIONID
|
|
where s.EMPLOYEEID = %n", employeeId);
|
|
DataTable temp1 = tc.ExecuteDataTable(sql);
|
|
temp1.TableName = "Spouse";
|
|
if (temp1 != null) ds.Tables.Add(temp1);
|
|
|
|
string sql2 = SQLParser.MakeSQL(@"SELECT e.employeeid AS EmployeeId, c.ChildId, e.employeeNo AS EmployeeNo, e.name AS EmployeeName, c.NAME,
|
|
(
|
|
CASE WHEN c.gender = 1 THEN 'Male'
|
|
WHEN c.gender = 2 THEN 'Female'
|
|
WHEN c.gender = 3 THEN 'Other'
|
|
ELSE ''
|
|
END
|
|
) 'Gender', c.BIRTHDATE AS BirthDate,
|
|
(
|
|
CASE WHEN c.MARITALSTATUS = 1 THEN 'Married'
|
|
WHEN c.MARITALSTATUS = 2 THEN 'Unmarried'
|
|
WHEN c.MARITALSTATUS = 3 THEN 'Divorced'
|
|
WHEN c.MARITALSTATUS = 4 THEN 'Widow'
|
|
ELSE ''
|
|
END
|
|
) 'MaritalStatus', (SELECT description FROM OCCUPATION WHERE OCCUPATIONID=c.occupationId)AS Occupation, c.passportNo AS PassportNo,
|
|
c.passportIssueDate AS PassportIssueDate, c.PassportExpDate AS PassportExpDate, c.nid,
|
|
(SELECT description FROM EDUCATIONLEVEL WHERE EDUCATIONLEVELID = c.educationLevelId) AS EducationLevel, c.InsuranceId, c.InclusionDate
|
|
FROM EMPCHILDREN c LEFT JOIN EMPLOYEE e ON c.employeeid = e.employeeId
|
|
where c.EMPLOYEEID = %n", employeeId);
|
|
DataTable temp2 = tc.ExecuteDataTable(sql2);
|
|
temp2.TableName = "Children";
|
|
if (temp2 != null) ds.Tables.Add(temp2);
|
|
return ds;
|
|
}
|
|
public static IDataReader GetEmpAcademic(TransactionContext tc, int academicID)
|
|
{
|
|
return tc.ExecuteReader("select * from EMPACADEMIC where ACADEMICID = %n", academicID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpAchievements Get
|
|
|
|
public static IDataReader GetEmpAchievements(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("select DISTINCT AE.EMPLOYEEID,AE.EMPACHIVEMENTID as 'EmpAchivementID',A.ACHIEVEMENTID as 'AchivementID',AE.ProfileStatus,A.DESCRIPTION as 'AchievementTitle' from ACHIEVEMENT as A join EMPACHIVEMENT as AE on A.ACHIEVEMENTID = AE.ACHIVEMENTID where AE.EMPLOYEEID = %n order by A.ACHIEVEMENTID desc", empID);
|
|
//return tc.ExecuteReader("SELECT * FROM EmpAchivement where EmployeeID = %n", empID);
|
|
}
|
|
|
|
internal static DataSet GetSelfAchievement(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"select DISTINCT A.ACHIEVEMENTID,A.DESCRIPTION as 'AchievementTitle' from ACHIEVEMENT as A join EMPACHIVEMENT as AE on A.ACHIEVEMENTID = AE.ACHIVEMENTID where AE.EMPLOYEEID = %n order by A.ACHIEVEMENTID desc", employeeId);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpCurricularActivity Get
|
|
|
|
public static IDataReader GetEmpCurricularActivities(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("select DISTINCT EE.EMPLOYEEID,EE.EMPEXTRACURRICULARACTIVITYID as 'EmpExtraCurricularActivityID',EE.ProfileStatus,E.EXTRACURRICULARACTIVITYID as 'ExtraCurricularActivityID',E.DESCRIPTION as 'ExtraCurricularTitle' from EXTRACURRICULARACTIVITY as E join EMPEXTRACURRICULARACTIVITY as EE on E.EXTRACURRICULARACTIVITYID= EE.EXTRACURRICULARACTIVITYID where EE.EMPLOYEEID = %n order by E.EXTRACURRICULARACTIVITYID desc", empID);
|
|
//return tc.ExecuteReader("SELECT * FROM EmpExtraCurricularActivity where EmployeeID = %n", empID);
|
|
}
|
|
internal static DataSet GetSelfCurricularActivity(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"select DISTINCT E.EXTRACURRICULARACTIVITYID,E.DESCRIPTION as 'ExtraCurricularTitle' from EXTRACURRICULARACTIVITY as E join EMPEXTRACURRICULARACTIVITY as EE on E.EXTRACURRICULARACTIVITYID= EE.EMPEXTRACURRICULARACTIVITYID where EE.EMPLOYEEID = %n order by E.EXTRACURRICULARACTIVITYID desc", employeeId);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpOtherTalent Get
|
|
|
|
public static IDataReader GetEmpOtherTalents(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("select DISTINCT EOT.EMPLOYEEID as 'EmployeeID',EOT.EMPOTHERTALENTID as 'EmpOtherTalentID',EOT.ProfileStatus,OT.OTHERTALENTID as 'OtherTalentID',OT.DESCRIPTION as 'OtherTalentsTitle' from OTHERTALENT as OT join EMPOTHERTALENT as EOT on OT.OTHERTALENTID= EOT.OTHERTALENTID where EOT.EMPLOYEEID = %n order by OT.OTHERTALENTID desc", empID);
|
|
//return tc.ExecuteReader("SELECT * FROM EmpOtherTalent where EmployeeID = %n", empID);
|
|
}
|
|
internal static DataSet GetSelfOtherTalents(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"select DISTINCT OT.OTHERTALENTID,OT.DESCRIPTION as 'OtherTalentsTitle' from OTHERTALENT as OT join EMPOTHERTALENT as EOT on OT.OTHERTALENTID= EOT.OTHERTALENTID where EOT.EMPLOYEEID = %n order by OT.OTHERTALENTID desc", employeeId);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpHobby Get
|
|
|
|
public static IDataReader GetEmployeeHobbys(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("select DISTINCT EH.EMPLOYEEID as 'EmployeeID',EH.EMPHOBBYID as 'EmpHobbyID',EH.ProfileStatus,H.HOBBYID as 'HobbyID', H.DESCRIPTION as 'HobbyTitle' from HOBBY as H join EMPHOBBY as EH on H.HOBBYID = EH.HOBBYID where EH.EMPLOYEEID = %n order by H.HOBBYID desc", empID);
|
|
//return tc.ExecuteReader("SELECT * FROM EmpHobby where EmployeeID = %n", empID);
|
|
}
|
|
internal static DataSet GetSelfHobbys(TransactionContext tc, int employeeId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"select DISTINCT H.HOBBYID, H.DESCRIPTION as 'HobbyTitle' from HOBBY as H join EMPHOBBY as EH on H.HOBBYID = EH.HOBBYID where EH.EMPLOYEEID = %n order by H.HOBBYID desc", employeeId);
|
|
return tc.ExecuteDataSet(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpAllergie Get
|
|
|
|
public static IDataReader GetEmpAllergies(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpAllergy where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpHospitalization Get
|
|
|
|
public static IDataReader GetEmpHospitalizations(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpHospitalization where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpGuarantors Get
|
|
|
|
public static IDataReader GetEmpGuarantors(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpGuarantor where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpLanguages Get
|
|
|
|
public static IDataReader GetEmpLanguages(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpLanguage where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpRelative Get
|
|
|
|
public static IDataReader GetEmpRelatives(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpRelative where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpMembership Get
|
|
|
|
public static IDataReader GetEmpMemberships(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpMembership where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpRelation Get
|
|
|
|
public static IDataReader GetEmpRelations(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpRelation where EmployeeID = %n", empID);
|
|
}
|
|
|
|
public static IDataReader GetAllEmpRelations(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpRelation");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpHRQuestionAnswer Get
|
|
|
|
public static IDataReader GetEmpHRQuestionAnswers(TransactionContext tc, int empID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpHRQuestionAnswer where EmployeeID = %n", empID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmpCreditCard
|
|
|
|
internal static IDataReader GetEmpCreditCard(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM EmpCreditCard WHERE UserTypeID=%n", id);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
internal static void UpdateUserGroup(TransactionContext tc, HREmployee item)
|
|
{
|
|
}
|
|
|
|
internal static IDataReader GetEmployee(TransactionContext tc, string employeeNo, int payrolltypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Employee WHERE EmployeeNo=%s AND PAYROLLTYPEID = %n", employeeNo,
|
|
payrolltypeid);
|
|
}
|
|
|
|
|
|
internal static void Insert(TransactionContext tc, EmpCreditCard item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO EmpCreditCard(" +
|
|
" EmpCreditCardID,EmployeeID, UserType, UserTypeID, CardNo, CardName,BankID,CardLimit," +
|
|
" CardExpiryDate,TIN)" +
|
|
" VALUES(" +
|
|
" %n,%n,%n,%n, %s, %s,%n,%n, %d,%s)",
|
|
item.ID, item.EmployeeID, (int)item.UserType, item.UserTypeID, item.CardNo,
|
|
DataReader.GetNullValue(item.CardName), item.BankID, item.CardLimit, item.CardExpiryDate,
|
|
DataReader.GetNullValue(item.TIN));
|
|
}
|
|
|
|
internal static DataSet GetMaritalStats(TransactionContext tc)
|
|
{
|
|
DataSet ds = new DataSet();
|
|
ds = tc.ExecuteDataSet(
|
|
"SELECT MARITALSTATUSID, count(MARITALSTATUSID) As MaritalStatusCount FROM EMPLOYEE GROUP by MARITALSTATUSID");
|
|
return ds;
|
|
}
|
|
|
|
internal static DataTable GetChildrenCount(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteDataTable(
|
|
"SELECT Number_of_child, count(*) AS total_employees FROM (SELECT count(*) AS Number_of_child, EMPLOYEEID FROM EMPCHILDREN GROUP BY EMPLOYEEID) AS Count_Table GROUP BY Number_of_child;");
|
|
}
|
|
|
|
internal static DataTable GetAcademicStat(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteDataTable(
|
|
"SELECT t.Total, e.Description, e.code FROM (SELECT count(*) AS Total, EDUCATIONLEVELID FROM EMPACADEMIC GROUP BY EDUCATIONLEVELID) AS t JOIN EDUCATIONLEVEL e ON t.EDUCATIONLEVELID = e.EDUCATIONLEVELID");
|
|
}
|
|
|
|
/*internal static int GetMaritalStatsWhenMarried(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar("SELECT count(MARITALSTATUSID) FROM EMPLOYEE WHERE MARITALSTATUSID=1;");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
internal static int GetMaritalStatsWhenUnMarried(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar("SELECT count(MARITALSTATUSID) FROM EMPLOYEE WHERE MARITALSTATUSID=2;");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
internal static int GetMaritalStatsWhenDivorced(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar("SELECT count(MARITALSTATUSID) FROM EMPLOYEE WHERE MARITALSTATUSID=3;");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
internal static int GetMaritalStatsWhenWidow(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar("SELECT count(MARITALSTATUSID) FROM EMPLOYEE WHERE MARITALSTATUSID=4;");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}*/
|
|
|
|
internal static int GetEmployeeMaleAgeStat18_25(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=18 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=25 AND GENDER=1");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
|
|
internal static int GetEmployeeMaleAgeStat26_35(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=26 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=35 AND GENDER=1");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeMaleAgeStat36_45(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=36 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=45 AND GENDER=1");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeMaleAgeStat46_55(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=46 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=55 AND GENDER=1");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeMaleAgeStat56_(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=56 AND GENDER=1");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeFemaleAgeStat18_25(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=18 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=25 AND GENDER=2");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeFemaleAgeStat26_35(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=26 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=35 AND GENDER=2");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeFemaleAgeStat36_45(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=36 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=45 AND GENDER=2");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeFemaleAgeStat46_55(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=46 AND DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 <=55 AND GENDER=2");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetEmployeeFemaleAgeStat56_(TransactionContext tc)
|
|
{
|
|
var count = tc.ExecuteScalar(
|
|
"SELECT count(*) FROM Employee WHERE DATEDIFF(DAY, BIRTHDATE, GetDate()) / 365.25 >=56 AND GENDER=2");
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static int GetProfileCompletePercentage(TransactionContext tc, int empId)
|
|
{
|
|
var count = tc.ExecuteScalar("SELECT ProfileComplitionPercent FROM EMPLOYEE WHERE EMPLOYEEID = %n", empId);
|
|
return count is DBNull ? 0 : Convert.ToInt32(count);
|
|
}
|
|
|
|
internal static IDataReader getUloadedFile(TransactionContext tc, int empId, int referenceID, enumEmpFileUploadType type)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM empFileupload WHERE empid = %n and referenceid=%n and fileType=%n ",
|
|
empId, referenceID, type);
|
|
}
|
|
internal static IDataReader GetUploadedFileInProfileRequest(TransactionContext tc, int empId, int referenceID, enumEmpFileUploadType type)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM empFileuploadUpdateRequest WHERE empid = %n and referenceid=%n and fileType=%n ",
|
|
empId, referenceID, type);
|
|
}
|
|
internal static IDataReader GetAllAttachmentsById(TransactionContext tc, int empId)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM empFileupload WHERE empid = %n", empId);
|
|
}
|
|
internal static IDataReader GetAllAttachmentsByType(TransactionContext tc, int empId, int refId, int type)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM empFileupload WHERE empid=%n and referenceid=%n and fileType=%n", empId, refId, (int)type);
|
|
}
|
|
|
|
|
|
public static void uplaodFile(TransactionContext tc, empFileupload item)
|
|
{
|
|
|
|
tc.ExecuteNonQuery(@"delete from empFileupload where empid =%n and referenceid =%n and fileType =%n", item.employeeID, item.referenceID, item.filetype);
|
|
//tc.ExecuteNonQuery("SET IDENTITY_INSERT empFileupload ON;");
|
|
string strQuery = @"insert into empFileupload(empid, referenceid, fileType, fileData, fileName)
|
|
values (@empid, @referenceid, @fileType, @fileData, @fileName)";
|
|
|
|
SqlCommand cmd = new SqlCommand(strQuery, (SqlConnection)tc.Connection);
|
|
|
|
// Required whenever the context was opened with a transaction, and harmless (null)
|
|
// when it was not: ADO.NET refuses a command on a connection that has a pending
|
|
// local transaction unless the command is enlisted in it. Every other raw-command
|
|
// DA in the codebase does the same.
|
|
cmd.Transaction = (SqlTransaction)tc.Transaction;
|
|
|
|
//cmd.Parameters.Add("@empFileuploadID", SqlDbType.Int).Value = item.ID;
|
|
cmd.Parameters.Add("@empid", SqlDbType.Int).Value = item.employeeID;
|
|
cmd.Parameters.Add("@referenceid", SqlDbType.Int).Value = item.referenceID;
|
|
cmd.Parameters.Add("@fileType", SqlDbType.Int).Value = item.filetype;
|
|
cmd.Parameters.Add("@fileData", SqlDbType.Binary).Value = item.fileData;
|
|
cmd.Parameters.Add("@fileName", SqlDbType.VarChar).Value = item.fileName;
|
|
//cmd.Parameters.Add("@createdBy", SqlDbType.VarChar).Value = item.CreatedBy;
|
|
//cmd.Parameters.Add("@createdDate", SqlDbType.Binary).Value = item.CreatedDate;
|
|
|
|
//SqlConnection con = new SqlConnection(tc.Connection.ConnectionString);
|
|
//cmd.CommandType = CommandType.Text;
|
|
//cmd.Connection = con;
|
|
cmd.ExecuteNonQuery();
|
|
// tc.ExecuteNonQuery("SET IDENTITY_INSERT empFileupload OFF;");
|
|
//try
|
|
//{
|
|
// tc.ExecuteNonQuery(CommandType.Text, strQuery, cmd.Parameters);
|
|
//con.Open();
|
|
//cmd.ExecuteNonQuery();
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// throw new Exception(ex.Message);
|
|
//}
|
|
|
|
//finally
|
|
|
|
//{
|
|
|
|
// con.Close();
|
|
|
|
// con.Dispose();
|
|
|
|
//}
|
|
}
|
|
public static void UploadFileInProfileUpdate(TransactionContext tc, empFileupload item)
|
|
{
|
|
tc.ExecuteNonQuery(@"delete from empFileuploadUpdateRequest where empid =%n and referenceid =%n and fileType =%n ", item.employeeID, item.referenceID, item.filetype);
|
|
|
|
string strQuery = @"insert into empFileuploadUpdateRequest( empid, referenceid, fileType, fileData, fileName, fileFormat)
|
|
values (@empid, @referenceid, @fileType, @fileData, @fileName, @fileFormat)";
|
|
|
|
SqlCommand cmd = new SqlCommand(strQuery, (SqlConnection)tc.Connection);
|
|
|
|
cmd.Parameters.Add("@empid", SqlDbType.Int).Value = item.employeeID;
|
|
//cmd.Parameters.Add("@referenceid", SqlDbType.Int).Value = item.referenceID.HasValue ? item.referenceID.Value : (object)DBNull.Value;
|
|
cmd.Parameters.Add("@referenceid", SqlDbType.Int).Value = item.referenceID;
|
|
cmd.Parameters.Add("@fileType", SqlDbType.Int).Value = item.filetype;
|
|
cmd.Parameters.Add("@fileData", SqlDbType.Binary).Value = item.fileData;
|
|
cmd.Parameters.Add("@fileName", SqlDbType.VarChar).Value = item.fileName;
|
|
cmd.Parameters.Add("@fileFormat", SqlDbType.Int).Value = item.FileFormat;
|
|
|
|
cmd.ExecuteNonQuery();
|
|
}
|
|
|
|
public static void DeletePictureInProfileUpdate(TransactionContext tc, empFileupload item)
|
|
{
|
|
tc.ExecuteNonQuery(@"delete from empFileuploadUpdateRequest where EMPFILEUPLOADUPDATEREQID =%n ", item.ID);
|
|
//tc.ExecuteNonQuery(@"delete from empFileuploadUpdateRequest where empid =%n and referenceid =%n and fileType =%n ", item.employeeID, item.referenceID, item.filetype);
|
|
|
|
}
|
|
|
|
internal static void UpdateEmail(TransactionContext tc, HREmployee item)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE EMPLOYEE SET EMAILADDRESS=%s WHERE EMPLOYEEID=%n", item.EmailAddress, item.ID);
|
|
}
|
|
|
|
internal static void UpdateMobile(TransactionContext tc, HREmployee item)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE EMPLOYEE SET MOBILENO=%s WHERE EMPLOYEEID=%n", item.MobileNo, item.ID);
|
|
}
|
|
|
|
internal static void UpdateBloodgroup(TransactionContext tc, HREmployee item)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE EMPLOYEE SET BLOODGROUP=%n WHERE EMPLOYEEID=%n", (int)item.BloodGroup, item.ID);
|
|
}
|
|
|
|
internal static void UpdateNationalID(TransactionContext tc, HREmployee item)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE EMPLOYEE SET NATIONALID=%s WHERE EMPLOYEEID=%n", item.NationalID, item.ID);
|
|
}
|
|
|
|
internal static void UpdateTin(TransactionContext tc, HREmployee item)
|
|
{
|
|
tc.ExecuteNonQuery(@"UPDATE EMPLOYEE SET TINNO=%s WHERE EMPLOYEEID=%n", item.TinNo, item.ID);
|
|
}
|
|
|
|
public static IDataReader GetPurposePercentage(TransactionContext tc, EmpNominee nominee)
|
|
{
|
|
string sSQL = SQLParser.MakeSQL("select COALESCE(SUM(PERCENTAGE),0) as PurposePercentage from EMPNOMINEE where EMPLOYEEID = %n and NOMINATIONPURPOSEID = %n", nominee.EmployeeID, nominee.NominationPurposeID);
|
|
|
|
return tc.ExecuteReader(sSQL);
|
|
}
|
|
|
|
internal static DataSet SearchOtherQualificationEmp(TransactionContext tc, string EmpIds, int QualificationTypeId, string item)
|
|
{
|
|
string baseSql = "";
|
|
string subSql = string.Empty;
|
|
|
|
// Add filters based on provided parameters
|
|
if (!string.IsNullOrWhiteSpace(EmpIds))
|
|
{
|
|
subSql = SQLParser.MakeSQL("E.EMPLOYEEID IN (%q)", EmpIds);
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(item))
|
|
{
|
|
subSql = string.IsNullOrEmpty(subSql)
|
|
? SQLParser.MakeSQL("Description = '%q'", item)
|
|
: subSql + SQLParser.MakeSQL(" AND Description = '%q'", item);
|
|
}
|
|
|
|
switch (QualificationTypeId)
|
|
{
|
|
case 1:
|
|
baseSql = "SELECT EA.EMPLOYEEID, E.EMPLOYEENO, E.NAME, A.DESCRIPTION AS 'Description',E.STATUS FROM EMPACHIVEMENT EA JOIN Employee E ON EA.EMPLOYEEID = E.EMPLOYEEID JOIN ACHIEVEMENT A ON EA.ACHIVEMENTID = A.ACHIEVEMENTID %q";
|
|
break;
|
|
case 2:
|
|
baseSql = "SELECT EECA.EMPLOYEEID, E.EMPLOYEENO, E.NAME, ECA.DESCRIPTION AS 'Description',E.STATUS FROM EMPEXTRACURRICULARACTIVITY EECA JOIN Employee E ON EECA.EMPLOYEEID = E.EMPLOYEEID JOIN EXTRACURRICULARACTIVITY ECA ON EECA.EXTRACURRICULARACTIVITYID = ECA.EXTRACURRICULARACTIVITYID %q";
|
|
break;
|
|
case 3:
|
|
baseSql = "SELECT EH.EMPLOYEEID, E.EMPLOYEENO, E.NAME, H.DESCRIPTION AS 'Description',E.STATUS FROM EMPHOBBY EH JOIN Employee E ON EH.EMPLOYEEID = E.EMPLOYEEID JOIN HOBBY H ON EH.HOBBYID = H.HOBBYID %q";
|
|
break;
|
|
case 4:
|
|
baseSql = "SELECT EOT.EMPLOYEEID, E.EMPLOYEENO, E.NAME, OT.DESCRIPTION AS 'Description',E.STATUS FROM EMPOTHERTALENT EOT JOIN Employee E ON EOT.EMPLOYEEID = E.EMPLOYEEID JOIN OTHERTALENT OT ON EOT.OTHERTALENTID = OT.OTHERTALENTID %q";
|
|
break;
|
|
default:
|
|
throw new ArgumentException("Invalid QualificationTypeId.");
|
|
}
|
|
|
|
// Combine the base SQL query with the subquery
|
|
string finalSql = SQLParser.MakeSQL(baseSql, !string.IsNullOrEmpty(subSql) ? "WHERE " + subSql : "");
|
|
|
|
|
|
return tc.ExecuteDataSet(finalSql);
|
|
}
|
|
}
|
|
} |