Beispiel #1
0
        protected void btnImportByIDCard_Click(object sender, EventArgs e)
        {
            string dtFromCtrl = string.Empty;
            string dtFromEnt  = string.Empty;
            string licenseNo  = string.Empty;

            if ((txtImportBirthdayHead.Text == "") || (txtImportLicenseNoHead.Text == ""))
            {
                this.MasterPage.ModelError.ShowMessageError = "กรุณาระบุวันเกิดและเลขที่ใบอนุญาต";
                this.MasterPage.ModelError.ShowModalError();
                return;
            }
            else
            {
                //BirthDay validate
                dtFromCtrl = String.Format("{0:dd/MM/yyyy}", txtImportBirthdayHead.Text);
                dtFromEnt  = String.Format("{0:dd/MM/yyyy}", DTO.PersonalT.per.BIRTH_DATE);

                //License validate
                List <DTO.PersonLicenseTransaction> lsLicense = this.MasterPage.CompareCurrentLicense(DTO.PersonalT.per.ID_CARD_NO);
                if (lsLicense.Count > 0)
                {
                    this.MasterPage.CurrentLicenseByIDCard = lsLicense;
                    DTO.PersonLicenseTransaction cur = lsLicense.FirstOrDefault(lic => lic.LICENSE_NO == txtImportLicenseNoHead.Text);
                    if (cur != null)
                    {
                        licenseNo = this.MasterPage.NullableString(cur.LICENSE_NO);
                    }
                }

                if (dtFromCtrl.Equals(dtFromEnt) && (licenseNo == txtImportLicenseNoHead.Text))
                {
                    GetPersonalDataToControl(DTO.PersonalT.per);
                    this.MasterPage.SetCurrentLicense(this.ucCurrentLicense);
                    UpdatePanelUpload.Update();
                    this.MasterPage.UpdatePanelMaster.Update();
                    this.MasterPage.ImportStatus = "Y";


                    //Disable Control
                    this.pnlIDCardValidate.Enabled = false;
                    //this.chkEnableEditName.Checked = false;
                }
                else
                {
                    this.MasterPage.ModelError.ShowMessageError = "วันเกิดหรือเลขที่ใบอนุญาตไม่ถูกต้อง";
                    this.MasterPage.ModelError.ShowModalError();
                    return;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// GetLicenseY : Where Fee > 0 : Not show
        /// </summary>
        /// <Author>Natta</Author>
        /// <LastUpdate>30/06/2557</LastUpdate>
        private void GetLicenseY()
        {
            LicenseBiz biz = new LicenseBiz();

            DTO.ResponseService <DTO.PersonLicenseTransaction[]> resY = biz.getViewPersonLicense(this.MasterLicense.UserProfile.IdCard, "Y");
            if (resY.DataResponse != null)
            {
                List <DTO.PersonLicenseTransaction> lsPerLicenseY = new List <DTO.PersonLicenseTransaction>();
                resY.DataResponse.ToList().ForEach(lic =>
                {
                    if (lic.FEES > 0)
                    {
                        DTO.PersonLicenseTransaction ent = new DTO.PersonLicenseTransaction();
                        lic.MappingToEntity <DTO.PersonLicenseTransaction>(ent);
                        lsPerLicenseY.Add(ent);
                    }
                });

                if (resY.DataResponse.Count() <= 0)
                {
                    this.pnlSort.Enabled = false;
                    this.pnlSort.Visible = false;
                    this.pnlY.Enabled    = false;
                    this.ucLicensePaymentY.lblGvHead.Text = Resources.propLicenseCheck_LicensePaymentY;
                    //this.ucLicensePaymentY.GridPayment.DataSource = resY.DataResponse;
                    this.ucLicensePaymentY.GridPayment.DataSource = lsPerLicenseY;
                    this.ucLicensePaymentY.GridPayment.DataBind();
                }
                else if (resY.DataResponse.Count() > 0)
                {
                    this.pnlSort.Enabled = true;
                    this.pnlSort.Visible = true;
                    this.pnlY.Enabled    = true;
                    this.ucLicensePaymentY.lblGvHead.Text = Resources.propLicenseCheck_LicensePaymentY;
                    //this.ucLicensePaymentY.GridPayment.DataSource = resY.DataResponse;
                    this.ucLicensePaymentY.GridPayment.DataSource = lsPerLicenseY;
                    this.ucLicensePaymentY.GridPayment.DataBind();
                }
            }
            else if ((resY.DataResponse == null) || (resY.IsError))
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = resY.ErrorMsg;
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                this.MasterLicense.UpdatePanelLicense.Update();
            }
        }
Beispiel #3
0
        public List <DTO.PersonLicenseTransaction> SortDescriptionsDT(List <DTO.PersonLicenseTransaction> ls, int CurrentIndex, String Mode)
        {
            foreach (DTO.PersonLicenseTransaction item in ls)
            {
                var AllOrder = ls.FirstOrDefault(a => a.UPLOAD_GROUP_NO == item.UPLOAD_GROUP_NO);
                AllOrder.RUN_NO = Convert.ToString(ls.IndexOf(AllOrder) + 1);
            }

            if (Mode.Equals("Up"))
            {
                //Get Current & Previous Data
                DTO.PersonLicenseTransaction cur = ls[CurrentIndex];
                DTO.PersonLicenseTransaction pre = ls[CurrentIndex - 1];

                int order = Convert.ToInt32(cur.RUN_NO);
                cur.RUN_NO = pre.RUN_NO;
                pre.RUN_NO = Convert.ToString(order);

                //Resort
                ls[CurrentIndex]     = pre;
                ls[CurrentIndex - 1] = cur;
            }
            else if (Mode.Equals("Down"))
            {
                //Get Current & Next Data
                DTO.PersonLicenseTransaction cur  = ls[CurrentIndex];
                DTO.PersonLicenseTransaction next = ls[CurrentIndex + 1];

                int order = Convert.ToInt32(cur.RUN_NO);
                cur.RUN_NO  = next.RUN_NO;
                next.RUN_NO = Convert.ToString(order);

                //Resort
                ls[CurrentIndex]     = next;
                ls[CurrentIndex + 1] = cur;
            }

            return(ls.OrderBy(idx => idx.RUN_NO).ToList());
        }
Beispiel #4
0
        private void GetSelectedRecord()
        {
            LicenseBiz bizLicense = new LicenseBiz();

            for (int i = 0; i < gvPayment.Rows.Count; i++)
            {
                CheckBox rb = (CheckBox)gvPayment.Rows[i].Cells[0].FindControl("chkSelect");

                if (rb != null)
                {
                    HiddenField hf = (HiddenField)gvPayment.Rows[i].Cells[0].FindControl("HiddenField1");

                    if (rb.Checked)
                    {
                        //HiddenField hf = (HiddenField)gvPayment.Rows[i].Cells[0].FindControl("HiddenField1");
                        if (hf != null)
                        {
                            this.MasterLicense.SelectedUploadGroupNo = hf.Value;

                            if (this.MasterLicense.lsLicensePayment.Count > 0)
                            {
                                DTO.ResponseService <DTO.PersonLicenseTransaction[]> resLicense = bizLicense.getViewPersonLicense(this.MasterLicense.UserProfile.IdCard, "A");
                                if (resLicense.DataResponse != null)
                                {
                                    DTO.PersonLicenseTransaction licenseD = resLicense.DataResponse.Where(gno => gno.UPLOAD_GROUP_NO == hf.Value).FirstOrDefault();
                                    if (licenseD != null)
                                    {
                                        ///Get & Set SubGroupPayment
                                        this.MasterLicense.lsLicensePayment.Add(new DTO.SubGroupPayment
                                        {
                                            uploadG     = licenseD.UPLOAD_GROUP_NO,
                                            LicenseNo   = licenseD.LICENSE_NO,
                                            RenewTime   = licenseD.RENEW_TIMES,
                                            seqNo       = licenseD.SEQ_NO,
                                            PaymentType = licenseD.PETITION_TYPE_CODE
                                        });
                                    }
                                }
                            }
                            else
                            {
                                DTO.ResponseService <DTO.PersonLicenseTransaction[]> resLicense = bizLicense.getViewPersonLicense(this.MasterLicense.UserProfile.IdCard, "A");
                                if (resLicense.DataResponse != null)
                                {
                                    DTO.PersonLicenseTransaction licenseD = resLicense.DataResponse.Where(gno => gno.UPLOAD_GROUP_NO == hf.Value).FirstOrDefault();
                                    if (licenseD != null)
                                    {
                                        ///Get & Set SubGroupPayment
                                        this.MasterLicense.lsLicensePayment.Add(new DTO.SubGroupPayment
                                        {
                                            uploadG     = licenseD.UPLOAD_GROUP_NO,
                                            LicenseNo   = licenseD.LICENSE_NO,
                                            RenewTime   = licenseD.RENEW_TIMES,
                                            seqNo       = licenseD.SEQ_NO,
                                            PaymentType = licenseD.PETITION_TYPE_CODE
                                        });
                                    }
                                }

                                //this.MasterLicense.ListUploadGroupNo.Add(this.MasterLicense.SelectedUploadGroupNo);
                            }
                            //this.MasterLicense.ListUploadGroupNo.Add(this.MasterLicense.SelectedUploadGroupNo);
                        }
                        break;
                    }
                    else
                    {
                        //HiddenField hf = (HiddenField)gvPayment.Rows[i].Cells[0].FindControl("HiddenField1");
                        if (hf != null)
                        {
                            this.MasterLicense.SelectedUploadGroupNo = hf.Value;
                            this.MasterLicense.ListUploadGroupNo.Remove(this.MasterLicense.SelectedUploadGroupNo);
                        }
                        break;
                    }
                }
            }
        }