Exemplo n.º 1
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        if (HiddeniD.Value == "")
        {
            DisplayMessage("Edit The Record");
            DdlMonthList.Focus();
            return;
        }

        int    count  = 0;
        string Status = "";

        if (RbtnApproved.Checked == true)
        {
            count  = 1;
            Status = "Approved";
        }
        if (RbtnCancelled.Checked == true)
        {
            count  = 1;
            Status = "Cancelled";
        }

        if (count == 0)
        {
            DisplayMessage("Select RadioButton");
            RbtnApproved.Focus();
            Status = "";
            return;
        }

        int UpdationCheck = 0;

        UpdationCheck = ObjClaim.UpdateRecord_In_Pay_Employee_Claim(Session["CompId"].ToString(), HiddeniD.Value, TxtClaimNameList.Text, TxtClaimDiscList.Text, DdlvalueTypelist.SelectedValue, Txtvaluelist.Text, DdlMonthListPanel.SelectedValue, TxtpanelYearList.Text, Status, Session["UserId"].ToString(), DateTime.Now.ToString());

        if (UpdationCheck != 0)
        {
            DisplayMessage("Record Updated");
            DataTable dtGrid = new DataTable();
            dtGrid = ObjClaim.GetRecord_From_PayEmployeeClaim(Session["CompId"].ToString(), "0", "0", DdlMonthList.SelectedValue, TxtYear.Text, "Pending", "", "");
            GridViewClaimList.DataSource = dtGrid;
            GridViewClaimList.DataBind();
            PanelUpdateClaim.Visible = false;
            ResetPanel();
            DdlMonthList.Focus();
        }
        else
        {
            DisplayMessage("Record Not Updated");
        }
    }
    protected void btnEdit_command(object sender, CommandEventArgs e)
    {
        pnlBackGroud.Visible  = true;
        pnlLoanDetail.Visible = true;
        RbtnApproved.Focus();
        HiddeniD.Value = e.CommandArgument.ToString();
        DataTable Dt = new DataTable();

        Dt = ObjLoan.GetRecord_From_PayEmployeeLoan_usingLoanId(strCompId, HiddeniD.Value, "Pending");
        if (Dt.Rows.Count > 0)
        {
            txtPopUpEmployee.Text   = Dt.Rows[0]["Emp_Name"].ToString();
            txtPopUpLoanName.Text   = Dt.Rows[0]["Loan_Name"].ToString();
            txtPopupLoanAmount.Text = Dt.Rows[0]["Loan_Amount"].ToString();
        }
        RbtnApproved.Checked  = false;
        RbtnCancelled.Checked = false;
        txtDuration.ReadOnly  = true;
        txtInterest.ReadOnly  = true;
    }
    protected void btn_PopUp_Save_Click(object sender, EventArgs e)
    {
        int UpdationCheck     = 0;
        int checkedRadioClick = 0;

        if (RbtnApproved.Checked == true)
        {
            if (txtInterest.Text == "")
            {
                DisplayMessage("Enter Interest");
                txtInterest.Focus();
                return;
            }
            if (txtDuration.Text == "")
            {
                DisplayMessage("Enter Duration");
                txtDuration.Focus();
                return;
            }
            if (txtGrossAmount.Text == "")
            {
                DisplayMessage("Press Tab Key for GrossAmount");
                txtDuration.Focus();
                return;
            }


            checkedRadioClick = 1;
            UpdationCheck     = ObjLoan.UpdateRecord_In_Pay_Employee_Loan(strCompId, HiddeniD.Value, DateTime.Now.ToString(), txtDuration.Text, txtInterest.Text, txtGrossAmount.Text, txtMonthlyInstallment.Text, "Running", Session["UserId"].ToString(), DateTime.Now.ToString());
            if (UpdationCheck != 0)
            {
                DisplayMessage("Record Saved");
                // Here we will write code for loan detail

                Double Intereset             = Convert.ToDouble(txtInterest.Text);
                int    Duration              = Convert.ToInt32(txtDuration.Text);
                Double LoanInstallmentAmount = Convert.ToDouble(txtMonthlyInstallment.Text);

                int CurrentMonth = Convert.ToInt32(DateTime.Now.Month);
                int CurrentYear  = Convert.ToInt32(DateTime.Now.Year);


                int i = 0;
                while (i < Duration)
                {
                    if (CurrentMonth == 12)
                    {
                        CurrentMonth = 1;
                        CurrentYear++;
                    }
                    else
                    {
                        CurrentMonth++;
                    }
                    int LoanDetailInsertion = 0;
                    LoanDetailInsertion = ObjLoan.Insert_In_Pay_Employee_LoanDetail(HiddeniD.Value, CurrentMonth.ToString(), CurrentYear.ToString(), "0", txtMonthlyInstallment.Text, txtMonthlyInstallment.Text, "0", "Pending", "", "", "", "", "", false.ToString(), DateTime.Now.ToString(), true.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString(), Session["UserId"].ToString(), DateTime.Now.ToString());
                    i++;
                }

                ResetPanel();
            }
        }
        if (RbtnCancelled.Checked == true)
        {
            checkedRadioClick = 1;
            UpdationCheck     = ObjLoan.UpdateRecord_In_Pay_Employee_Loan(strCompId, HiddeniD.Value, DateTime.Now.ToString(), "0", "0", "0", "0", "Cancelled", Session["UserId"].ToString(), DateTime.Now.ToString());
            if (UpdationCheck != 0)
            {
                DisplayMessage("Record Saved");

                ResetPanel();
            }
        }
        if (checkedRadioClick == 0)
        {
            DisplayMessage("Select RadioButton");
            RbtnApproved.Focus();
            return;
        }
        GridBind();
        btnClosePanel_Click(null, null);
    }