Exemplo n.º 1
0
        private void ValidateBeforeSubmit()
        {
            DTO.ResponseService <DTO.SummaryReceiveApplicant> res = new DTO.ResponseService <DTO.SummaryReceiveApplicant>();
            res.DataResponse = (DTO.SummaryReceiveApplicant)Session["SummaryReceiveApplicant"];
            List <DTO.ApplicantTemp> lst = new List <ApplicantTemp>();

            res.DataResponse.ReceiveApplicantDetails.ToList().ForEach(x =>
            {
                DTO.ApplicantTemp app = new ApplicantTemp();
                app.APPLICANT_CODE    = x.APPLICANT_CODE;
                app.TESTING_NO        = x.TESTING_NO;
                app.TESTING_DATE      = x.TESTING_DATE;
                app.EXAM_PLACE_CODE   = x.EXAM_PLACE_CODE;
                app.APPLY_DATE        = DateTime.Today;
                app.INSUR_COMP_CODE   = x.INSUR_COMP_CODE;
                app.USER_ID           = base.UserId;
                app.ID_CARD_NO        = base.IdCard;
                app.APPLY_DATE        = x.APPLY_DATE;
                //app.RUN_NO = Convert.ToString(x + 1);
                lst.Add(app);
            });
            ApplicantBiz biz = new ApplicantBiz();
            var          checkBeforeSubmit = biz.ValidateApplicantSingleBeforeSubmit(lst);

            if (checkBeforeSubmit.ResultMessage == true)
            {
                ModalPopupExtenderListExam.Show();
            }
            else
            {
                ImportInsertMode();
            }
        }
Exemplo n.º 2
0
 protected void btnGetOut_Click(object sender, EventArgs e)
 {
     try
     {
         if (Manage_App.ToArray().Count() > 0)
         {
             BLL.ApplicantBiz abiz = new ApplicantBiz();
             var res = abiz.CancleExamApplicantManage(Manage_App.ToArray(), selectRoom.Text);
             if (res.ResultMessage == false)
             {
                 UCModalError.ShowMessageError = res.ErrorMsg;
                 UCModalError.ShowModalError();
             }
             else
             {
                 ClickView("");
                 UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                 UCModalSuccess.ShowModalSuccess();
             }
             Manage_App = null;
             UpdatePanelSearch.Update();
         }
         else
         {
             UCModalError.ShowMessageError = "กรุณาเลือกผู้สมัครสอบก่อนทำรายการ";
             UCModalError.ShowModalError();
         }
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
        private bool ValidateBeforeSaveList()
        {
            string   strPlaceCode       = Session["ExamPlaceCode"].ToString();
            string   strExamNumber      = Session["TestingNo"].ToString();
            string   strLicenseTypeCode = Session["LicenseTypeCode"].ToString();
            string   strTestTimeCode    = Session["TestTimeCode"].ToString();
            DateTime dtTestingDate      = Convert.ToDateTime(Session["TestingDate"].ToString());


            bool         check      = true;
            ApplicantBiz abiz       = new ApplicantBiz();
            var          checkIsDup = abiz.CheckApplicantIsDuplicate(txtExamNumber.Text, base.UserProfile.IdCard, dtTestingDate, strTestTimeCode, strPlaceCode);

            // สอบซ้ำ
            if (checkIsDup.ResultMessage == true)
            {
                this.MasterSite.ModelError.ShowMessageError = "ทำรายการสอบซ้ำ";
                this.MasterSite.ModelError.ShowModalError();
                return(check = false);
            }


            ExamScheduleBiz ebiz = new ExamScheduleBiz();

            DTO.ResponseMessage <bool> IsCanSeat = ebiz.IsCanSeatRemainSingle(strExamNumber, strPlaceCode);

            // จำนวนคนเกินรอบสอบ
            if (!IsCanSeat.ResultMessage)
            {
                this.MasterSite.ModelError.ShowMessageError = "ห้องเต็ม";
                this.MasterSite.ModelError.ShowModalError();
                return(check = false);
            }
            return(check);
        }
Exemplo n.º 4
0
 protected void btnAddIn_Click(object sender, EventArgs e)
 {
     try
     {
         if (Manage_App.ToArray().Count() > 0)
         {
             BLL.ApplicantBiz abiz = new ApplicantBiz();
             var res = abiz.SaveExamAppRoom(Manage_App.ToArray(), ddlroom.Text, selectRoom.Text, "", false, base.UserId);
             if (res.ResultMessage)//save OK
             {
                 ClickView(selectRoom.Text);
                 UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                 UCModalSuccess.ShowModalSuccess();
             }
             else
             {
                 UCModalError.ShowMessageError = res.ErrorMsg;
                 UCModalError.ShowModalError();
             }
             Manage_App = null;
             UpdatePanelSearch.Update();
         }
         else
         {
             UCModalError.ShowMessageError = "กรุณาเลือกผู้สมัครสอบก่อนทำรายการ";
             UCModalError.ShowModalError();
         }
     }
     catch
     {
     }
 }
Exemplo n.º 5
0
 private void GetExamPlace()
 {
     try
     {
         BLL.ApplicantBiz appB = new ApplicantBiz();
         var res = appB.GetExamPlaceByLicenseAndOwner(ddlAsso.SelectedValue.ToString(), ddlLicenseType.SelectedValue.ToString());
         ddlPlaceName.DataValueField = "ID";
         ddlPlaceName.DataTextField  = "NAME";
         ddlPlaceName.DataSource     = res.DataResponse;
         ddlPlaceName.DataBind();
         ddlPlaceName.Items.Insert(0, SysMessage.DefaultSelecting);
     }
     catch
     {
     }
 }
Exemplo n.º 6
0
        private void GetRoom()
        {
            try
            {
                string PlaceName = "%";
                if ((ddlPlaceName.SelectedValue.ToString() != "เลือก") && (ddlPlaceName.SelectedValue.ToString() != ""))
                {
                    PlaceName = ddlPlaceName.SelectedValue.ToString();
                }

                BLL.ApplicantBiz abiz = new ApplicantBiz();
                var res = abiz.GetExamRoomByTestingNoforManage(selectRoom.Text, PlaceName);
                ddlroom.DataValueField = "Id";
                ddlroom.DataTextField  = "Name";
                ddlroom.DataSource     = res.DataResponse;
                ddlroom.DataBind();
            }
            catch
            {
            }
        }
Exemplo n.º 7
0
        protected void BindDataInGridView2(Boolean count)
        {
            try
            {
                PAGE_SIZE = PAGE_SIZE_Key;
                BLL.ApplicantBiz Abiz = new ApplicantBiz();

                #region page
                int Rpage      = (txtNumberGvSearch2.Text.Trim() == "") ? 0 : txtNumberGvSearch2.Text.Trim().ToInt();
                int resultPage = (Rpage == 0) ? 1 : txtNumberGvSearch2.Text.Trim().ToInt();

                resultPage = resultPage == 0 ? 1 : resultPage;
                if ((rowPerpage2.Text.Trim() == null) || (rowPerpage2.Text.Trim() == "") || (rowPerpage2.Text.ToInt() == 0))
                {
                    rowPerpage2.Text = PAGE_SIZE.ToString();
                }
                else
                {
                    PAGE_SIZE = Convert.ToInt32(rowPerpage2.Text);
                }
                #endregion page

                string ConSQL = ddlEvent.SelectedValue.ToString() == "in"?"":"out";

                if (count)
                {
                    #region Page
                    var CountPage = Abiz.GetApplicantFromTestingNoForManageApplicant(selectRoom.Text, ConSQL, resultPage, PAGE_SIZE, true);


                    if (CountPage.DataResponse != null)
                    {
                        if (CountPage.DataResponse.Tables[0].Rows.Count > 0)
                        {
                            Int32 totalROWs = Convert.ToInt32(CountPage.DataResponse.Tables[0].Rows[0]["CCount"].ToString());

                            VisibleGV(gvSearch2, totalROWs, Convert.ToInt32(rowPerpage2.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch2, txtNumberGvSearch2, btnNextGvSearch2, "", txtTotalPage2);
                            }
                        }
                        else
                        {
                            VisibleGV(gvSearch2, 0, Convert.ToInt32(rowPerpage2.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch2, txtNumberGvSearch2, btnNextGvSearch2, "", txtTotalPage2);
                            }
                            txtTotalPage2.Text = "1";
                        }
                    }
                    #endregion Page
                }

                var res = Abiz.GetApplicantFromTestingNoForManageApplicant(selectRoom.Text, ConSQL, resultPage, PAGE_SIZE, false);
                if (res.IsError)
                {
                    btnNextGvSearch2.Visible     = false;
                    btnPreviousGvSearch2.Visible = false;
                    txtNumberGvSearch2.Visible   = false;
                    txtTotalPage2.Visible        = false;
                    TXTrowperpage2.Visible       = false;
                    lblParaPage2.Visible         = false;
                    rowPerpage2.Visible          = false;
                    pageGo2.Visible               = false;
                    manageApp.Visible             = false;
                    divAddIn.Visible              = false;
                    divGetOut.Visible             = false;
                    div_totalPage2.Visible        = false;
                    UCModalError.ShowMessageError = res.ErrorMsg;
                    UCModalError.ShowModalError();
                }
                else
                {
                    if (res != null)
                    {
                        if (res.DataResponse.Tables[0].Rows.Count > 0)
                        {
                            btnPreviousGvSearch2.Enabled = true;
                            btnNextGvSearch2.Enabled     = true;

                            #region ManageRoom
                            manageApp.Visible = true;
                            if (ddlEvent.SelectedValue.ToString() == "in")
                            {
                                divAddIn.Visible  = true;
                                divGetOut.Visible = false;
                                btnAddIn.Visible  = true;
                                btnGetOut.Visible = false;
                            }
                            else
                            {
                                divAddIn.Visible  = false;
                                divGetOut.Visible = true;
                                btnAddIn.Visible  = false;
                                btnGetOut.Visible = true;
                            }
                            #endregion ManageRoom
                        }
                        else
                        {
                            btnPreviousGvSearch2.Enabled = false;
                            btnNextGvSearch2.Enabled     = false;
                            divAddIn.Visible             = false;
                            divGetOut.Visible            = false;
                        }
                        txtNumberGvSearch2.Enabled = false;
                        gvSearch2.DataSource       = res.DataResponse;
                        gvSearch2.DataBind();
                        gvSearch2.Visible = true;
                    }
                }
                UpdatePanelSearch.Update();
            }
            catch
            {
            }
        }
Exemplo n.º 8
0
        private void SaveListExam()
        {
            string       group     = string.Empty;
            ApplicantBiz biz       = new ApplicantBiz();
            string       strAmount = biz.GetQuantityBillPerPageByConfig();

            if (ListApplicant.Count != 0 && ListApplicant.Count <= Convert.ToInt32(strAmount))
            {
                List <DTO.ApplicantTemp> lst = new List <ApplicantTemp>();
                for (int i = 0; i < ListApplicant.Count; i++)
                {
                    DTO.ApplicantTemp app = new ApplicantTemp();
                    app.TESTING_NO      = ListApplicant[i].ExamNumber;
                    app.TESTING_DATE    = ListApplicant[i].ExamDate;
                    app.EXAM_PLACE_CODE = ListApplicant[i].ExamPlaceCode;
                    app.APPLY_DATE      = DateTime.Today;
                    app.INSUR_COMP_CODE = ListApplicant[i].InSurCompCode;
                    app.USER_ID         = UserProfile.Id;     // base.UserId;  140324110012352
                    app.ID_CARD_NO      = UserProfile.IdCard; // base.IdCard;    4199682095940
                    app.APPLY_DATE      = ListApplicant[i].ApplyDate;
                    app.TEST_TIME_CODE  = ListApplicant[i].TestTimeCode;


                    app.RUN_NO = Convert.ToString(i + 1);
                    lst.Add(app);
                }
                string passGroup = string.Empty;

                //Check
                // var checkBeforeSubmit = biz.GeneralValidateApplicantSingleBeforeSubmit(lst);
                //if (checkBeforeSubmit.ResultMessage == true)
                //{
                //    UCModalError1.ShowMessageError = "รอบสอบที่คุณเลือกในรายการมีรายการที่คุณได้สมัครสอบแล้ว";
                //    UCModalError1.ShowModalError();
                //}
                //
                //else
                //{
                var res = biz.InsertSingleApplicant(lst, base.UserId);
                if (res.IsError)
                {
                    UCModalError1.ShowMessageError = res.ErrorMsg;
                    UCModalError1.ShowModalError();
                }
                else
                {
                    ListApplicant = new List <AddApplicant>();
                    this.ModalListExam.Hide();
                    Session["lstApplicant"]            = null;
                    UCModalSuccess1.ShowMessageSuccess = SysMessage.SuccessInsertApplicant;
                    UCModalSuccess1.ShowModalSuccess();
                    group     = res.DataResponse;
                    passGroup = group + " " + base.UserId;

                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopupSingle('" + passGroup + "')", true);
                }
                //}
            }
            else
            {
                UCModalError1.ShowMessageError = "กรุณาตรวจสอบจำนวนรายการที่สอบ";
                UCModalError1.ShowModalError();
                ModalListExam.Show();
            }
        }
Exemplo n.º 9
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();
            }
        }
