Ejemplo n.º 1
0
    private void SaveData(string IsDelete)
    {
        long lngID = 0;

        try
        {
            if (hfIsUpdate.Value == "N")
            {
                lngID = objDB.GerMaxIDNumber("SalaryPakMst", "SalPakId");
            }
            else
            {
                lngID = Convert.ToInt64(hfID.Value);
            }

            // For RDRS salary netpayable amount update after each payamt change.
            this.SetNetPayableAmount();

            Payroll_SalaryPakMst objSalaryPakMst = new Payroll_SalaryPakMst(
                lngID.ToString(),
                ddlSalPackTitle.SelectedItem.Text.Trim(),
                txtDescription.Text.Trim(),
                "1",
                "N",
                "3",
                txtOTAmtPerHour.Text.Trim(),
                (chkOTPercentOf.Checked == true ? "Y" : "N"),
                (chkOTPercentOf.Checked == true? ddlOTSalHead.SelectedValue.ToString():""),
                txtAttndBonusAmt.Text.Trim(),
                (chkAttnBonusPercentOf.Checked == true ? "Y" : "N"),
                (chkAttnBonusPercentOf.Checked == true ? ddlAttnSalHead.SelectedValue.ToString() : ""),
                txtDelay.Text,
                txtDeduct.Text,
                (txtDeduct.Text != "0"? ddlDeductHead.SelectedValue.ToString(): ""),
                txtGrossSal.Text.Trim(),
                "Y",
                txtNetPayableAmt.Text.Trim(),
                (chkInActive.Checked == true ? "N" : "Y"),
                (chkCompanyFacility.Checked == true ? "Y" : "N"),
                "1",
                Session["USERID"].ToString(),
                Common.SetDateTime(DateTime.Now.ToString()));
            objSalaryManager.InsertSalaryPakMst(objSalaryPakMst, hfIsUpdate.Value, IsDelete, grSalHead, ddlSalPackTitle.SelectedValue.ToString());
            if ((hfIsUpdate.Value == "N") && (IsDelete == "N"))
            {
                lblMsg.Text = "Record Saved Successfully";
            }
            else if ((hfIsUpdate.Value == "Y") && (IsDelete == "N"))
            {
                lblMsg.Text = "Record Updated Successfully";
            }
            else if (IsDelete == "Y")
            {
                lblMsg.Text = "Record Deleted Successfully";
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }