public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } pvtTempDataSet = null; pvtTempDataSet = new DataSet(); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["Leave"].Clone()); pvtTempDataSet.Tables[0].ImportRow(pvtLeaveDataView[clsISUtilities.DataViewIndex].Row); //Compress DataSet pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet); if (this.Text.IndexOf(" - New", 0) > 0) { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtbytCompress; pvtintLeaveNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtLeaveDataView[clsISUtilities.DataViewIndex]["LEAVE_SHIFT_NO"] = pvtintLeaveNo; //Reset From 0 To Null pvtLeaveDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = System.DBNull.Value; } else { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtbytCompress; pvtintReturnCode = (int)clsISUtilities.DynamicFunction("Update_Record", objParm, true); if (pvtintReturnCode == 9999) { this.pvtDataSet.RejectChanges(); this.dgvNormalSickLeaveCategoryDataGridView[0, this.Get_DataGridView_SelectedRowIndex(dgvNormalSickLeaveCategoryDataGridView)].Style = this.PayrollLinkDataGridViewCellStyle; pvtLeaveDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = 0; DialogResult dlgResult = CustomMessageBox.Show("This Normal Leave and Sick Leave Category is currently being used in a Payroll Run.\r\n\r\nUpdate Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.dgvNormalSickLeaveCategoryDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvNormalSickLeaveCategoryDataGridView)].Value = this.txtLeave.Text.Trim(); } } this.pvtDataSet.Tables["Leave"].AcceptChanges(); if (this.clsISUtilities.pubintReloadSpreadsheet == true) { Load_CurrentForm_Records(); } else { btnCancel_Click(sender, e); } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } string strDesc = ""; string[] strDescPiesces = this.txtOccupationDepartment.Text.Trim().Split(' '); for (int intCount = 0; intCount < strDescPiesces.Length; intCount++) { strDescPiesces[intCount] = strDescPiesces[intCount].Substring(0, 1).ToUpper() + strDescPiesces[intCount].Substring(1).ToLower(); if (intCount == 0) { strDesc = strDescPiesces[intCount]; } else { strDesc += " " + strDescPiesces[intCount]; } } if (this.Text.EndsWith(" - New") == true) { object[] objParm = new object[4]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtstrMenuId; objParm[3] = strDesc; pvtintOccupationDepartmentNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtDataRowView = pvtOccupationDepartmentDataView.AddNew(); pvtDataRowView.BeginEdit(); pvtDataRowView[pvtstrTableName + "_NO"] = pvtintOccupationDepartmentNo; pvtDataRowView[pvtstrTableName + "_DESC"] = strDesc; pvtDataRowView.EndEdit(); Load_CurrentForm_Records(); } else { object[] objParm = new object[5]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtintOccupationDepartmentNo; objParm[2] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[3] = pvtstrMenuId; objParm[4] = strDesc; clsISUtilities.DynamicFunction("Update_Record", objParm, true); pvtOccupationDepartmentDataView[pvtintOccupationDepartmentRowIndex][pvtstrTableName + "_DESC"] = strDesc; } this.pvtDataSet.AcceptChanges(); Set_Form_For_Read(); Load_CurrentForm_Records(); } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } if (Convert.ToDouble(this.txtRate1.Text) > Convert.ToDouble(this.txtRate2.Text) & Convert.ToDouble(this.txtRate2.Text) != 0) { CustomMessageBox.Show("Overtime Rate 1 cannot be Greater than Overtime Rate 2", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtRate1.Focus(); return; } if (Convert.ToDouble(this.txtRate2.Text) > Convert.ToDouble(this.txtRate3.Text) & Convert.ToDouble(this.txtRate3.Text) != 0) { CustomMessageBox.Show("Overtime Rate 2 cannot be Greater than Overtime Rate 3", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtRate2.Focus(); return; } if (Convert.ToDouble(this.txtSalaryRate1.Text) > Convert.ToDouble(this.txtSalaryRate2.Text) & Convert.ToDouble(this.txtSalaryRate2.Text) != 0) { CustomMessageBox.Show("Overtime Rate 1 cannot be Greater than Overtime Rate 2", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtSalaryRate1.Focus(); return; } if (Convert.ToDouble(this.txtSalaryRate2.Text) > Convert.ToDouble(this.txtSalaryRate3.Text) & Convert.ToDouble(this.txtSalaryRate3.Text) != 0) { CustomMessageBox.Show("Overtime Rate 2 cannot be Greater than Overtime Rate 3", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtSalaryRate2.Focus(); return; } pvtTempDataSet = null; pvtTempDataSet = new DataSet(); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["Company"].Clone()); pvtTempDataSet.Tables["Company"].ImportRow(this.pvtCompanyDataView[clsISUtilities.DataViewIndex].Row); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["EfilingPeriod"].Clone()); //Compress DataSet pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet); if (this.Text.EndsWith(" - New") == true) { object[] objParm = new object[3]; objParm[0] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = this.pvtbytCompress; pvtint64CompanyNo = (Int64)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); AppDomain.CurrentDomain.SetData("LastCompanyNo", pvtint64CompanyNo); //Get Main DataSet DataSet TempDataSet = (DataSet)AppDomain.CurrentDomain.GetData("DataSet"); DataRow dtDataRow = TempDataSet.Tables["Company"].NewRow(); dtDataRow["COMPANY_NO"] = pvtint64CompanyNo; dtDataRow["COMPANY_DESC"] = this.txtCompany.Text; if (rbnYYYY.Checked == true) { dtDataRow["DATE_FORMAT"] = "yyyy-MM-dd"; } else { dtDataRow["DATE_FORMAT"] = "dd-MM-yyyy"; } dtDataRow["COMPANY_ACCESS_IND"] = "A"; TempDataSet.Tables["Company"].Rows.Add(dtDataRow); TempDataSet.AcceptChanges(); //Fire Off Load Of Companies ComboBox on PayrollMain Form Timer tmrTimerReloadCompanies = (Timer)AppDomain.CurrentDomain.GetData("TimerReloadCompanies"); tmrTimerReloadCompanies.Enabled = true; pvtCompanyDataView[clsISUtilities.DataViewIndex]["COMPANY_NO"] = pvtint64CompanyNo; } else { object[] objParm = new object[3]; objParm[0] = pvtint64CompanyNo; objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = this.pvtbytCompress; clsISUtilities.DynamicFunction("Update_Record", objParm, true); //Get Main DataSet DataSet TempDataSet = (DataSet)AppDomain.CurrentDomain.GetData("DataSet"); for (int intRow = 0; intRow < TempDataSet.Tables["Company"].Rows.Count; intRow++) { if (Convert.ToInt64(TempDataSet.Tables["Company"].Rows[intRow]["COMPANY_NO"]) == pvtint64CompanyNo) { if (rbnYYYY.Checked == true) { TempDataSet.Tables["Company"].Rows[intRow]["DATE_FORMAT"] = "yyyy-MM-dd"; } else { TempDataSet.Tables["Company"].Rows[intRow]["DATE_FORMAT"] = "dd-MM-yyyy"; } break; } } } //Current Company Selected Globally if (Convert.ToInt32(AppDomain.CurrentDomain.GetData("CompanyNo")) == pvtint64CompanyNo) { if (rbnYYYY.Checked == true) { AppDomain.CurrentDomain.SetData("DateFormat", "yyyy-MM-dd"); } else { AppDomain.CurrentDomain.SetData("DateFormat", "dd-MM-yyyy"); } } this.pvtDataSet.AcceptChanges(); btnCancel_Click(sender, e); } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } DataSet TempDataSet = new DataSet(); TempDataSet.Tables.Add(this.pvtDataSet.Tables["LeaveType"].Clone()); TempDataSet.Tables["LeaveType"].ImportRow(this.pvtLeaveTypeDataView[clsISUtilities.DataViewIndex].Row); //Compress DataSet byte[] bytCompress = clsISUtilities.Compress_DataSet(TempDataSet); if (this.Text.EndsWith(" - New") == true) { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = bytCompress; pvtintLeaveTypeNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtLeaveTypeDataView[clsISUtilities.DataViewIndex]["EARNING_NO"] = pvtintLeaveTypeNo; } else { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = bytCompress; intReturnCode = (int)clsISUtilities.DynamicFunction("Update_Record", objParm, true); if (intReturnCode == 9999) { this.pvtDataSet.RejectChanges(); pvtLeaveTypeDataView[this.clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = 0; this.dgvLeaveTypeDataGridView[0, this.Get_DataGridView_SelectedRowIndex(dgvLeaveTypeDataGridView)].Style = this.PayrollLinkDataGridViewCellStyle; CustomMessageBox.Show("This Leave Type is currently being used in a Payroll Run.\r\n\r\nUpdate Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.dgvLeaveTypeDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvLeaveTypeDataGridView)].Value = this.txtLeaveType.Text.Trim(); } } this.pvtDataSet.AcceptChanges(); if (this.clsISUtilities.pubintReloadSpreadsheet == true) { Load_CurrentForm_Records(); } else { btnCancel_Click(sender, e); } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } if (DateTime.ParseExact(this.txtFromDate.Text, AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null) > DateTime.ParseExact(this.txtToDate.Text, AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null)) { MessageBox.Show("From Date must be Less than or Equal to To Date.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string strFromDate = DateTime.ParseExact(this.txtFromDate.Text, AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null).ToString("yyyy-MM-dd"); string strToDate = DateTime.ParseExact(this.txtToDate.Text, AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null).ToString("yyyy-MM-dd"); bool blnLocked = false; if (this.rbnLocked.Checked == true) { blnLocked = true; } if (this.Text.EndsWith(" - New") == true) { object[] objParm = new object[5]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strFromDate; objParm[3] = strToDate; objParm[4] = blnLocked; pvtintPayCategoryShiftScheduleNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtDataRowView = pvtShiftScheduleDataView.AddNew(); pvtDataRowView.BeginEdit(); pvtDataRowView["COMPANY_NO"] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); pvtDataRowView["PAY_CATEGORY_TYPE"] = pvtstrPayrollType; pvtDataRowView["PAY_CATEGORY_SHIFT_SCHEDULE_NO"] = pvtintPayCategoryShiftScheduleNo; pvtDataRowView["FROM_DATETIME"] = DateTime.ParseExact(strFromDate, "yyyy-MM-dd", null); pvtDataRowView["TO_DATETIME"] = DateTime.ParseExact(strToDate, "yyyy-MM-dd", null); pvtDataRowView["LOCKED_IND"] = blnLocked; pvtDataRowView.EndEdit(); Load_CurrentForm_Records(); } else { object[] objParm = new object[6]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = pvtintPayCategoryShiftScheduleNo; objParm[3] = strFromDate; objParm[4] = strToDate; objParm[5] = blnLocked; clsISUtilities.DynamicFunction("Update_Record", objParm, true); pvtShiftScheduleDataView[pvtintShiftScheduleDataVieweRowNo]["FROM_DATETIME"] = DateTime.ParseExact(strFromDate, "yyyy-MM-dd", null); pvtShiftScheduleDataView[pvtintShiftScheduleDataVieweRowNo]["TO_DATETIME"] = DateTime.ParseExact(strToDate, "yyyy-MM-dd", null); if (blnLocked == true) { pvtShiftScheduleDataView[pvtintShiftScheduleDataVieweRowNo]["LOCKED_IND"] = true; } else { pvtShiftScheduleDataView[pvtintShiftScheduleDataVieweRowNo]["LOCKED_IND"] = false; } } this.pvtDataSet.AcceptChanges(); Set_Form_For_Read(); Load_CurrentForm_Records(); } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { pvtintReturnCode = clsISUtilities.DataBind_Save_Check(); if (pvtintReturnCode != 0) { return; } pvtintReturnCode = Save_Check(); if (pvtintReturnCode != 0) { return; } pvtTempDataSet = null; pvtTempDataSet = new DataSet(); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["Deduction"].Clone()); pvtTempDataSet.Tables["Deduction"].ImportRow(pvtDeductionDataView[clsISUtilities.DataViewIndex].Row); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["EarningPercentage"].Clone()); pvtEarningPercentageDataView = null; pvtEarningPercentageDataView = new DataView(pvtDataSet.Tables["EarningPercentage"], "COMPANY_NO = " + AppDomain.CurrentDomain.GetData("CompanyNo").ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtstrPayrollType + "' AND DEDUCTION_NO = " + pvtintDeductionNo, "", DataViewRowState.Added | DataViewRowState.Deleted | DataViewRowState.ModifiedCurrent); for (int intRow = 0; intRow < pvtEarningPercentageDataView.Count; intRow++) { pvtTempDataSet.Tables["EarningPercentage"].ImportRow(pvtEarningPercentageDataView[intRow].Row); } //Compress DataSet pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet); if (this.Text.IndexOf(" - New", 0) > 0) { object[] objParm = new object[2]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[1] = pvtbytCompress; pvtintDeductionNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_NO"] = pvtintDeductionNo; pvtDeductionDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = System.DBNull.Value; //2017-02-24 Create opposite PAY_CATEGORY_TYPE DataRowView DataRowView = pvtDeductionDataView.AddNew(); DataRowView.BeginEdit(); DataRowView["COMPANY_NO"] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); if (pvtDeductionDataView[clsISUtilities.DataViewIndex]["PAY_CATEGORY_TYPE"].ToString() == "W") { DataRowView["PAY_CATEGORY_TYPE"] = "S"; } else { DataRowView["PAY_CATEGORY_TYPE"] = "W"; } DataRowView["EMPLOYEE_NO"] = 0; DataRowView["DEDUCTION_NO"] = Convert.ToInt16(pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_NO"]); DataRowView["DEDUCTION_SUB_ACCOUNT_NO"] = Convert.ToInt16(pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_SUB_ACCOUNT_NO"]); DataRowView["DEDUCTION_DESC"] = pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_DESC"].ToString(); DataRowView["DEDUCTION_SUB_ACCOUNT_COUNT"] = Convert.ToInt16(pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_SUB_ACCOUNT_COUNT"]); if (pvtDeductionDataView[clsISUtilities.DataViewIndex]["IRP5_CODE"] != System.DBNull.Value) { DataRowView["IRP5_CODE"] = Convert.ToInt16(pvtDeductionDataView[clsISUtilities.DataViewIndex]["IRP5_CODE"]); } DataRowView["DEDUCTION_REPORT_HEADER1"] = pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_REPORT_HEADER1"].ToString(); DataRowView["DEDUCTION_REPORT_HEADER2"] = pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_REPORT_HEADER2"].ToString(); DataRowView["DEDUCTION_LOAN_TYPE_IND"] = pvtDeductionDataView[clsISUtilities.DataViewIndex]["DEDUCTION_LOAN_TYPE_IND"].ToString(); DataRowView["DEDUCTION_DEL_IND"] = "Y"; DataRowView["DEDUCTION_TYPE_IND"] = "U"; DataRowView["DEDUCTION_VALUE"] = 0; DataRowView["DEDUCTION_MIN_VALUE"] = 0; DataRowView["DEDUCTION_MAX_VALUE"] = 0; DataRowView["DEDUCTION_PERIOD_IND"] = "E"; DataRowView["DEDUCTION_DAY_VALUE"] = 0; DataRowView["TIE_BREAKER"] = 1; DataRowView.EndEdit(); pvtEarningPercentageDataView = null; pvtEarningPercentageDataView = new DataView(pvtDataSet.Tables["EarningPercentage"], "COMPANY_NO = " + AppDomain.CurrentDomain.GetData("CompanyNo").ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtstrPayrollType + "' AND DEDUCTION_NO = 0 ", "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < pvtEarningPercentageDataView.Count; intRow++) { pvtEarningPercentageDataView[intRow]["DEDUCTION_NO"] = pvtintDeductionNo; intRow -= 1; } } else { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtbytCompress; pvtintReturnCode = (int)clsISUtilities.DynamicFunction("Update_Record", objParm, true); if (pvtintReturnCode == 9999) { this.pvtDataSet.Tables["Deduction"].RejectChanges(); pvtDeductionDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = 0; this.dgvDeductionDataGridView.Rows[this.Get_DataGridView_SelectedRowIndex(this.dgvDeductionDataGridView)].HeaderCell.Style = LockedPayrollRunDataGridViewCellStyle; CustomMessageBox.Show("This Deduction is currently being used in a Payroll Run.\r\n\r\nUpdate Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (pvtintReturnCode != 0) { CustomMessageBox.Show("Number of Sub-Accounts used = " + pvtintReturnCode.ToString() + "\r\n\r\nYou cannot set a Value of " + this.cboNumberSubAccount.SelectedItem.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { dgvDeductionDataGridView[2, pvtintDeductionDataGridViewRowIndex].Value = this.txtDeduction.Text.Trim(); } } } this.pvtDataSet.AcceptChanges(); if (this.Text.EndsWith(" - New") == true) { Load_CurrentForm_Records(); } else { btnCancel_Click(sender, e); } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }