Int64 IHREmployeeLeaveApplicationDataAccess.Add(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Add(hREmployeeLeaveApplicationEntity, option); break; } case TransactionRequired.Yes: { retValues = AddTran(hREmployeeLeaveApplicationEntity, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
private Int64 AddTran(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeLeaveApplication_SET"; Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option, db); AddOutputParameter(cmd, db); AddNullPrimaryKeyParameter(cmd, "EmployeeLeaveApplicationID", db); db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeLeaveApplicationEntity.EmployeeID); db.AddInParameter(cmd, "@ApplicationDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.ApplicationDate); db.AddInParameter(cmd, "@RequestStartDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.RequestStartDate); db.AddInParameter(cmd, "@RequestEndDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.RequestEndDate); db.AddInParameter(cmd, "@TotalLeaveDays", DbType.Decimal, hREmployeeLeaveApplicationEntity.TotalLeaveDays); db.AddInParameter(cmd, "@Description", DbType.String, hREmployeeLeaveApplicationEntity.Description); db.AddInParameter(cmd, "@BackupEmployeeID", DbType.Int64, hREmployeeLeaveApplicationEntity.BackupEmployeeID); db.AddInParameter(cmd, "@LeaveApplicationApplicationStatusID", DbType.Int64, hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID); db.AddInParameter(cmd, "@LeaveCategoryID", DbType.Int64, hREmployeeLeaveApplicationEntity.LeaveCategoryID); db.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeeLeaveApplicationEntity.SalarySessionID); db.AddInParameter(cmd, "@LeaveLocation", DbType.String, hREmployeeLeaveApplicationEntity.LeaveLocation); db.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hREmployeeLeaveApplicationEntity.FiscalYearID); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { returnCode = db.ExecuteNonQuery(cmd, transaction); returnCode = GetReturnCodeFromParameter(cmd, db); if (returnCode > 0) { transaction.Commit(); } else { throw new ArgumentException("Error Code." + returnCode.ToString()); } } catch (Exception ex) { transaction.Rollback(); throw ex; } finally { transaction.Dispose(); connection.Close(); connection = null; } } return(returnCode); }
private void SaveHREmployeeLeaveApplicationEntity() { if (IsValid) { try { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = BuildHREmployeeLeaveApplicationEntity(); Int64 result = -1; if (hREmployeeLeaveApplicationEntity.IsNew) { result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Add(hREmployeeLeaveApplicationEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, hREmployeeLeaveApplicationEntity.EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal); result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Update(hREmployeeLeaveApplicationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _EmployeeLeaveApplicationID = result; _HREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity; PrepareEditView(); BindHREmployeeLeaveApplicationList(); if (hREmployeeLeaveApplicationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been updated successfully.", false); } } else { if (hREmployeeLeaveApplicationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Leave Application Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Leave Application Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private Int64 Update(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeLeaveApplication_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); Database.AddInParameter(cmd, "@EmployeeLeaveApplicationID", DbType.Int64, hREmployeeLeaveApplicationEntity.EmployeeLeaveApplicationID); Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeLeaveApplicationEntity.EmployeeID); Database.AddInParameter(cmd, "@ApplicationDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.ApplicationDate); Database.AddInParameter(cmd, "@RequestStartDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.RequestStartDate); Database.AddInParameter(cmd, "@RequestEndDate", DbType.DateTime, hREmployeeLeaveApplicationEntity.RequestEndDate); Database.AddInParameter(cmd, "@TotalLeaveDays", DbType.Decimal, hREmployeeLeaveApplicationEntity.TotalLeaveDays); Database.AddInParameter(cmd, "@Description", DbType.String, hREmployeeLeaveApplicationEntity.Description); Database.AddInParameter(cmd, "@BackupEmployeeID", DbType.Int64, hREmployeeLeaveApplicationEntity.BackupEmployeeID); Database.AddInParameter(cmd, "@LeaveApplicationApplicationStatusID", DbType.Int64, hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID); Database.AddInParameter(cmd, "@LeaveCategoryID", DbType.Int64, hREmployeeLeaveApplicationEntity.LeaveCategoryID); Database.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeeLeaveApplicationEntity.SalarySessionID); Database.AddInParameter(cmd, "@LeaveLocation", DbType.String, hREmployeeLeaveApplicationEntity.LeaveLocation); Database.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hREmployeeLeaveApplicationEntity.FiscalYearID); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("HREmployeeLeaveApplicationEntity already exists. Please specify another HREmployeeLeaveApplicationEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeeLeaveApplicationEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeeLeaveApplicationEntity already exists. Please specify another HREmployeeLeaveApplicationEntity."); } } } } return(returnCode); }
protected void lvHREmployeeLeaveApplication_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 EmployeeLeaveApplicationID; Int64.TryParse(e.CommandArgument.ToString(), out EmployeeLeaveApplicationID); if (EmployeeLeaveApplicationID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _EmployeeLeaveApplicationID = EmployeeLeaveApplicationID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal); HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity(); result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Delete(hREmployeeLeaveApplicationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _EmployeeLeaveApplicationID = 0; _HREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity(); PrepareInitialView(); BindHREmployeeLeaveApplicationList(); MiscUtil.ShowMessage(lblMessage, "Employee Leave Application has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Leave Application.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private Int64 DeleteTran(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeLeaveApplication_SET"; Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd, db); AddFilterExpressionParameter(cmd, filterExpression, db); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { using (IDataReader reader = db.ExecuteReader(cmd, transaction)) { returnCode = GetReturnCodeFromParameter(cmd); } if (returnCode >= 0) { transaction.Commit(); } else { throw new ArgumentException("Error Code." + returnCode.ToString()); } } catch (Exception ex) { transaction.Rollback(); throw ex; } finally { transaction.Dispose(); connection.Close(); connection = null; } } return(returnCode); }
private void SendMail(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity) { HREmployeeLeaveApplicationEntity entity = hREmployeeLeaveApplicationEntity; String fe = "EmployeeID = " + entity.BackupEmployeeID + ""; IList <HREmployee_DetailedEntity> listEmployee = FCCHREmployee_Detailed.GetFacadeCreate().GetIL(1000, 1, String.Empty, fe); String EmployeeName = listEmployee[0].EmployeeFullName; String EmployeeCode = listEmployee[0].EmployeeCode; Int64 BackupEmployeeID = (Int64)entity.BackupEmployeeID; #region Notice Mail String MailBody = String.Empty; String Subject = String.Empty; //int count = 0; StringBuilder sb = new StringBuilder(); sb.Append("Dear Sir,"); sb.Append("<br/>"); sb.Append("This is a auto generated mail from the ERP."); sb.Append("<br/>"); sb.Append("Employee Name: " + EmployeeName + " Code :" + EmployeeCode + " is going to take " + entity.TotalLeaveDays + " days leave. And you are the back employee or assigned to his/her work. ."); sb.Append("<br/>"); sb.Append("Please contact with him/her if you have any problem."); sb.Append("<br/>"); sb.Append("-"); sb.Append("<br/>"); sb.Append("Thanks"); sb.Append("<br/>"); sb.Append("ERP System"); MailBody = sb.ToString(); Subject = "ERP, Leave"; String[] sendToMail = new String[1]; HREmployeeEntity _hREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetByID(BackupEmployeeID); if (_hREmployeeEntity != null) { sendToMail[0] = _hREmployeeEntity.PrimaryEmail; } MiscUtil.SendMail(sendToMail, Subject, MailBody); #endregion }
private void PrepareEditView() { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity; if (!hREmployeeLeaveApplicationEntity.IsNew) { txtApplicationDate.Text = hREmployeeLeaveApplicationEntity.ApplicationDate.ToStringDefault(); txtRequestStartDate.Text = hREmployeeLeaveApplicationEntity.RequestStartDate.ToStringDefault(); txtRequestEndDate.Text = hREmployeeLeaveApplicationEntity.RequestEndDate.ToStringDefault(); txtTotalLeaveDays.Text = hREmployeeLeaveApplicationEntity.TotalLeaveDays.ToString(); //txtDescription.Text = hREmployeeLeaveApplicationEntity.Description.ToString(); if (ddlBackupEmployeeID.Items.Count > 0 && hREmployeeLeaveApplicationEntity.BackupEmployeeID != null) { ddlBackupEmployeeID.SelectedValue = hREmployeeLeaveApplicationEntity.BackupEmployeeID.ToString(); } if (ddlLeaveCategoryID.Items.Count > 0 && hREmployeeLeaveApplicationEntity.LeaveCategoryID != null) { ddlLeaveCategoryID.SelectedValue = hREmployeeLeaveApplicationEntity.LeaveCategoryID.ToString(); } if (ddlEmployeeID.Items.Count > 0 && hREmployeeLeaveApplicationEntity.EmployeeID != null) { ddlEmployeeID.SelectedValue = hREmployeeLeaveApplicationEntity.EmployeeID.ToString(); } if (ddlLeavePurpose.Items.Count > 0 && hREmployeeLeaveApplicationEntity.Description != null) { ddlLeavePurpose.SelectedValue = hREmployeeLeaveApplicationEntity.Description.ToString(); } if (ddlLeaveLocation.Items.Count > 0 && hREmployeeLeaveApplicationEntity.LeaveLocation != null) { ddlLeaveLocation.SelectedValue = hREmployeeLeaveApplicationEntity.LeaveLocation.ToString(); } //if (ddlLeaveApplicationApplicationStatusID.Items.Count > 0 && hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID != null) //{ // ddlLeaveApplicationApplicationStatusID.SelectedValue = hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID.ToString(); //} btnSubmit.Text = "Update"; } }
private Int64 Delete(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeLeaveApplication_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("HREmployeeLeaveApplicationEntity already exists. Please specify another HREmployeeLeaveApplicationEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeeLeaveApplicationEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeeLeaveApplicationEntity already exists. Please specify another HREmployeeLeaveApplicationEntity."); } } } } return(returnCode); }
Int64 IHREmployeeLeaveApplicationFacade.Delete(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeLeaveApplicationDataAccess().Delete(hREmployeeLeaveApplicationEntity, filterExpression, option, reqTran)); }
Int64 IHREmployeeLeaveApplicationFacade.Add(HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeLeaveApplicationDataAccess().Add(hREmployeeLeaveApplicationEntity, option, reqTran)); }
protected void btnAddNew_Click(object sender, EventArgs e) { _EmployeeLeaveApplicationID = 0; _HREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity(); PrepareInitialView(); }
private void SaveHREmployeeLeaveApplicationEntity() { if (ValidationInput()) { if (IsValid) { try { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = BuildHREmployeeLeaveApplicationEntity(); hREmployeeLeaveApplicationEntity.SalarySessionID = Int64.Parse(ViewState["SalarySessionID"].ToString()); Int64 result = -1; if (hREmployeeLeaveApplicationEntity.IsNew) { result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Add(hREmployeeLeaveApplicationEntity, DatabaseOperationType.Add, TransactionRequired.No); if (hREmployeeLeaveApplicationEntity.BackupEmployeeID != null) { SendMail(hREmployeeLeaveApplicationEntity); } } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, hREmployeeLeaveApplicationEntity.EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal); result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Update(hREmployeeLeaveApplicationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { if (hREmployeeLeaveApplicationEntity.IsNew) { #region Approval Process if (ddlAPPanelID != null && ddlAPPanelID.SelectedValue != "0") { Boolean apResult = APRobot.CreateApprovalProcessForNewLeaveApplication(result, Int64.Parse(ddlAPPanelID.SelectedValue.ToString())); if (apResult == true) { MiscUtil.ShowMessage(lblMessage, "Approval Process Submited successfully.", UIConstants.MessageType.GREEN); } else { MiscUtil.ShowMessage(lblMessage, "Failed to Submit Approval Process.", UIConstants.MessageType.RED); } } } #endregion _EmployeeLeaveApplicationID = 0; _HREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity(); PrepareInitialView(); BindHREmployeeLeaveApplicationList(); if (hREmployeeLeaveApplicationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been updated successfully.", false); } } else { if (hREmployeeLeaveApplicationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Leave Application Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Leave Application Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private HREmployeeLeaveApplicationEntity BuildHREmployeeLeaveApplicationEntity() { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity; hREmployeeLeaveApplicationEntity.EmployeeID = OverviewEmployeeID; if (txtApplicationDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.ApplicationDate = DateTime.Parse(txtApplicationDate.Text); } if (txtRequestStartDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestStartDate = MiscUtil.ParseToDateTime(txtRequestStartDate.Text); } if (txtRequestEndDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestEndDate = MiscUtil.ParseToDateTime(txtRequestEndDate.Text); } if (!txtTotalLeaveDays.Text.Trim().IsNullOrEmpty()) { hREmployeeLeaveApplicationEntity.TotalLeaveDays = Decimal.Parse(txtTotalLeaveDays.Text.Trim()); } //hREmployeeLeaveApplicationEntity.Description = txtDescription.Text.Trim(); if (ddlLeavePurpose.Items.Count > 0) { if (ddlLeavePurpose.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.Description = null; } else { hREmployeeLeaveApplicationEntity.Description = ddlLeavePurpose.SelectedValue; } } //hREmployeeLeaveApplicationEntity.LeaveLocation = txtLeaveLocation.Text.Trim(); if (ddlLeaveLocation.Items.Count > 0) { if (ddlLeaveLocation.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.LeaveLocation = null; } else { hREmployeeLeaveApplicationEntity.LeaveLocation = ddlLeaveLocation.SelectedValue; } } if (ddlBackupEmployeeID.Items.Count > 0) { if (ddlBackupEmployeeID.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.BackupEmployeeID = null; } else { hREmployeeLeaveApplicationEntity.BackupEmployeeID = Int64.Parse(ddlBackupEmployeeID.SelectedValue); } } if (ddlLeaveApplicationApplicationStatusID.Items.Count > 0) { if (ddlLeaveApplicationApplicationStatusID.SelectedValue == "0") { } else { hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID = Int64.Parse(ddlLeaveApplicationApplicationStatusID.SelectedValue); } } #region Active FiscalYearID IList <ACFiscalYearEntity> listACFiscalYear = FCCACFiscalYear.GetFacadeCreate().GetIL(10000, 1, String.Empty, String.Empty, DatabaseOperationType.Load); ACFiscalYearEntity aCFiscalYearEntity = listACFiscalYear.Where(x => x.IsClosed == false).Single(); //if (listACFiscalYear.Count > 0 && listACFiscalYear[0].IsClosed == false) if (listACFiscalYear.Count > 0) { hREmployeeLeaveApplicationEntity.FiscalYearID = aCFiscalYearEntity.FiscalYearID; } #endregion return(hREmployeeLeaveApplicationEntity); }
private HREmployeeLeaveApplicationEntity BuildHREmployeeLeaveApplicationEntity() { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity; if (txtApplicationDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.ApplicationDate = MiscUtil.ParseToDateTime(txtApplicationDate.Text); } if (txtRequestStartDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestStartDate = MiscUtil.ParseToDateTime(txtRequestStartDate.Text); } if (txtRequestEndDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestEndDate = MiscUtil.ParseToDateTime(txtRequestEndDate.Text); } if (!txtTotalLeaveDays.Text.Trim().IsNullOrEmpty()) { hREmployeeLeaveApplicationEntity.TotalLeaveDays = Decimal.Parse(txtTotalLeaveDays.Text.Trim()); } //hREmployeeLeaveApplicationEntity.Description = txtDescription.Text.Trim(); if (ddlBackupEmployeeID.Items.Count > 0) { if (ddlBackupEmployeeID.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.BackupEmployeeID = null; } else { hREmployeeLeaveApplicationEntity.BackupEmployeeID = Int64.Parse(ddlBackupEmployeeID.SelectedValue); } } if (ddlLeaveCategoryID.Items.Count > 0) { if (ddlLeaveCategoryID.SelectedValue == "0") { } else { hREmployeeLeaveApplicationEntity.LeaveCategoryID = Int64.Parse(ddlLeaveCategoryID.SelectedValue); } } if (ddlLeavePurpose.Items.Count > 0) { if (ddlLeavePurpose.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.Description = null; } else { hREmployeeLeaveApplicationEntity.Description = ddlLeavePurpose.SelectedValue; } } if (ddlLeaveLocation.Items.Count > 0) { if (ddlLeaveLocation.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.LeaveLocation = null; } else { hREmployeeLeaveApplicationEntity.LeaveLocation = ddlLeaveLocation.SelectedValue; } } return(hREmployeeLeaveApplicationEntity); }