Esempio n. 1
0
    private void SaveData(string IsDelete)
    {
        try
        {
            if (hfIsUpdate.Value == "N")
            {
                hfID.Value = Common.getMaxId("OTAdjustment", "TransId");
            }
            else
            {
                hfID.Value = hfID.Value.ToString();
            }

            clsOTAdjustment obj = new clsOTAdjustment();
            obj.TransId      = hfID.Value.ToString();
            obj.BasicSal     = txtBasicSalary.Text.Trim();
            obj.EmpId        = txtEmpID.Text.Trim();
            obj.EntryDate    = Common.ReturnDate(txtEntryDate.Text.Trim());
            obj.Month        = ddlMonth.SelectedValue.Trim();
            obj.OTAmount     = txtOTAmount.Text.Trim();
            obj.OTAppHour    = txtOTApproveHr.Text.Trim();
            obj.OTHour       = txtOTHour.Text.Trim();
            obj.Year         = ddlYear.SelectedValue.Trim();
            obj.InsertedBy   = Session["USERID"].ToString();
            obj.InsertedDate = Common.SetDateTime(DateTime.Now.ToString());

            objPayroll.InsertOTAdjustment(obj, hfIsUpdate.Value, IsDelete);

            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 (hfIsUpdate.Value == "Y" && IsDelete == "Y")
            {
                lblMsg.Text = "Record Deleted Successfully";
            }

            this.OpenRecord();
            this.EntryMode(false);
            this.ClearSubControls();
        }
        catch (Exception ex)
        {
            lblMsg.Text = "Input is not valid.";
        }
    }