Exemplo n.º 10
0
        protected void BindData(Boolean Count)
        {
            try
            {
                #region page
                int Rpage      = (txtNumberGvSearch.Text.Trim() == "") ? 0 : txtNumberGvSearch.Text.Trim().ToInt();
                int resultPage = (Rpage == 0) ? 1 : txtNumberGvSearch.Text.Trim().ToInt();

                resultPage = resultPage == 0 ? 1 : resultPage;
                if ((rowPerpage.Text.Trim() == null) || (rowPerpage.Text.Trim() == "") || (rowPerpage.Text.ToInt() == 0))
                {
                    rowPerpage.Text = PageSize.ToString();
                }
                else
                {
                    PageSize = Convert.ToInt32(rowPerpage.Text);
                }
                #endregion page


                ApplicantBiz biz = new ApplicantBiz();

                string a;
                string s;
                string AS_result;
                string o_result;
                a = ddlStatus.SelectedValue;

                if (a != "")
                {
                    var stringValue = a;
                    s         = stringValue.Substring(0, 1);
                    AS_result = stringValue.Substring(1, 1);
                    o_result  = stringValue.Substring(2, 1);
                }
                else
                {
                    s         = "";
                    AS_result = "";
                    o_result  = "";
                }


                if (Count)
                {
                    #region Page
                    var CountPage = biz.GetApproveEditApplicant((DTO.RegistrationType)base.UserRegType, txtIDCard.Text, txtTestingNo.Text, base.UserProfile.IdCard, base.UserProfile.CompCode, s, resultPage, PageSize, true, base.UserProfile.MemberType.ToString(), AS_result, o_result);

                    if (CountPage.DataResponse != null)
                    {
                        if (CountPage.DataResponse.Tables[0].Rows.Count > 0)
                        {
                            Int64 totalROWs = Convert.ToInt32(CountPage.DataResponse.Tables[0].Rows[0]["CCount"].ToString());

                            VisibleGV(gvDetail, totalROWs, Convert.ToInt32(rowPerpage.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                            }
                        }
                        else
                        {
                            VisibleGV(gvDetail, 0, Convert.ToInt32(rowPerpage.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                            }
                            txtTotalPage.Text = "1";
                        }
                    }
                    #endregion Page
                }

                string aaa = base.UserProfile.MemberType.ToString();

                var res = biz.GetApproveEditApplicant((DTO.RegistrationType)base.UserRegType, txtIDCard.Text, txtTestingNo.Text, base.UserProfile.IdCard, base.UserProfile.CompCode, s, resultPage, PageSize, false, base.UserProfile.MemberType.ToString(), AS_result, o_result);
                if (res.IsError)
                {
                    btnNextGvSearch.Visible     = false;
                    btnPreviousGvSearch.Visible = false;
                    txtNumberGvSearch.Visible   = false;
                    txtTotalPage.Visible        = false;
                    TXTrowperpage.Visible       = false;
                    lblParaPage.Visible         = false;
                    rowPerpage.Visible          = false;
                    pageGo.Visible                = false;
                    div_totalPage.Visible         = false;
                    UCModalError.ShowMessageError = res.ErrorMsg;
                    UCModalError.ShowModalError();
                }
                else if (res != null)
                {
                    if (res.DataResponse.Tables[0].Rows.Count > 0)
                    {
                        PnlDetailSearchGridView.Visible = true;
                        bludDiv1.Visible = true;


                        gvDetail.DataSource = res.DataResponse;
                        gvDetail.DataBind();
                        //int rowcount = res.DataResponse.Tables[0].Rows.Count;
                        //lblTotal.Text = rowcount.ToString();
                        div_totalPage.Visible = true;
                        lblTotal.Visible      = true;
                    }
                    else
                    {
                        PnlDetailSearchGridView.Visible = true;
                        bludDiv1.Visible      = true;
                        div_totalPage.Visible = true;
                        lblTotal.Visible      = true;
                        gvDetail.DataSource   = res.DataResponse;
                        gvDetail.DataBind();

                        txtNumberGvSearch.Enabled   = false;
                        btnPreviousGvSearch.Enabled = false;
                        btnNextGvSearch.Enabled     = false;
                    }
                }
                else
                {
                    UCModalError.ShowMessageError = "ไม่พบข้อมูลผู้สมัครสอบ";
                    UCModalError.ShowModalError();
                }
            }
            catch (Exception ex)
            {
            }
        }