예제 #1
0
    private void SaveData(string cmdType)
    {
        dsPayroll objDS = new dsPayroll();

        if (cmdType == "I")
        {
            hfId.Value = Common.getMaxId("FinalPayment", "FinalPayId");
        }

        DataTable dtMst = objDS.Tables["FinalPayment"];
        DataRow   nRow  = dtMst.NewRow();

        nRow["FinalPayId"]          = Common.RoundDecimal(hfId.Value, 0);
        nRow["EmpID"]               = txtEmpID.Text.Trim();
        nRow["TotServiceYr"]        = lblServiceYr.Text.Trim() == "" ? "0" : lblServiceYr.Text.Trim();
        nRow["BasicPay"]            = txtBasicPay.Text.Trim() == "" ? "0" : txtBasicPay.Text.Trim();
        nRow["TotalPay"]            = txtTotalPay.Text.Trim() == "" ? "0" : txtTotalPay.Text.Trim();
        nRow["ELBalance"]           = txtELLeave.Text.Trim() == "" ? "0" : txtELLeave.Text.Trim();
        nRow["LeaveEncash"]         = txtLeaveEncash.Text.Trim() == "" ? "0" : txtLeaveEncash.Text.Trim();
        nRow["PF"]                  = txtPF.Text.Trim() == "" ? "0" : txtPF.Text.Trim();
        nRow["Gratuity"]            = txtGratuity.Text.Trim() == "" ? "0" : txtGratuity.Text.Trim();
        nRow["LastMonthSalary"]     = txtLastMonthSalary.Text.Trim() == "" ? "0" : txtLastMonthSalary.Text.Trim();
        nRow["SeperateMonthSalary"] = txtSeperateMonthSal.Text.Trim() == "" ? "0" : txtSeperateMonthSal.Text.Trim();
        nRow["TripAdvPay"]          = txtTripAdvPay.Text.Trim() == "" ? "0" : txtTripAdvPay.Text.Trim();
        nRow["AlreadyPay"]          = txtAlreadyPay.Text.Trim() == "" ? "0" : txtAlreadyPay.Text.Trim();
        nRow["OtherPay"]            = txtOtherPay.Text.Trim() == "" ? "0" : txtOtherPay.Text.Trim();
        nRow["PFLoan"]              = txtPFLoan.Text.Trim() == "" ? "0" : txtPFLoan.Text.Trim();
        nRow["Other"]               = txtOther.Text.Trim() == "" ? "0" : txtOther.Text.Trim();
        nRow["NetPay"]              = txtNetPay.Text.Trim() == "" ? "0" : txtNetPay.Text.Trim();
        nRow["SeparateDate"]        = Common.ReturnDate(lblSeprateDate.Text.Trim());
        nRow["SeparateDay"]         = lblSalaryDays.Text.Trim() == "" ? "0" : lblSalaryDays.Text.Trim();
        nRow["ProcessDate"]         = Common.ReturnDate(txtProcessDate.Text.Trim());
        nRow["Remarks"]             = txtRemarks.Text.ToString().Trim();
        nRow["PayStatus"]           = "P";
        if (cmdType == "I")
        {
            nRow["InsertedBy"]   = Session["USERID"].ToString().Trim();
            nRow["InsertedDate"] = DateTime.Now;
        }
        else if (cmdType == "U")
        {
            nRow["UpdatedBy"]   = Session["USERID"].ToString().Trim();
            nRow["UpdatedDate"] = DateTime.Now;
        }
        dtMst.Rows.Add(nRow);
        dtMst.AcceptChanges();

        try
        {
            objPayMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType);
            lblMsg.Text = Common.GetMessage(cmdType);
            Common.EmptyTextBoxValues(this);
            this.EntryMode(false);
            this.OpenRecord();
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.ToString();
        }
    }