public static int InsertLeaveApplication(StaffPayRoll StaffPayrollObj) { try { return(StaffPayrollDataAccess.GetInstance.InsertStaffPayRoll(StaffPayrollObj)); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public int InsertStaffPayRoll(StaffPayRoll Payroll) { try { int ReturnValue = 0; SqlCommand SqlCmd = new SqlCommand(); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; SqlCmd.Parameters.Add(GetParameter("@BillNo", SqlDbType.Int, Payroll.BillNo)); SqlCmd.Parameters.Add(GetParameter("@TvNo", SqlDbType.Int, Payroll.TvNo)); SqlCmd.Parameters.Add(GetParameter("@SessionID", SqlDbType.Int, Payroll.SessionID)); SqlCmd.Parameters.Add(GetParameter("@Month", SqlDbType.VarChar, Payroll.Month)); SqlCmd.Parameters.Add(GetParameter("@Year", SqlDbType.VarChar, Payroll.Year)); SqlCmd.Parameters.Add(GetParameter("@BillDDate", SqlDbType.DateTime, Payroll.BillDate)); SqlCmd.Parameters.Add(GetParameter("@EmployeeID", SqlDbType.Int, Payroll.EmployeeID)); SqlCmd.Parameters.Add(GetParameter("@GrossPay", SqlDbType.Decimal, Payroll.GrossPay)); SqlCmd.Parameters.Add(GetParameter("@TotalWorkingDays", SqlDbType.Int, Payroll.TotalWorkingDays)); SqlCmd.Parameters.Add(GetParameter("@TotalPresentWorkingDays", SqlDbType.Int, Payroll.PresentDay)); SqlCmd.Parameters.Add(GetParameter("@BankLoanEMI", SqlDbType.Decimal, Payroll.BankLoanEMI)); SqlCmd.Parameters.Add(GetParameter("@FixedDeduction", SqlDbType.Decimal, Payroll.FixedDeduction)); SqlCmd.Parameters.Add(GetParameter("@OtherDeduction", SqlDbType.Decimal, Payroll.OtherDeduction)); SqlCmd.Parameters.Add(GetParameter("@PresentDay", SqlDbType.Int, Payroll.PresentDay)); SqlCmd.Parameters.Add(GetParameter("@NetPayable", SqlDbType.Decimal, Payroll.NetPayable)); SqlCmd.Parameters.Add(GetParameter("@BankLoanEMI", SqlDbType.Decimal, Payroll.BankLoanEMI)); SqlCmd.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); SqlCmd.Parameters.Add(GetParameter("@CompanyID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); SqlCmd.CommandText = "pHRM_PayRollDetails_Insert"; ExecuteStoredProcedure(SqlCmd); ReturnValue = int.Parse(SqlCmd.Parameters[0].Value.ToString()); return(ReturnValue); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
/// <summary> /// Convert DataTable Into List<LeaveApplications> /// </summary> public static List <StaffPayRoll> SetLeaveApplicationList(DataTable DT) { try { List <StaffPayRoll> StaffPayrollList = new List <StaffPayRoll>(); foreach (DataRow DtRow in DT.Rows) { StaffPayRoll ObjStaffPAyRoll = new StaffPayRoll(); ObjStaffPAyRoll.Year = DtRow["Year"].ToString(); ObjStaffPAyRoll.TvNo = int.Parse(DtRow["TvNo"].ToString()); ObjStaffPAyRoll.TotalWorkingDays = int.Parse(DtRow["TotalWorkingDays"].ToString()); ObjStaffPAyRoll.TotalPresentWorkingDays = int.Parse(DtRow["TotalPresentWorkingDays"].ToString()); ObjStaffPAyRoll.SessionID = int.Parse(DtRow["SessionID"].ToString()); ObjStaffPAyRoll.PresentDay = int.Parse(DtRow["PresentDay"].ToString()); ObjStaffPAyRoll.OtherDeduction = decimal.Parse(DtRow["LeaveTypeDescription"].ToString()); ObjStaffPAyRoll.NetPayable = decimal.Parse(DtRow["LeaveTypeAlias"].ToString()); ObjStaffPAyRoll.Month = DtRow["DateFrom"].ToString(); ObjStaffPAyRoll.GrossPay = decimal.Parse(DtRow["DateTo"].ToString()); ObjStaffPAyRoll.FixedDeduction = decimal.Parse(DtRow["LeaveApplicationReason"].ToString()); ObjStaffPAyRoll.EmployeeID = int.Parse(DtRow["TotalPresentWorkingDays"].ToString()); ObjStaffPAyRoll.BillNo = int.Parse(DtRow["TotalPresentWorkingDays"].ToString()); ObjStaffPAyRoll.BillDate = DateTime.Parse(DtRow["DateAdded"].ToString()); ObjStaffPAyRoll.BankLoanEMI = decimal.Parse(DtRow["BankLoanEMI"].ToString()); ObjStaffPAyRoll.IsActive = Boolean.Parse(DtRow["IsActive"].ToString()); ObjStaffPAyRoll.IsDeleted = Boolean.Parse(DtRow["IsDeleted"].ToString()); StaffPayrollList.Add(ObjStaffPAyRoll); } return(StaffPayrollList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }