예제 #1
0
        protected void gvListExam_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var lblListExamNumberNo = (Label)e.Row.FindControl("lblListExamNumberNo");

                var LBUP   = (LinkButton)e.Row.FindControl("LBUP");
                var LBDown = (LinkButton)e.Row.FindControl("LBDown");
                var list   = ListApplicant.FirstOrDefault(x => x.ExamNumber == lblListExamNumberNo.Text);
                if (list != null)
                {
                    if (ListApplicant.Count == 1)
                    {
                        LBDown.Visible = false;
                        LBUP.Visible   = false;
                    }
                    else if (e.Row.RowIndex == 0)
                    {
                        LBUP.Visible = false;
                    }
                    else if (e.Row.RowIndex == ListApplicant.Count - 1)
                    {
                        LBDown.Visible = false;
                    }
                }
            }
        }
예제 #2
0
        protected void lnkListExamRegister_Click(object sender, EventArgs e)
        {
            var gr         = (GridViewRow)((LinkButton)sender).NamingContainer;
            var ExamNumber = (Label)gr.FindControl("lblListExamNumberNo");

            ListApplicant.Remove(ListApplicant.Find(x => x.ExamNumber == ExamNumber.Text));
            gvListExam.DataSource = ListApplicant;
            gvListExam.DataBind();
        }
예제 #3
0
        public List <DTO.AddApplicant> SortApplicant(int CurrentIndex, String Mode)
        {
            for (int i = 0; i < ListApplicant.Count; i++)
            {
                ListApplicant[i].RUN_NO = (i + 1).ToString();
            }
            if (Mode.Equals("Up"))
            {
                //Get Current & Previous Data
                AddApplicant cur = ListApplicant[CurrentIndex];
                AddApplicant pre = ListApplicant[CurrentIndex - 1];

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

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

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

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

            return(ListApplicant.OrderBy(idx => idx.RUN_NO).ToList());
        }
예제 #4
0
        protected void btnDetailSubmit_Click(object sender, EventArgs e)
        {
            var arrComp = ddlCompanyCode.SelectedValue.Split('[', ']');

            if (ddlCompanyCode.Visible == true)
            {
                if (ddlCompanyCode.SelectedValue == "0")
                {
                    UCModalError1.ShowMessageError = "กรุณาเลือกรหัสบริษัทประกันภัย";
                    UCModalError1.ShowModalError();
                    ModSingleApplicant.Show();
                }
                else
                {
                    ListApplicant.Add(new DTO.AddApplicant
                    {
                        ExamNumber      = Session["ExamNumber"].ToString(),
                        ExamDate        = (Convert.ToDateTime(Session["ExamDate"])),
                        ExamTime        = Session["ExamTime"].ToString(),
                        ExamPlaceGroup  = Session["ExamPlaceGroup"].ToString(),
                        ExamPlace       = Session["ExamPlace"].ToString(),
                        Province        = Session["Province"].ToString(),
                        Seat            = Session["Seat"].ToString(),
                        LicenseTypeName = Session["LicenseTypeName"].ToString(),
                        ExamFee         = Session["ExamFee"].ToString(),
                        AgentType       = Session["AgentType"].ToString(),
                        ExamPlaceCode   = Session["PlaceCode"].ToString(),
                        InSurCompCode   = arrComp[1],
                        TestTimeCode    = Session["TestTimeCode"].ToString(),
                        ApplyDate       = DateTime.Now
                    });

                    gvListExam.DataSource = ListApplicant;
                    gvListExam.DataBind();

                    ModSingleApplicant.Hide();
                    ModalListExam.Show();
                }
            }
            else
            {
                ListApplicant.Add(new DTO.AddApplicant
                {
                    ExamNumber      = Session["ExamNumber"].ToString(),
                    ExamDate        = (Convert.ToDateTime(Session["ExamDate"])),
                    ExamTime        = Session["ExamTime"].ToString(),
                    ExamPlaceGroup  = Session["ExamPlaceGroup"].ToString(),
                    ExamPlace       = Session["ExamPlace"].ToString(),
                    Province        = Session["Province"].ToString(),
                    Seat            = Session["Seat"].ToString(),
                    LicenseTypeName = Session["LicenseTypeName"].ToString(),
                    ExamFee         = Session["ExamFee"].ToString(),
                    AgentType       = Session["AgentType"].ToString(),
                    ExamPlaceCode   = Session["PlaceCode"].ToString(),
                    TestTimeCode    = Session["TestTimeCode"].ToString(),
                    ApplyDate       = DateTime.Now
                });
                gvListExam.DataSource = ListApplicant;
                gvListExam.DataBind();

                ModSingleApplicant.Hide();
                ModalListExam.Show();
            }
        }
예제 #5
0
        // ทุกๆครั้งที่เลือกรายการสอบแบบปฏิทิน
        protected void lnkExamNumber_Click(object sender, EventArgs e)
        {
            var gr                    = (GridViewRow)((LinkButton)sender).NamingContainer;
            var strPlaceCode          = (Label)gr.FindControl("lblPlaceCode");
            var lblExamNumber         = (Label)gr.FindControl("ExamNumberNo");
            var lblExamDate           = (Label)gr.FindControl("lblExamDate");
            var lblExamTime           = (Label)gr.FindControl("lblExamTime");
            var lblExamPlaceGroup     = (Label)gr.FindControl("lblGroupExamYard");
            var lblExamPlace          = (Label)gr.FindControl("lblPlaceName");
            var lblProvince           = (Label)gr.FindControl("lblProvice");
            var lblSeat               = (Label)gr.FindControl("lblExamAdmission");
            var lblLicenseTypeName    = (Label)gr.FindControl("lblLicenseTypeName");
            var lblExamFee            = (Label)gr.FindControl("lblExamFee");
            var lblAgentType          = (Label)gr.FindControl("lblAgentType");
            var lblPlaceCode          = (Label)gr.FindControl("lblPlaceCode");
            var lblTestTimeCode       = (Label)gr.FindControl("lblTestTimeCode");
            var lblLicenseTypeCode    = (Label)gr.FindControl("lblLicenseTypeCode");
            var lblProvineCode        = (Label)gr.FindControl("lblProvinceCode");
            var lblExamPlaceGroupCode = (Label)gr.FindControl("lblExamPlaceGroupCode");
            var lblExamOwnerName      = (Label)gr.FindControl("lblExamOwnerName");

            if (ListApplicant.Find(x => x.ExamDate == Convert.ToDateTime(lblExamDate.Text) && x.ExamTime == lblExamTime.Text) != null)
            {
                UCModalError1.ShowMessageError = "ได้มีการสมัครในวันและเวลาสอบนี้แล้วไม่สามารถสมัครสอบได้ กรุณาทำการสมัครสอบในวันพรุ่งนี้";
                UCModalError1.ShowModalError();
            }
            else if (ListApplicant.Find(x => x.ExamNumber == lblExamNumber.Text) == null)
            {
                txtDetailExamCode.Text        = lblExamNumber.Text;
                txtDetailDateExam.Text        = lblExamDate.Text;
                txtTestTime.Text              = lblExamTime.Text;
                txtExamPlaceName.Text         = lblExamPlaceGroup.Text;
                txtProvincePopup.Text         = lblProvince.Text;
                txtLicenseTypeName.Text       = lblLicenseTypeName.Text;
                txtDetailPlaceCode.Text       = lblExamPlace.Text;
                txtExamOwner.Text             = lblExamOwnerName.Text;
                Session["ExamNumber"]         = lblExamNumber.Text;
                Session["ExamDate"]           = lblExamDate.Text;
                Session["ExamTime"]           = lblExamTime.Text;
                Session["ExamPlaceGroup"]     = lblExamPlaceGroup.Text;
                Session["ExamPlace"]          = lblExamPlace.Text;
                Session["Province"]           = lblProvince.Text;
                Session["Seat"]               = lblSeat.Text;
                Session["LicenseTypeName"]    = lblLicenseTypeName.Text;
                Session["ExamFee"]            = lblExamFee.Text;
                Session["AgentType"]          = lblAgentType.Text;
                Session["PlaceCode"]          = lblPlaceCode.Text;
                Session["ExamPlaceCode"]      = strPlaceCode.Text;
                Session["TestingNo"]          = lblExamNumber.Text;
                Session["TestingDate"]        = lblExamDate.Text;
                Session["TestTimeCode"]       = lblTestTimeCode.Text;
                Session["LicenseTypeCode"]    = lblLicenseTypeCode.Text;
                Session["ProvinceCode"]       = lblProvineCode.Text;
                Session["ExamPlaceGroupCode"] = lblExamPlaceGroupCode.Text;

                var list = new List <DTO.ApplicantTemp>();
                list.Add(new ApplicantTemp()
                {
                    APPLICANT_CODE  = 0,
                    TESTING_NO      = lblExamNumber.Text,
                    TESTING_DATE    = Convert.ToDateTime(lblExamDate.Text),
                    EXAM_PLACE_CODE = lblPlaceCode.Text,
                    APPLY_DATE      = DateTime.Today,
                    USER_ID         = UserProfile.Id,
                    ID_CARD_NO      = UserProfile.IdCard
                });

                DateTime     dtTestingDate      = Convert.ToDateTime(lblExamDate.Text);
                ApplicantBiz biz                = new ApplicantBiz();
                DTO.ResultValidateApplicant res = biz.ValidateApplicantBeforeSaveList(lblExamNumber.Text, UserProfile.IdCard, dtTestingDate, lblTestTimeCode.Text, strPlaceCode.Text, lblExamTime.Text, ListApplicant);

                if (res.IsConfirm)
                {
                    ModalPopupExtenderListExam.Show();
                    lblConfirmExam.Text = res.ValidateMessage;
                    return;
                }

                if (!res.IsCanExam)
                {
                    UCModalError1.ShowMessageError = res.ValidateMessage;
                    UCModalError1.ShowModalError();
                    return;
                }

                var checkBeforeSubmit = biz.GeneralValidateApplicantSingleBeforeSubmit(list);
                if (checkBeforeSubmit.ResultMessage == true)
                {
                    UCModalError1.ShowMessageError = "สมัครสอบซ้ำ";
                    UCModalError1.ShowModalError();
                }
                else
                {
                    if (ddlTypeLicense.SelectedValue == "03" || ddlTypeLicense.SelectedValue == "04" || ddlTypeLicense.SelectedValue == "11" || ddlTypeLicense.SelectedValue == "12")
                    {
                        lblDetailCompanyCode.Visible = false;
                        ddlCompanyCode.Visible       = false;
                    }
                    else
                    {
                        lblDetailCompanyCode.Visible = true;
                        ddlCompanyCode.Visible       = true;
                        GetCompany(ddlTypeLicense.SelectedValue);
                    }
                    ModSingleApplicant.Show();
                }
            }
            else
            {
                ModalListExam.Show();
                UCModalError1.ShowMessageError = "รอบสอบนี้คุณได้เลือกเข้าไปในรายการแล้ว";
                UCModalError1.ShowModalError();
            }
        }