protected void btnApprove_Click(object sender, EventArgs e) { DatabaseTransaction.OpenConnectionTransation(); foreach (GridViewRow gvrow in gvtemp.Rows) { PaySlipBl objPaySlipBl = new PaySlipBl(); PaySlipBo objPaySlipBo = new PaySlipBo(); ApplicationResult objResultsUpdatePaySlip = new ApplicationResult(); objPaySlipBo.Month = Convert.ToInt32(ddlMonth.SelectedValue); objPaySlipBo.Year = Convert.ToInt32(ddlYear.SelectedValue); if (((CheckBox)gvrow.FindControl("chkChild")).Checked == true) { int id = Convert.ToInt32(gvrow.Cells[1].Text); objPaySlipBo.UserID = id; objPaySlipBo.PayslipApproved = 1; objPaySlipBo.PaySlipSendforApproval = 1; objPaySlipBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objPaySlipBo.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objResultsUpdatePaySlip = objPaySlipBl.PaySlip_Update_SelectedPart(objPaySlipBo); } } if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Approved SuccessFully');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Not Approved SuccessFully');", true); } DatabaseTransaction.CommitTransation(); GeneratePayRoll(); }
/// <summary> /// To Update details of PaySlip in tbl_Payslip_M table /// Created By : NafisaMMulla, 17-04-2015 /// Modified By : /// </summary> /// <param name="objPaySlipBO"></param> /// <returns></returns> public ApplicationResult PaySlip_Update_SelectedPart(PaySlipBo objPaySlipBO) { try { pSqlParameter = new SqlParameter[7]; pSqlParameter[0] = new SqlParameter("@EmployeeMID", SqlDbType.Int); pSqlParameter[0].Direction = ParameterDirection.Input; pSqlParameter[0].Value = objPaySlipBO.UserID; pSqlParameter[1] = new SqlParameter("@PaySlipSendforApproval", SqlDbType.Int); pSqlParameter[1].Direction = ParameterDirection.Input; pSqlParameter[1].Value = objPaySlipBO.PaySlipSendforApproval; pSqlParameter[2] = new SqlParameter("@PayslipApproved", SqlDbType.Int); pSqlParameter[2].Direction = ParameterDirection.Input; pSqlParameter[2].Value = objPaySlipBO.PayslipApproved; pSqlParameter[3] = new SqlParameter("@LastModifiedUserID", SqlDbType.Int); pSqlParameter[3].Direction = ParameterDirection.Input; pSqlParameter[3].Value = objPaySlipBO.LastModifiedUserID; pSqlParameter[4] = new SqlParameter("@LastModifiedDate", SqlDbType.VarChar); pSqlParameter[4].Direction = ParameterDirection.Input; pSqlParameter[4].Value = objPaySlipBO.LastModifiedDate; pSqlParameter[5] = new SqlParameter("@Month", SqlDbType.Int); pSqlParameter[5].Direction = ParameterDirection.Input; pSqlParameter[5].Value = objPaySlipBO.Month; pSqlParameter[6] = new SqlParameter("@Year", SqlDbType.Int); pSqlParameter[6].Direction = ParameterDirection.Input; pSqlParameter[6].Value = objPaySlipBO.Year; sSql = "usp_tbl_PaySlip_M_Update_SelectedPart"; int iResult = DatabaseTransaction.ExecuteNonQuery(CommandType.StoredProcedure, sSql, pSqlParameter); if (iResult > 0) { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.SUCCESS; return(objResults); } else { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.FAILURE; return(objResults); } } catch (Exception ex) { throw ex; } finally { objPaySlipBO = null; } }
/// <summary> /// To Update details of PaySlip in tbl_Payslip_M table /// Created By : NafisaMulla, 17-04-2015 /// Modified By : /// </summary> /// <param name="objPaySlipBO"></param> /// <returns></returns> public ApplicationResult PaySlip_Update(PaySlipBo objPaySlipBO) { try { pSqlParameter = new SqlParameter[15]; pSqlParameter[0] = new SqlParameter("@PayslipID", SqlDbType.Int); pSqlParameter[0].Direction = ParameterDirection.Input; pSqlParameter[0].Value = objPaySlipBO.PayslipID; pSqlParameter[1] = new SqlParameter("@TrustMID", SqlDbType.Int); pSqlParameter[1].Direction = ParameterDirection.Input; pSqlParameter[1].Value = objPaySlipBO.TrustMID; pSqlParameter[2] = new SqlParameter("@UserID", SqlDbType.Int); pSqlParameter[2].Direction = ParameterDirection.Input; pSqlParameter[2].Value = objPaySlipBO.UserID; pSqlParameter[3] = new SqlParameter("@Month", SqlDbType.Int); pSqlParameter[3].Direction = ParameterDirection.Input; pSqlParameter[3].Value = objPaySlipBO.Month; pSqlParameter[4] = new SqlParameter("@Year", SqlDbType.Int); pSqlParameter[4].Direction = ParameterDirection.Input; pSqlParameter[4].Value = objPaySlipBO.Year; pSqlParameter[5] = new SqlParameter("@TotalDaysofMonth", SqlDbType.Int); pSqlParameter[5].Direction = ParameterDirection.Input; pSqlParameter[5].Value = objPaySlipBO.TotalDaysofMonth; pSqlParameter[6] = new SqlParameter("@EarnedDaysofMonth", SqlDbType.Float); pSqlParameter[6].Direction = ParameterDirection.Input; pSqlParameter[6].Value = objPaySlipBO.EarnedDaysofMonth; pSqlParameter[7] = new SqlParameter("@PaySlipSendforApproval", SqlDbType.Int); pSqlParameter[7].Direction = ParameterDirection.Input; pSqlParameter[7].Value = objPaySlipBO.PaySlipSendforApproval; pSqlParameter[8] = new SqlParameter("@PayslipApproved", SqlDbType.Int); pSqlParameter[8].Direction = ParameterDirection.Input; pSqlParameter[8].Value = objPaySlipBO.PayslipApproved; pSqlParameter[9] = new SqlParameter("@Excemption", SqlDbType.Int); pSqlParameter[9].Direction = ParameterDirection.Input; pSqlParameter[9].Value = objPaySlipBO.Excemption; pSqlParameter[10] = new SqlParameter("@IsDeleted", SqlDbType.Int); pSqlParameter[10].Direction = ParameterDirection.Input; pSqlParameter[10].Value = objPaySlipBO.IsDeleted; pSqlParameter[11] = new SqlParameter("@CreatedUserID", SqlDbType.Int); pSqlParameter[11].Direction = ParameterDirection.Input; pSqlParameter[11].Value = objPaySlipBO.CreatedUserID; pSqlParameter[12] = new SqlParameter("@CreatedDate", SqlDbType.VarChar); pSqlParameter[12].Direction = ParameterDirection.Input; pSqlParameter[12].Value = objPaySlipBO.CreatedDate; pSqlParameter[13] = new SqlParameter("@LastModifiedUserID", SqlDbType.Int); pSqlParameter[13].Direction = ParameterDirection.Input; pSqlParameter[13].Value = objPaySlipBO.LastModifiedUserID; pSqlParameter[14] = new SqlParameter("@LastModifiedDate", SqlDbType.VarChar); pSqlParameter[14].Direction = ParameterDirection.Input; pSqlParameter[14].Value = objPaySlipBO.LastModifiedDate; sSql = "usp_tbl_Payslip_M_Update"; int iResult = Database.ExecuteNonQuery(CommandType.StoredProcedure, sSql, pSqlParameter); if (iResult > 0) { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.SUCCESS; return(objResults); } else { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.FAILURE; return(objResults); } } catch (Exception ex) { throw ex; } finally { objPaySlipBO = null; } }