Пример #1
0
        /// <summary>
        /// Bind Paps data to grid grdPaymentRequestBatch for Selected Batch
        /// </summary>
        /// <param name="Status"></param>
        private void BindPAPS(int Status)
        {
            BatchBLL oBatchBLL = new BatchBLL();
            //Old Method
            //BatchList objBatchList = oBatchBLL.GetPaymentRequestBatch(Convert.ToInt32(ViewState["BATCH_PROJECT_ID"]), Convert.ToInt32(ViewState["CMP_BATCHNO"]));

            //New Method
            BatchList objBatchList = oBatchBLL.GetPaymentPendingBatch(Convert.ToInt32(ViewState["BATCH_PROJECT_ID"]), Convert.ToInt32(ViewState["CMP_BATCHNO"]));

            hdnPendingRequestCount.Value = "0";
            if (objBatchList.Count == 0 && Status == 1)
            {
                lblMessage.Text    = "No Batch Found.";
                lblMessage.Visible = true;
            }
            //else if (objBatchList.Count > 0 && Status == 0)
            //{
            //    lblMessage.Text = "Click on Batch";
            //    lblMessage.Visible = true;
            //}
            //else
            //{
            //    lblMessage.Text = string.Empty;
            //    lblMessage.Visible = false;
            //}
            grdPaymentRequestBatch.DataSource = objBatchList;
            grdPaymentRequestBatch.DataBind();

            bool approverDefined = checkForApprover();

            if (objBatchList.Count > 0 && approverDefined)
            {
                pnlBatchPAPS.Visible = true;
                //  lblMessage.Visible = true;
            }
            else
            {
                pnlBatchPAPS.Visible = false;
                //lblMessage.Text = "";
                //  lblMessage.Visible = true;
            }
        }
Пример #2
0
        /// <summary>
        /// Bind Data to repeater
        /// </summary>
        private void BindRepeater()
        {
            string FromData = string.Empty;
            string ToDate   = string.Empty;
            string BatchNO  = string.Empty;

            if (dpBatchFromDate.Text.ToString() != string.Empty)
            {
                FromData = dpBatchFromDate.Text.ToString();
            }
            if (dpBatchToDate.Text.ToString() != string.Empty)
            {
                ToDate = dpBatchToDate.Text.ToString();
            }
            if (txtBachNo.Text.ToString() != string.Empty)
            {
                BatchNO = txtBachNo.Text.ToString();
            }

            BatchBLL  oBatchBLL    = new BatchBLL();
            BatchList objBatchList = oBatchBLL.GetPaymentBatches(Convert.ToInt32(ViewState["BATCH_PROJECT_ID"]), BatchNO, ToDate, FromData);

            rptrBatchPayment.DataSource = objBatchList;
            rptrBatchPayment.DataBind();

            if (rptrBatchPayment.Items.Count == 0)
            {
                lblMessage.Text    = "No batch Exist.";
                lblMessage.Visible = true;
            }
            //else if (objBatchList.Count > 0)
            //{
            //    lblMessage.Text = "Click on Batch No";
            //    lblMessage.Visible = true;
            //}
            else
            {
                lblMessage.Visible = false;
            }
            clear();
        }
Пример #3
0
        /// <summary>
        /// To delete Data form the Batch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdPaymentRequestBatch_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteRow")
            {
                ViewState["PaymentRequestId"] = e.CommandArgument;

                BatchBLL oBatchBLL        = new BatchBLL();
                int      PaymentRequestId = 0;
                int      Result           = 0;
                if (ViewState["PaymentRequestId"] != null)
                {
                    PaymentRequestId = Convert.ToInt32(ViewState["PaymentRequestId"].ToString());
                }

                Result = oBatchBLL.DeletePaymentRequest(PaymentRequestId);
                string message      = "Data deleted successfully";
                string AlertMessage = "alert('" + message + "');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
                BindPAPS(1);
                BindRepeater();
            }
        }
Пример #4
0
        /// <summary>
        /// To Load Batches
        /// </summary>
        private void LoadBatches()
        {
            ListItem firstListItem = new ListItem(ddlBatchList.Items[0].Text, ddlBatchList.Items[0].Value);

            ddlBatchList.Items.Clear();

            BatchBO   oBatchBO   = new BatchBO();
            BatchBLL  oBatchBLL  = new BatchBLL();
            BatchList oBatchList = new BatchList();

            if (Session["PROJECT_ID"] != null)
            {
                oBatchList = oBatchBLL.GetBatches(Convert.ToInt32(Session["PROJECT_ID"]));
            }
            if (oBatchList != null)
            {
                ddlBatchList.DataSource     = oBatchList;
                ddlBatchList.DataTextField  = "CMP_BATCHNO";
                ddlBatchList.DataValueField = "CMP_BATCHNO";
                ddlBatchList.DataBind();
            }
            ddlBatchList.Items.Insert(0, firstListItem);
        }
Пример #5
0
        /// <summary>
        /// To Save Paymet details and Batch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddToBatch_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (ViewState["Valuation_Status"].ToString() != "Request Pending")
            {
                BatchBO oBatchBO, ooBtachBO;
                oBatchBO = new BatchBO();
                BatchBLL oBatchBLL = new BatchBLL();
                oBatchBO.CMP_BatchNo = string.Empty;
                oBatchBO.CreatedBy   = SessionUserId;
                oBatchBO.IsDeleted   = "False";
                oBatchBO.BatchStatus = "OPEN";

                oBatchBO.HHID             = SessionHHID;
                oBatchBO.RequestStatus    = BatchBLL.RequestStatus_Pending;
                oBatchBO.Payt_RequestDate = dpRequestDate.Text;

                int BatchNo = 0;
                if (rbBatch.SelectedValue == "1")
                {
                    oBatchBO.CMP_BatchNo = ddlBatchList.SelectedValue;
                    BatchNo = Convert.ToInt32(oBatchBO.CMP_BatchNo);
                }
                else //if (rbBatch.SelectedValue == "2")
                {
                    oBatchBO.CMP_BatchNo = "0";
                }

                //New Column Data
                if (txtComments.Text.Trim().Length > 500)
                {
                    oBatchBO.Comments = txtComments.Text.Trim().Substring(0, 1000);
                }
                else
                {
                    oBatchBO.Comments = txtComments.Text.Trim();
                }

                if (!string.IsNullOrEmpty(txtTotalAmount.Text))
                {
                    oBatchBO.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
                }

                oBatchBO.Payt_Description = txtPaymentFor.Text;

                if (!string.IsNullOrEmpty(txtAmountRequested.Text))
                {
                    oBatchBO.Amt_Requested = Convert.ToDecimal(txtAmountRequested.Text);
                }

                ooBtachBO = oBatchBLL.AddBatch(oBatchBO);

                if (string.IsNullOrEmpty(ooBtachBO.dbMessage) || ooBtachBO.dbMessage == "" || ooBtachBO.dbMessage == "null")
                {
                    message = string.Format("Payment Request added to Batch No. {0} successfully.", ooBtachBO.CMP_BatchNo);
                    GetPaymentStatus();
                    ClearFields();
                }
                else
                {
                    if (!string.IsNullOrEmpty(ooBtachBO.CMP_BatchNo))
                    {
                        message = ooBtachBO.dbMessage;//BatchNo + " Batch Number already Added";
                    }
                    //  message = ooBtachBO.CMP_BatchNo + " Batch Number already exists";
                    GetPaymentStatus();
                    ClearFields();
                }
                LoadBatches();
                LoadSummery();
            }
            else
            {
                message = "A payment request is pending for this PAP.";
                ClearFields();
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Пример #6
0
        /// <summary>
        /// Send request to Batch Payment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmitForPayment_Click(object sender, EventArgs e)
        {
            BatchBLL oBatchBLL = new BatchBLL();
            BatchBO  oBatchBO;

            int    HHID         = 0;
            int    ProjectID    = 0;
            string AlertMessage = string.Empty;
            string message      = string.Empty;
            int    BatchNo      = 0;
            int    userID       = Convert.ToInt32(Session["USER_ID"]);

            if (ViewState["CMP_BATCHNO"] != null)
            {
                BatchNo = Convert.ToInt32(ViewState["CMP_BATCHNO"].ToString());
            }
            foreach (GridViewRow grvRow in grdPaymentRequestBatch.Rows)
            {
                CheckBox chkBoxSelected = grvRow.FindControl("chkSelect") as CheckBox;

                //if (chkBoxSelected.Checked)
                //{
                //oBatchBO.Payt_RequestID = Convert.ToInt32((grvRow.FindControl("litPaymentReqID") as Literal).ToString());
                int payemntRequestId = Convert.ToInt32((grvRow.FindControl("lblPaymentRequestId") as Label).Text);

                oBatchBO = new BatchBO();
                oBatchBO.Payt_RequestID = payemntRequestId;
                oBatchBO.RequestStatus  = BatchBLL.RequestStatus_Submitted;
                oBatchBO.UpdatedBy      = userID;
                if (grvRow.FindControl("lblHHID") is Label)
                {
                    HHID = Convert.ToInt32((grvRow.FindControl("lblHHID") as Label).Text);
                }
                oBatchBO.StausLevel = Convert.ToInt32(UtilBO.BatchPaymentStatus);
                message             = oBatchBLL.UpdatePaymentSubmit(oBatchBO);
                //}
            }

            if (!string.IsNullOrEmpty(message))
            {
                AlertMessage = "alert('" + message + "');";
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
                //after Closing Email popup in datagrid status is change to submited.
                BindPAPS(1);

                //SENDING MAIL
                //int userID = Convert.ToInt32(Session["USER_ID"]);
                ProjectID = Convert.ToInt32(ViewState["BATCH_PROJECT_ID"]);

                if (Session["HH_ID"] != null)
                {
                    HHID = Convert.ToInt32(Session["HH_ID"]);
                }

                //Taking HHID From this LOOP
                //foreach (GridViewRow grvRow in grdPaymentRequestBatch.Rows)
                //{
                //    CheckBox chkBoxSelected = grvRow.FindControl("chkSelect") as CheckBox;

                //    if (chkBoxSelected.Checked)
                //    {
                //        if(grvRow.FindControl("lblHHID") is Label)
                //            HHID = Convert.ToInt32((grvRow.FindControl("lblHHID") as Label).Text);
                //    }
                //}


                string pageCode = UtilBO.WorkflowPaymentRequest;

                string BatchRequest = string.Format("OpenChangeRequest('{0}',{1},{2},{3},'{4}',{5})", UtilBO.WorkflowPaymentRequest, ProjectID, userID, HHID, pageCode, BatchNo);

                ClientScript.RegisterStartupScript(this.GetType(), "BATCHPAYMENT", BatchRequest, true);
            }
        }