public ActionResult BonusDeductionEdit_Load(string bonusDeductionId) { string jsonComboData = string.Empty; decimal decBonusDeductionId = Convert.ToDecimal(bonusDeductionId); BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); try { BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction = spBonusDeduction.BonusDeductionViewForUpdate(decBonusDeductionId); DataTable employeeCodeCombo = EmployeeCodeComboFill(); jsonComboData = Utils.ConvertDataTabletoString(employeeCodeCombo); } catch (Exception ex) { return(Json(new { success = "true", ex = "BD2" + ex.Message })); } return(Json(new { success = "true", ex = "no", data = new { date = infoBonusDeduction.Date.ToString("yyyy-MM-dd"), employeeCodes = jsonComboData, employeeId = infoBonusDeduction.EmployeeId, month = infoBonusDeduction.Month.ToString("yyyy-MM"), bonusAmount = infoBonusDeduction.BonusAmount, deductionAmount = infoBonusDeduction.DeductionAmount, narration = infoBonusDeduction.Narration } })); }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; if (spBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction)) { Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage(" Employee bonus deduction already exist"); cmbEmployeeCode.Focus(); } } catch (Exception ex) { MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool BonusDeductionMonthCheckExistance(BonusDedutionInfo bonusdedutioninfo) { bool isEdit = false; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("BonusDeductionMonthCheckExistance", base.sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.Add("@month", SqlDbType.DateTime).Value = bonusdedutioninfo.Month; object obj = sqlcmd.ExecuteScalar(); isEdit = (obj != null && true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } return(isEdit); }
/// <summary> /// Function to call this form from frmBonusDeductionRegister for updation /// </summary> /// <param name="decBonusDeductionId"></param> /// <param name="frm"></param> public void CallFromBonusDeductionRegister(decimal decBonusDeductionId, frmBonusDeductionRegister frm) { try { base.Show(); BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDeductionBll BllBonusDeduction = new BonusDeductionBll(); infoBonusDeduction = BllBonusDeduction.BonusDeductionViewForUpdate(decBonusDeductionId); dtpDate.Text = infoBonusDeduction.Date.ToString(); cmbEmployeeCode.SelectedValue = infoBonusDeduction.EmployeeId; decEmployeeIdForEdit = infoBonusDeduction.EmployeeId; dtpMonth.Text = infoBonusDeduction.Month.ToString(); dtMonth = infoBonusDeduction.Month; txtBonusAmount.Text = infoBonusDeduction.BonusAmount.ToString(); txtDeductionAmount.Text = infoBonusDeduction.DeductionAmount.ToString(); txtNarration.Text = infoBonusDeduction.Narration; btnSave.Text = "Update"; dtpMonth.Enabled = false; cmbEmployeeCode.Enabled = false; btnDelete.Enabled = true; txtDate.Focus(); decBonusId = decBonusDeductionId; frmBonusDeductionRegisterObj = frm; frm.Enabled = false; } catch (Exception ex) { MessageBox.Show("BD9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public string SaveFunction(string employeeId, string date, string month, string bonusAmount, string deductionAmount, string narration) { string message = string.Empty; try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(date); infoBonusDeduction.EmployeeId = Convert.ToDecimal(employeeId); infoBonusDeduction.Month = Convert.ToDateTime(month); infoBonusDeduction.BonusAmount = Convert.ToDecimal(bonusAmount); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(deductionAmount); infoBonusDeduction.Narration = narration; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; if (!spBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction)) { message = "Employee bonus deduction already exist"; } } catch (Exception ex) { } return(message); }
/// <summary> /// Function to call this form from frmBonusDeductionRegister for updation /// </summary> /// <param name="decBonusDeductionId"></param> /// <param name="frm"></param> public void CallFromBonusDeductionRegister(decimal decBonusDeductionId, frmBonusDeductionRegister frm) { try { base.Show(); BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction = spBonusDeduction.BonusDeductionViewForUpdate(decBonusDeductionId); dtpDate.Text = infoBonusDeduction.Date.ToString(); cmbEmployeeCode.SelectedValue = infoBonusDeduction.EmployeeId; decEmployeeIdForEdit = infoBonusDeduction.EmployeeId; dtpMonth.Text = infoBonusDeduction.Month.ToString(); dtMonth = infoBonusDeduction.Month; txtBonusAmount.Text = infoBonusDeduction.BonusAmount.ToString(); txtDeductionAmount.Text = infoBonusDeduction.DeductionAmount.ToString(); txtNarration.Text = infoBonusDeduction.Narration; btnSave.Text = "Update"; dtpMonth.Enabled = false; cmbEmployeeCode.Enabled = false; btnDelete.Enabled = true; txtDate.Focus(); decBonusId = decBonusDeductionId; frmBonusDeductionRegisterObj = frm; frm.Enabled = false; } catch (Exception ex) { MessageBox.Show("BD9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit /// </summary> public string EditFunction(string employeeId, string date, string month, string bonusAmount, string deductionAmount, string narration, string bonusId) { string message = string.Empty; try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(date); infoBonusDeduction.EmployeeId = Convert.ToDecimal(employeeId); infoBonusDeduction.Month = Convert.ToDateTime(month); infoBonusDeduction.BonusAmount = Convert.ToDecimal(bonusAmount); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(deductionAmount); infoBonusDeduction.Narration = narration; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; infoBonusDeduction.BonusDeductionId = Convert.ToDecimal(bonusId); spBonusDeduction.BonusDedutionEdit(infoBonusDeduction); } catch (Exception ex) { } return(message); }
/// <summary> /// Function to edit /// </summary> public void EditFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; infoBonusDeduction.BonusDeductionId = decBonusId; spBonusDeduction.BonusDedutionEdit(infoBonusDeduction); Messages.UpdatedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; dtpDate.Focus(); if (frmBonusDeductionRegisterObj != null) { frmBonusDeductionRegisterObj.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show("BD3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Update values in BonusDeduction Table /// </summary> /// <param name="bonusdedutioninfo"></param> public void BonusDedutionEdit(BonusDedutionInfo bonusdedutioninfo) { try { SPBonusDedution.BonusDedutionEdit(bonusdedutioninfo); } catch (Exception ex) { MessageBox.Show("BDBll2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values if not exists and return id /// </summary> /// <param name="bonusdedutioninfo"></param> /// <returns></returns> public bool BonusDeductionAddIfNotExist(BonusDedutionInfo bonusdedutioninfo) { bool isSave = false; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BonusDeductionAddIfNotExist", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal); sprmparam.Value = bonusdedutioninfo.EmployeeId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = bonusdedutioninfo.Date; sprmparam = sccmd.Parameters.Add("@month", SqlDbType.DateTime); sprmparam.Value = bonusdedutioninfo.Month; sprmparam = sccmd.Parameters.Add("@bonusAmount", SqlDbType.Decimal); sprmparam.Value = bonusdedutioninfo.BonusAmount; sprmparam = sccmd.Parameters.Add("@deductionAmount", SqlDbType.Decimal); sprmparam.Value = bonusdedutioninfo.DeductionAmount; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = bonusdedutioninfo.Narration; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = bonusdedutioninfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = bonusdedutioninfo.Extra2; int ina = sccmd.ExecuteNonQuery(); if (ina > 0) { isSave = true; } else { isSave = false; } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(isSave); }
/// <summary> /// Function to get particular values from BonusDeduction table based on the parameter /// </summary> /// <param name="bonusDeductionId"></param> /// <returns></returns> public BonusDedutionInfo BonusDedutionView(decimal bonusDeductionId) { BonusDedutionInfo bonusdedutioninfo = new BonusDedutionInfo(); try { bonusdedutioninfo = SPBonusDedution.BonusDedutionView(bonusDeductionId); } catch (Exception ex) { MessageBox.Show("BDBll4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(bonusdedutioninfo); }
/// <summary> /// Function to check existence of month and return value /// </summary> /// <param name="bonusdedutioninfo"></param> /// <returns></returns> public bool BonusDeductionMonthCheckExistance(BonusDedutionInfo bonusdedutioninfo) { bool isEdit = false; try { isEdit = SPBonusDedution.BonusDeductionMonthCheckExistance(bonusdedutioninfo); } catch (Exception ex) { MessageBox.Show("BDBll11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isEdit); }
/// <summary> /// Function to insert values if not exists and return id /// </summary> /// <param name="bonusdedutioninfo"></param> /// <returns></returns> public bool BonusDeductionAddIfNotExist(BonusDedutionInfo bonusdedutioninfo) { bool isSave = false; try { isSave = SPBonusDedution.BonusDeductionAddIfNotExist(bonusdedutioninfo); } catch (Exception ex) { MessageBox.Show("BDBll10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isSave); }
public BonusDedutionInfo BonusDedutionView(decimal bonusDeductionId) { BonusDedutionInfo bonusdedutioninfo = new BonusDedutionInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BonusDedutionView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@bonusDeductionId", SqlDbType.Decimal); sprmparam2.Value = bonusDeductionId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { bonusdedutioninfo.BonusDeductionId = decimal.Parse(((DbDataReader)sdrreader)[0].ToString()); bonusdedutioninfo.EmployeeId = decimal.Parse(((DbDataReader)sdrreader)[1].ToString()); bonusdedutioninfo.Date = DateTime.Parse(((DbDataReader)sdrreader)[2].ToString()); bonusdedutioninfo.Month = DateTime.Parse(((DbDataReader)sdrreader)[3].ToString()); bonusdedutioninfo.BonusAmount = decimal.Parse(((DbDataReader)sdrreader)[4].ToString()); bonusdedutioninfo.DeductionAmount = decimal.Parse(((DbDataReader)sdrreader)[5].ToString()); bonusdedutioninfo.Narration = ((DbDataReader)sdrreader)[6].ToString(); bonusdedutioninfo.ExtraDate = DateTime.Parse(((DbDataReader)sdrreader)[7].ToString()); bonusdedutioninfo.Extra1 = ((DbDataReader)sdrreader)[8].ToString(); bonusdedutioninfo.Extra2 = ((DbDataReader)sdrreader)[9].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(bonusdedutioninfo); }
public void BonusDedutionAdd(BonusDedutionInfo bonusdedutioninfo) { try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BonusDedutionAdd", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam11 = new SqlParameter(); sprmparam11 = sccmd.Parameters.Add("@bonusDeductionId", SqlDbType.Decimal); sprmparam11.Value = bonusdedutioninfo.BonusDeductionId; sprmparam11 = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal); sprmparam11.Value = bonusdedutioninfo.EmployeeId; sprmparam11 = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam11.Value = bonusdedutioninfo.Date; sprmparam11 = sccmd.Parameters.Add("@month", SqlDbType.DateTime); sprmparam11.Value = bonusdedutioninfo.Month; sprmparam11 = sccmd.Parameters.Add("@bonusAmount", SqlDbType.Decimal); sprmparam11.Value = bonusdedutioninfo.BonusAmount; sprmparam11 = sccmd.Parameters.Add("@deductionAmount", SqlDbType.Decimal); sprmparam11.Value = bonusdedutioninfo.DeductionAmount; sprmparam11 = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam11.Value = bonusdedutioninfo.Narration; sprmparam11 = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam11.Value = bonusdedutioninfo.ExtraDate; sprmparam11 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam11.Value = bonusdedutioninfo.Extra1; sprmparam11 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam11.Value = bonusdedutioninfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } }
public BonusDedutionInfo BonusDeductionViewForUpdate(decimal decBonusDeductionId) { BonusDedutionInfo BonusDeductionInfo = new BonusDedutionInfo(); EmployeeInfo InfoEmployee = new EmployeeInfo(); SqlDataReader sqldr = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("BonusDeductionViewForUpdate", base.sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.Add("@bonusDeductionId", SqlDbType.Decimal).Value = decBonusDeductionId; sqldr = sqlcmd.ExecuteReader(); while (sqldr.Read()) { BonusDeductionInfo.EmployeeId = decimal.Parse(((DbDataReader)sqldr)["employeeId"].ToString()); BonusDeductionInfo.Date = DateTime.Parse(((DbDataReader)sqldr)["date"].ToString()); BonusDeductionInfo.Month = DateTime.Parse(((DbDataReader)sqldr)["month"].ToString()); BonusDeductionInfo.BonusAmount = decimal.Parse(((DbDataReader)sqldr)["bonusAmount"].ToString()); BonusDeductionInfo.DeductionAmount = decimal.Parse(((DbDataReader)sqldr)["deductionAmount"].ToString()); BonusDeductionInfo.Narration = ((DbDataReader)sqldr)["narration"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqldr.Close(); base.sqlcon.Close(); } return(BonusDeductionInfo); }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDeductionBll BllBonusDeduction = new BonusDeductionBll(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; if (BllBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction)) { Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage(" Employee bonus deduction already exist"); cmbEmployeeCode.Focus(); } } catch (Exception ex) { MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit /// </summary> public void EditFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDeductionBll BllBonusDeduction = new BonusDeductionBll(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; infoBonusDeduction.BonusDeductionId = decBonusId; BllBonusDeduction.BonusDedutionEdit(infoBonusDeduction); Messages.UpdatedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; dtpDate.Focus(); if (frmBonusDeductionRegisterObj != null) { frmBonusDeductionRegisterObj.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show("BD3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }