Beispiel #1
0
    private void SaveData(string IsDelete)
    {
        long lngID = 0;

        try
        {
            if (hfIsUpadate.Value == "N")
            {
                lngID = objDB.GerMaxIDNumber("LeaveTypeList", "LTypeID");
            }
            else
            {
                lngID = Convert.ToInt32(hfID.Value);
            }
            decimal LngCarryOverCash = 0;
            if (Convert.ToInt16(ddlLNature.SelectedValue) == 1)
            {
                LngCarryOverCash = Convert.ToDecimal(txtCancarryOver.Text);
            }
            else if (Convert.ToInt16(ddlLNature.SelectedValue) == 2)
            {
                LngCarryOverCash = Convert.ToDecimal(txtCanCashable.Text);
            }
            else if (Convert.ToInt16(ddlLNature.SelectedValue) == 3)
            {
                LngCarryOverCash = Convert.ToDecimal(txtCarryOverAndCashable.Text);
            }

            LeaveType objLeaveType = new LeaveType(lngID.ToString(), txtMaxLimtCarry.Text, txtLeaveType.Text.Trim(), txtAbbrName.Text.Trim(),
                                                   txtDescription.Text.ToString().Trim(), ddlLMUnit.SelectedValue, (chkCalculate1UnitPer.Checked == true ? "1" : "0"),
                                                   (txtCalcInterval.Text == ""?"0": txtCalcInterval.Text), ddlCalBase.SelectedValue, ddlLNature.SelectedValue, (txtMaximumLeave.Text == ""?"0":txtMaximumLeave.Text),
                                                   LngCarryOverCash.ToString(), (txtEligibilityTime.Text == ""? "0":txtEligibilityTime.Text),
                                                   (txtNextLevInt.Text == ""?"0":txtNextLevInt.Text), (txtNoOfTimes.Text == ""?"0":txtNoOfTimes.Text),
                                                   Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString()),
                                                   (chkIsActive.Checked == true ? "N" : "Y"), IsDelete, "32", (chkIsOffdayCounted.Checked == true ? "Y" : "N"));

            objLeaveMgr.InsertLeaveType(objLeaveType, hfIsUpadate.Value, IsDelete, (chkIsActive.Checked == true ? "N" : "Y"));

            if (hfIsUpadate.Value == "N")
            {
                lblMsg.Text = "Record Saved Successfully";
            }
            else
            {
                lblMsg.Text = "Record Updated Successfully";
            }
            Common.EmptyTextBoxValues(this);
            this.EntryMode(false);
            this.OpenRecord();
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }