Esempio n. 1
0
    private void SaveData(string IsDelete)
    {
        decimal decID = 0;

        try
        {
            if (hfIsUpdate.Value == "N")
            {
                decID = Convert.ToDecimal(Common.getMaxId("IncPolicyList", "IncPolicyId"));
            }
            else
            {
                decID = Convert.ToDecimal(hfID.Value);
            }

            DataTable dtData = objPay.Tables["IncPolicyList"];
            DataRow   nRow   = dtData.NewRow();
            nRow["IncPolicyId"]   = decID;
            nRow["IncPolicyName"] = txtIncPolicy.Text.Trim();
            nRow["StartMonth"]    = ddlStartMonth.SelectedValue.ToString();
            nRow["EndMonth"]      = ddlEndMonth.SelectedValue.ToString();
            nRow["IncPercent"]    = txtIncPercent.Text.Trim();

            nRow["IsActive"]  = chkInActive.Checked == true ? 'N' : 'Y';
            nRow["IsDeleted"] = "N";

            if (hfIsUpdate.Value == "N")
            {
                nRow["InsertedBy"]   = Session["USERID"].ToString();
                nRow["InsertedDate"] = DateTime.Now;
            }
            else
            {
                nRow["UpdatedBy"]   = Session["USERID"].ToString();
                nRow["UpdatedDate"] = DateTime.Now;
            }

            dtData.Rows.Add(nRow);
            dtData.AcceptChanges();

            objOptMgr.SaveData(dtData, hfIsUpdate.Value == "N" ? "I" : "U");
            //lblMsg.Text = Common.GetMessage(hfIsUpdate.Value == "N" ? "I" : "U");
            this.EntryMode(false);
            this.OpenRecord();
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }