protected void btnPayment_Click(object sender, EventArgs e)
        {
            PaymentBiz    biz           = new PaymentBiz();
            LicenseBiz    bizLicense    = new LicenseBiz();
            string        ref1          = string.Empty;
            string        group         = string.Empty;
            string        headrequestNo = string.Empty;
            StringBuilder ChkUpload     = new StringBuilder();

            this.MasterLicense.lsLicensePayment.Clear();

            if (this.gvLicenseD.Rows.Count <= 0)
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.LicenseYNotFound;
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                this.MasterLicense.UpdatePanelLicense.Update();
            }
            else
            {
                #region Get UploadGroupNo

                for (int i = 0; i < gvLicenseD.Rows.Count; i++)
                {
                    HiddenField hf = (HiddenField)gvLicenseD.Rows[i].Cells[0].FindControl("hdfGroupUpLoadNo");

                    if (hf.Value != null)
                    {
                        //Get PersonLicenseTransaction from List
                        //var resD = this.CurrentSessionListDT.FirstOrDefault(idx => idx.UPLOAD_GROUP_NO.Equals(hf.Value));
                        var resD = this.SessionListDT.FirstOrDefault(idx => idx.UPLOAD_GROUP_NO.Equals(hf.Value));
                        if (resD != null)
                        {
                            ///Get & Set SubGroupPayment
                            this.MasterLicense.lsLicensePayment.Add(new DTO.SubGroupPayment
                            {
                                RUN_NO      = resD.RUN_NO,
                                uploadG     = resD.UPLOAD_GROUP_NO,
                                LicenseNo   = resD.LICENSE_NO,
                                RenewTime   = resD.RENEW_TIMES,
                                seqNo       = resD.SEQ_NO,
                                PaymentType = resD.PETITION_TYPE_CODE
                            });

                            this.MasterLicense.ListUploadGroupNo.Add(hf.Value);
                        }
                    }
                }
                #endregion

                #region สร้างใบสั่งจ่ายย่อย > NewCreatePayment

                DTO.ResponseService <string> res = biz.SetSubGroupSingleLicense(this.MasterLicense.lsLicensePayment.ToArray(), this.UserProfile.Id, this.UserProfile.Id, out ref1);
                if ((res.DataResponse != null) && (!res.IsError))
                {
                    this.PaymentStatus = true;
                    this.MasterLicense.UCLicenseUCLicenseModelSuccess.ShowMessageSuccess = SysMessage.CreatePaymentSuccess;
                    this.MasterLicense.UCLicenseUCLicenseModelSuccess.ShowModalSuccess();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    group = ref1;

                    ChkUpload.Append(group);
                    ChkUpload.Append(" ");
                    ChkUpload.Append(this.UserProfile.Id);

                    GetAllLicense();
                    GetLicenseY();
                    //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopup('" + group + "')", true);
                }
                else
                {
                    this.PaymentStatus = false;
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = res.ErrorMsg;
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    return;
                    //udpMain.Update();
                }

                if (this.PaymentStatus == true)
                {
                    ListPrintPayment.Add(group);
                    var resPrint = biz.UpdatePrintGroupRequestNo(ListPrintPayment.ToArray());
                    //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopup('" + group + "')", true);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopup('" + ChkUpload.ToString() + "')", true);
                }

                #endregion
            }
        }
Exemple #2
0
        protected void btnPayment_Click(object sender, EventArgs e)
        {
            PaymentBiz    biz           = new PaymentBiz();
            LicenseBiz    bizLicense    = new LicenseBiz();
            string        ref1          = string.Empty;
            string        group         = string.Empty;
            string        headrequestNo = string.Empty;
            StringBuilder ChkUpload     = new StringBuilder();

            if (this.ucLicensePaymentY.GridPayment.Rows.Count <= 0)
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.LicenseYNotFound;
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                this.MasterLicense.UpdatePanelLicense.Update();
                return;
            }
            else
            {
                #region Get UploadGroupNo

                for (int i = 0; i < ucLicensePaymentY.GridPayment.Rows.Count; i++)
                {
                    CheckBox chkDelete = (CheckBox)ucLicensePaymentY.GridPayment.Rows[i].Cells[0].FindControl("chkBxSelect");
                    if (chkDelete != null)
                    {
                        if (chkDelete.Checked)
                        {
                            HiddenField hf = (HiddenField)ucLicensePaymentY.GridPayment.Rows[i].Cells[0].FindControl("HiddenField1");

                            if (hf.Value != null)
                            {
                                //Get
                                DTO.ResponseService <DTO.PersonLicenseTransaction> resD = bizLicense.GetLicenseDetailByUploadGroupNo(hf.Value);
                                if ((resD.DataResponse != null) && (!resD.IsError))
                                {
                                    ///Get & Set SubGroupPayment
                                    var resLS = this.MasterLicense.lsLicensePayment.Where(ls => ls.uploadG == resD.DataResponse.UPLOAD_GROUP_NO).FirstOrDefault();
                                    if (resLS == null)
                                    {
                                        this.MasterLicense.lsLicensePayment.Add(new DTO.SubGroupPayment
                                        {
                                            uploadG     = resD.DataResponse.UPLOAD_GROUP_NO,
                                            LicenseNo   = resD.DataResponse.LICENSE_NO,
                                            RenewTime   = resD.DataResponse.RENEW_TIMES,
                                            seqNo       = resD.DataResponse.SEQ_NO,
                                            PaymentType = resD.DataResponse.PETITION_TYPE_CODE
                                        });

                                        this.MasterLicense.ListUploadGroupNo.Add(hf.Value);
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion

                //ตรวจสอบรายการต่อใบสั่งจ่าย @1/7/2557
                int getSumConfig = GetSumConfigViewBillPayment();
                if (this.MasterLicense.ListUploadGroupNo.Count > getSumConfig)
                {
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = "กรุณาตรวจสอบจำนวนรายการใบอนุญาตที่ต้องการออกใบสั่งจ่าย";
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    return;
                }

                #region สร้างใบสั่งจ่ายย่อย > NewCreatePayment

                DTO.ResponseService <string> res = biz.SetSubGroupSingleLicense(this.MasterLicense.lsLicensePayment.ToArray(), this.UserProfile.Id, this.UserProfile.Id, out ref1);
                if ((res.DataResponse != null) && (!res.IsError))
                {
                    this.MasterLicense.UCLicenseUCLicenseModelSuccess.ShowMessageSuccess = SysMessage.CreatePaymentSuccess;
                    this.MasterLicense.UCLicenseUCLicenseModelSuccess.ShowModalSuccess();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    group = ref1;

                    ChkUpload.Append(group);
                    ChkUpload.Append(" ");
                    ChkUpload.Append(this.UserProfile.Id);

                    //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopup('" + group + "')", true);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopup('" + ChkUpload.ToString() + "')", true);

                    this.MasterLicense.lsLicensePayment.Clear();
                    this.MasterLicense.ListUploadGroupNo.Clear();
                    this.MasterLicense.PersonLicenseD.Clear();
                    this.MasterLicense.PersonLicenseH.Clear();
                    this.GetLicenseDetail();
                }
                else
                {
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = res.ErrorMsg;
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    return;
                }
                //this.MasterLicense.lsLicensePayment.Clear();
                //this.MasterLicense.ListUploadGroupNo.Clear();
                #endregion
            }
        }