/// <summary> /// On 'Delete' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text)) { MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); if (spMonthlySalary.MonthlySalarySettingsMonthlySalaryIdSearchUsingSalaryMonth(Convert.ToDateTime(dtpSalaryMonth.Text)) > 0) { Delete(); } else { btnDelete.Enabled = false; } } else { Messages.NoPrivillageMessage(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "MSS14:" + ex.Message; } }
/// <summary> /// Function for Delete /// </summary> public void DeleteFunction() { try { MonthlySalaryDetailsSP spMonthlySalaryDetails = new MonthlySalaryDetailsSP(); MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); string strMonth = dtpSalaryMonth.Text; spMonthlySalary.MonthlySalaryDeleteAll(spMonthlySalary.MonthlySalarySettingsMonthlySalaryIdSearchUsingSalaryMonth(Convert.ToDateTime(dtpSalaryMonth.Text))); Messages.DeletedMessage(); SalaryPackageComboFill(); GridFill(); UpdateDataGridViewRowColors(); DeleteButtonEnableDisableChoose(); dtpSalaryMonth.Focus(); } catch (Exception ex) { formMDI.infoError.ErrorString = "MSS5:" + ex.Message; } }
/// <summary> /// Function to Enable/Disable delete button /// </summary> public void DeleteButtonEnableDisableChoose() { try { MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); if (spMonthlySalary.MonthlySalarySettingsMonthlySalaryIdSearchUsingSalaryMonth(Convert.ToDateTime(dtpSalaryMonth.Text)) > 0) { btnDelete.Enabled = true; btnSave.Text = "Update"; } else { btnDelete.Enabled = false; btnSave.Text = "Save"; } } catch (Exception ex) { formMDI.infoError.ErrorString = "MSS3:" + ex.Message; } }