protected void btnList_Click(object sender, EventArgs e) { gvListExam.DataSource = ListApplicant; gvListExam.DataBind(); ModalListExam.Show(); }
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(); } }
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(); } }
protected void btnListExamContinue_Click(object sender, EventArgs e) { ModalListExam.Hide(); }
// ทุกๆครั้งที่เลือกรายการสอบแบบปฏิทิน 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(); } }