Пример #1
0
    private void SaveData(string IsDelete)
    {
        long lngID = 0;

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

            LeavePakMst objLeavePakMst = new LeavePakMst(lngID.ToString(), txtLeavePakName.Text, txtDescription.Text, (chkIsOffdayCounted.Checked == true ? "Y" : "N"),
                                                         (chkLeavCalcOnJoining.Checked == true ? "Y" : "N"), (chkInActive.Checked == true ? "N" : "Y"), ddlEmploymentType.SelectedValue.ToString(), (chkIsDefault.Checked == true ? "Y" : "N"), Session["USERID"].ToString(),
                                                         Common.SetDateTime(DateTime.Now.ToString()), "N", ddlMonthFrom.SelectedValue.ToString(), ddlMonthTo.SelectedValue.ToString(), (chkIsNextYear.Checked == true ? "Y" : "N"), strStartDate, strEndDate);

            objLeaveManager.InsertLeavePakMst(objLeavePakMst, hfIsUpdate.Value, IsDelete, (chkInActive.Checked == true ? "N" : "Y"), grLeaveList);

            //if (hfIsUpdate.Value == "Y")
            //{
            //    LeaveManager objLeaveMgr = new LeaveManager();
            //    objLeaveMgr.InsertLeaveProfile(ddlEmploymentType.SelectedValue, lngID.ToString(), Session["USERID"].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";
            }
            this.OpenRecord();

            Common.EmptyTextBoxValues(this);
            this.EntryMode(false);
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }