// โหลดข้อมูลตาราง private void BindExamScheduleByTable() { if (IsCanRender == true) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedIndex == 0 ? "" : ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedIndex == 0 ? "" : ddlTypeLicense.SelectedValue); string strYearMonth = string.Empty; if (ddlMonth.SelectedValue != "") { strYearMonth = GetCrit(ConvertToYearMonth(ddlMonth.SelectedValue.ToInt())); } else { strYearMonth = GetCrit(ConvertToYearMonth(DateTime.Today.Month)); } string strTime = GetCrit(ddlTime.SelectedValue); //var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null); //DataSet ds = ls.DataResponse; //DataTable dt = ds.Tables[0]; //gvTable.DataSource = dt; //gvTable.DataBind(); //gvTable.Visible = true; //boxgvTable.Visible = true; } }
private void NewMode() { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); txtDetailFee.Text = biz.GetExamFee().DataResponse; btnDelete.Visible = false; GetDetailExamPlace(); }
// กำหนดค่าเริ่มต้นของจำนวนรับสมัคร โดยอ้างอิงจากสนามสอบ protected void ddlDetailExamYardCode_SelectedIndexChanged(object sender, EventArgs e) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); txtDetailNumberOfSeat.Text = biz.GetSeatAmount(ddlDetailExamYardCode.SelectedValue).DataResponse; ModSingleApplicant.Show(); //IsCanRender = false; }
protected void lbtnDelete_Click(object sender, EventArgs e) { try { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); GridViewRow gr = (GridViewRow)((LinkButton)sender).Parent.Parent; string ID = ((Label)gr.FindControl("lblAssociationCode")).Text; if (!biz.CheckUsedPlaceGroup(ID).ResultMessage)//false = มีใช้งานไปแล้ว { mpeAssociation.Show(); } else { functionDelete(ID); } // functionDelete(ID); } catch (Exception ex) { UCError.ShowMessageError = ex.Message; UCError.ShowModalError(); } }
// โชว์ข้อมูลตามการเลือกรหัสสอบ private void BindExamByTestingNoAndPlaceCode(string testingNo, string placeCode) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); var exam = biz.GetExamByTestingNoAndPlaceCode(testingNo, placeCode); txtDetailExamCode.Text = exam.DataResponse.TESTING_NO; txtDetailDateExam.Text = exam.DataResponse.TESTING_DATE.ToString(); txtDetailFee.Text = exam.DataResponse.EXAM_FEE.ToString(); }
protected void btnSearchExamCode_Click(object sender, EventArgs e) { txtExamNumber.Text = txtExamNumber.Text.Trim(); btnInsertExamSchedule.Visible = false; txtExamNumber.Visible = true; if (!string.IsNullOrEmpty(txtExamNumber.Text)) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); bool result = biz.IsRightTestingNo(txtExamNumber.Text); if (result == false) { this.MasterSite.ModelError.ShowMessageError = SysMessage.PleaseInputTestingNo; this.MasterSite.ModelError.ShowModalError(); } else { Session["TestingNo"] = txtExamNumber.Text; var res = biz.GetExamByTestingNo(txtExamNumber.Text); if (res.IsError) { this.MasterSite.ModelError.ShowMessageError = "โปรดตรวจสอบข้อมูล"; this.MasterSite.ModelError.ShowModalError(); } else { Session["ExamNumber"] = res.DataResponse.TESTING_NO; Session["ExamDate"] = res.DataResponse.TESTING_DATE; Session["ExamTime"] = res.DataResponse.TEST_TIME_CODE; Session["PlaceCode"] = res.DataResponse.EXAM_PLACE_CODE; Session["ExamPlaceCode"] = res.DataResponse.EXAM_PLACE_CODE; Session["TestingNo"] = res.DataResponse.TESTING_NO; Session["TestingDate"] = res.DataResponse.TESTING_DATE; Session["TestTimeCode"] = res.DataResponse.TEST_TIME_CODE; Session["LicenseTypeCode"] = res.DataResponse.LICENSE_TYPE_CODE; Session["ExamPlaceGroupCode"] = res.DataResponse.EXAM_PLACE_GROUP_CODE; } Response.Redirect("~/Applicant/GroupApplicantDetail.aspx"); } } else { panContent.Visible = true; pnlExamSearch.Visible = false; if (rblDisplay.SelectedValue == "1") { pnlSearch.Visible = true; pnlCalendar.Visible = true; } else { pnlSearch.Visible = true; pnlTable.Visible = true; } } }
protected void btnInsert0_Click(object sender, EventArgs e) { //BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); //var res = biz.GetRegistrationsByCriteria("", "", "", "", "", new DateTime(2003, 8, 17)); var biz = new BLL.ExamScheduleBiz(); var res = biz.GetExamByYearMonth("201301"); gv.DataSource = res.DataResponse; gv.DataBind(); }
// ทุกๆครั้งที่เลือกรายการสอบแบบตาราง protected void lnkTableExamNumber_Click(object sender, EventArgs e) { var gr = (GridViewRow)((LinkButton)sender).NamingContainer; var strExamNumber = (LinkButton)gr.FindControl("lnkTableExamNumber"); var strPlaceCode = (Label)gr.FindControl("lblPlaceCode"); BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); upn.Update(); Session["TestingNo"] = strExamNumber.Text; Response.Redirect("~/Applicant/GroupApplicantDetail.aspx"); }
private void getConfigDate() { try { var biz = new BLL.ExamScheduleBiz(); var res = biz.ManageApplicantIn_OutRoom().DataResponse; var DayValue = res.FirstOrDefault(x => x.Id == "10" && x.GROUP_CODE == "AP001"); lblDayValue.Text = DayValue.Value.ToString(); } catch { } }
// ทุกๆครั้งที่มีการเปลี่ยนเดือนบนปฏิทิน protected void cldExam_VisibleMonthChanged(object sender, MonthChangedEventArgs e) { if (e.NewDate.Month < 10) { ddlMonth.SelectedValue = "0" + Convert.ToString(e.NewDate.Month); } else { ddlMonth.SelectedValue = Convert.ToString(e.NewDate.Month); } txtYear.Text = Convert.ToString(e.NewDate.Year + 543); gvExamSchedule.DataSource = null; gvExamSchedule.DataBind(); gvTable.DataSource = null; gvTable.DataBind(); BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedValue); string strYearMonth = GetCrit(ConvertToYearMonth(e.NewDate.Month)); string strTime = GetCrit(ddlTime.SelectedValue); //var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null); //DataSet ds = ls.DataResponse; //if (ds.Tables.Count > 0) //{ // DataTable dt = ds.Tables[0]; // var list = dt.AsEnumerable().Select(s => s.Field<DateTime>("TESTING_DATE")).Distinct().ToList(); // for (int i = 0; i < list.Count; i++) // { // if (e.NewDate.Date == list[i].Date) // { // Controls.Add(new LiteralControl("</br>")); // Label lbl = new Label { ID = "btn" + i.ToString(), Text = "รายละเอียด" }; // Controls.Add(lbl); // } // } //} }
private void BindExamScheduleByTable(String year, String month, String day) { //DateTime date = new DateTime( BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); var ls = biz.GetExamScheduleByCriteria(ddlPlaceGroup.SelectedValue, ddlPlace.SelectedValue, ddlTypeLicense.SelectedValue, "", year, month, day, ddlTime.SelectedValue, txtCurrentPage.Text, txtPageSize.Text, lblTotalItems.Text, UserIdRequest, ""); ExamInfos = ls.DataResponse.ExamInfos; gvExamSchedule.DataSource = ExamInfos; gvExamSchedule.DataBind(); }
// ทุกๆครั้งที่เลือกรายการสอบแบบปฏิทิน protected void lnkExamNumber_Click(object sender, EventArgs e) { var gr = (GridViewRow)((LinkButton)sender).NamingContainer; var strExamNumber = (LinkButton)gr.FindControl("lnkExamNumber"); var strPlaceCode = (Label)gr.FindControl("lblPlaceCode"); BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); upn.Update(); btnDelete.Visible = true; ModSingleApplicant.Show(); EditMode(strExamNumber.Text, strPlaceCode.Text); }
protected void cldGroupApplicant_DayRender(object sender, DayRenderEventArgs e) { if (IsCanRender == true) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedValue); string strYearMonth = string.Empty; strYearMonth = GetCrit(ConvertToYearMonth(e.Day.Date.Month)); string strTime = GetCrit(ddlTime.SelectedValue); var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null, 0, 0, false); DataSet ds = ls.DataResponse; if (ds != null) { DataTable dt = ds.Tables[0]; var list = dt.AsEnumerable().Select(s => s.Field <DateTime>("TESTING_DATE")).Distinct().ToList(); DateTime dtToday = DateTime.Today.AddDays(-1); DateTime dtFinish = DateTime.Today.AddDays(+5); for (int i = 0; i < list.Count; i++) { ExamRender examrender = new ExamRender(); if (e.Day.Date == list[i].Date) { e.Cell.Controls.Add(new LiteralControl("</br>")); Label lbl = new Label { ID = "btn" + i.ToString(), Text = "รายละเอียด" }; e.Cell.Controls.Add(lbl); } if (e.Day.Date == list[i].Date && list[i].Date > dtToday && list[i].Date <= dtFinish) { examrender.IsSetProperty = true; e.Cell.Enabled = false; e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } } } } }
private void DeleteMode() { string testingNo = txtDetailExamCode.Text; string examPlaceCode = ddlDetailExamYardCode.SelectedValue; BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); if (biz.CanChangeExam(testingNo, examPlaceCode).ResultMessage) { biz.DeleteExam(testingNo, examPlaceCode); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedValue); string strYearMonth = GetCrit(ConvertToYearMonth(1)); string strTime = GetCrit(ddlTime.SelectedValue); //var res = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null); //DataSet ds = res.DataResponse; //if (ds != null) //{ // DataTable dt = ds.Tables[0]; // if (dt.Rows.Count == 0) // { // Div1.Visible = false; // boxgvTable.Visible = false; // gvExamSchedule.Visible = false; // } // else // { // upn.Update(); // gvExamSchedule.DataSource = res.DataResponse; // gvExamSchedule.DataBind(); // gvTable.DataSource = res.DataResponse; // gvTable.DataBind(); // } //} } else { UCModalError.ShowMessageError = SysMessage.CannotDeleteExamTestingNo; UCModalError.ShowModalError(); } }
} // code เดิมของพี่ฟิลด์(?) มิ้วจับแยกออกมา private void ExamSchduleReLoadSelectedDate(Boolean CountAgain) { Div1.Visible = true; gvExamSchedule.Visible = true; DateTime cldselectDate = cldExam.SelectedDate; string strYear = cldExam.SelectedDate.Year.ToString(); string strMonth = cldExam.SelectedDate.Month.ToString(); if (cldExam.SelectedDate.Month < 10) { strMonth = "0" + strMonth; } BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; //var res = biz.GetExamByCriteria(GetCrit(ddlPlaceGroup.SelectedIndex == 0 ? "" : ddlPlaceGroup.SelectedValue), // GetCrit(ddlPlace.SelectedIndex == 0 ? "" : ddlPlace.SelectedValue), GetCrit(ddlTypeLicense.SelectedIndex == 0 ? "" : ddlTypeLicense.SelectedValue), strYear + strMonth, "", cldselectDate); //DataSet ds = res.DataResponse; //if (ds != null) //{ // DataTable dt = ds.Tables[0]; // if (dt.Rows.Count == 0) // { // Div1.Visible = false; // boxgvTable.Visible = false; // gvExamSchedule.Visible = false; // } // else // { // gvExamSchedule.Visible = true; // gvExamSchedule.DataSource = res.DataResponse; // gvExamSchedule.DataBind(); // Div1.Visible = true; // boxgvTable.Visible = false; // } //} }
protected void Button2_Click(object sender, EventArgs e) { DTO.ExamSchedule ent = new DTO.ExamSchedule(); ent.TESTING_NO = "561444"; ent.EXAM_PLACE_CODE = "42000"; ent.TESTING_DATE = DateTime.Now.Date; ent.TEST_TIME_CODE = "05"; ent.LICENSE_TYPE_CODE = "02"; ent.USER_ID = "AGDOI2"; ent.USER_DATE = DateTime.Now; ent.EXAM_STATUS = "E"; BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); //var res = biz.UpdateExam(ent); //Response.Write(res.IsError); }
private void SelectDataFrombase() { try { DateTime visibleMonth = new DateTime((txtYear.Text.ToInt() - 543), ddlMonth.SelectedValue.ToInt(), 1); BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strTime = GetCrit(ddlTime.SelectedIndex == 0 ? "" : ddlTime.SelectedValue); DTO.Exams.GetExamByCriteriaRequest request = new DTO.Exams.GetExamByCriteriaRequest(); request.ExamPlaceGroupCode = ddlPlaceGroup.SelectedValue; // strExamPlaceGroup; request.ExamPlaceCode = ddlPlace.SelectedValue; request.LicenseTypeCode = ddlTypeLicense.SelectedValue; request.Year = visibleMonth.Year; request.Month = visibleMonth.Month; request.TimeCode = ddlTime.SelectedValue; request.Owner = ""; request.TestingDate = ""; var ls = biz.GetExamByCriteria(request); if (ls.IsError) { throw new ApplicationException(ls.ErrorMsg); } GBBiz gbBiz = new GBBiz(); DTO.ResponseService <DTO.GBHoliday[]> lsHoliday = gbBiz.GetHolidayListByYearMonth(visibleMonth.ToString("yyyyMM", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))); ExamSchedules = ls.DataResponse.ExamShedules; Holidays = lsHoliday.DataResponse.ToList(); } catch (Exception ex) { LoggerFactory.CreateLog().LogError("ไม่สามารถเรียกข้อมูลได้.", ex); String a = ex.Message; } }
private void BindExamScheduleByTable(String year, String month, String day) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); var ls = biz.GetExamScheduleByCriteria(ddlPlaceGroup.SelectedValue, ddlPlace.SelectedValue, ddlTypeLicense.SelectedValue, "", year, month, day, ddlTime.SelectedValue, txtCurrentPage.Text, txtPageSize.Text, lblTotalItems.Text, UserIdRequest, ""); ExamInfos = ls.DataResponse.ExamInfos; gvExamSchedule.DataSource = ExamInfos; gvExamSchedule.DataBind(); if (gvExamSchedule.Rows.Count > 0) { btnExportExcel.Visible = true; } else { btnExportExcel.Visible = false; } }
private void BindDataInGridView() { var biz = new BLL.ExamScheduleBiz(); var res = biz.ManageApplicantIn_OutRoom(); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { gvApproveRegis.DataSource = res.DataResponse; gvApproveRegis.DataBind(); } UpdatePanelGrid.Update(); }
private void EditMode(string testingNo, string placeCode) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); var exam = biz.GetExamByTestingNoAndPlaceCode(testingNo, placeCode); txtDetailExamCode.Text = exam.DataResponse.TESTING_NO; txtDetailDateExam.Text = exam.DataResponse.TESTING_DATE.ToString("dd/MM/yyyy"); txtDetailFee.Text = exam.DataResponse.EXAM_FEE.ToString(); txtDetailFee.Text = biz.GetExamFee().DataResponse; ddlDetailTimeExamCode.SelectedValue = exam.DataResponse.TEST_TIME_CODE; ddlDetailYardGroupCode.SelectedValue = exam.DataResponse.EXAM_PLACE_GROUP_CODE; if (ddlDetailYardGroupCode.SelectedValue != "") { BLL.DataCenterBiz dbiz = new BLL.DataCenterBiz(); var res = dbiz.GetExamPlaceByCompCode(ddlDetailYardGroupCode.SelectedIndex == 0 ? "" : ddlDetailYardGroupCode.SelectedItem.Value, ddlDetailYardGroupCode.SelectedItem.Value); BindToDDL(ddlDetailExamYardCode, res.DataResponse); ddlDetailExamYardCode.SelectedValue = exam.DataResponse.EXAM_PLACE_CODE; } ddlDetailOfficerCode.SelectedValue = exam.DataResponse.LICENSE_TYPE_CODE; txtDetailNumberOfSeat.Text = biz.GetSeatAmount(ddlDetailExamYardCode.SelectedValue).DataResponse; }
// โหลดข้อมูลปฏิทินจากเงื่อนไข private void BindExamScheduleCalendarByCriteria(DateTime date) { Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedValue); string strYearMonth = GetCrit(ConvertToYearMonth()); string strTime = GetCrit(ddlTime.SelectedValue); BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null, 0, 0, false); DataSet ds = ls.DataResponse; if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; var list = dt.AsEnumerable().Select(s => s.Field <DateTime>("TESTING_DATE")).Distinct().ToList(); for (int i = 0; i < list.Count; i++) { if (date.Day == list[i].Date.Day) { Controls.Add(new LiteralControl("</br>")); Label lbl = new Label { ID = "btn" + i.ToString(), Text = "รายละเอียด" }; Controls.Add(lbl); } } } cldGroupApplicant.TodaysDate = date; upn.Update(); }
protected void btnSearchExamCode_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtExamNumber.Text)) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); bool result = biz.IsRightTestingNo(txtExamNumber.Text); if (result == false) { UCModalError.ShowMessageError = SysMessage.PleaseInputTestingNo; UCModalError.ShowModalError(); } else { Session["TestingNo"] = txtExamNumber.Text; Response.Redirect("~/Applicant/GroupApplicantDetail.aspx"); } } else { pnlSearch.Visible = true; pnlCalendar.Visible = true; } }
protected void cldExam_DayRender(object sender, DayRenderEventArgs e) { #region Day Render Rows /********** render day ************/ daysCounter++; if (e.Day.Date.Day == 1 && !e.Day.IsOtherMonth) // 1st of current month. Turn visibility of row to ON. { isLastRow = false; } else if (daysCounter == 36 && e.Day.IsOtherMonth) // 5 rows already rendered. If its the next row is next month, hide it. { isLastRow = true; } else if (daysCounter == 1 && e.Day.IsOtherMonth && e.Day.Date.Month == e.Day.Date.AddDays(6).Month) { // If first row completely is previous month, hide it. // Actually the flag should be isFirstRow, but I dont want one more boolean just for the sake of it. isLastRow = true; } if (isLastRow) { e.Cell.Visible = false; return; } if (e.Day.IsWeekend && !e.Day.IsSelected) { e.Cell.Style.Add("background-color", "#f0e7f1"); } /********* end render ************/ #endregion e.Day.IsSelectable = false; e.Cell.Enabled = false; e.Cell.ForeColor = System.Drawing.Color.Gray; BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; if (ExamSchedules.Count() > 0) { DateTime exam = ExamSchedules.FirstOrDefault(a => a.Date == e.Day.Date); if (exam != null && exam != DateTime.MinValue) { LinkButton lnk = new LinkButton(); e.Cell.Controls.Add(new LiteralControl("</br>")); DateTime datenow = DateTime.Now; DateTime adddate = DateTime.Now.AddDays(5); DateTime renderdate = e.Day.Date; if (renderdate > datenow && renderdate < adddate) { lnk.ID = "lnkButton"; lnk.Text = "รายละเอียด"; lnk.Enabled = false; lnk.ForeColor = System.Drawing.Color.Gray; e.Cell.Attributes.Remove("onclick"); e.Cell.Style.Remove("cursor"); e.Cell.Style.Remove("pointer"); } else { lnk.ID = "lnkButton"; lnk.Text = "รายละเอียด"; lnk.ForeColor = System.Drawing.Color.Green; e.Cell.Attributes.Add("onclick", e.SelectUrl); e.Cell.Style.Add("cursor", "pointer"); } e.Cell.Controls.Add(lnk); } } if (Holidays.Count() > 0) { //DataTable dt = dsHoliday.Tables[0]; GBHoliday holiday = Holidays.FirstOrDefault(s => s.HL_DATE.Date == e.Day.Date); DateTime dtToday = DateTime.Today.AddDays(-1); DateTime dtFinish = DateTime.Today.AddDays(+5); //ExamRender examrender = new ExamRender(); if (holiday != null) { e.Cell.Controls.Add(new LiteralControl("</br>")); Label lnk = new Label(); lnk.ID = "lnkButton"; lnk.Enabled = false; lnk.Text = holiday.HL_DESC; lnk.ForeColor = System.Drawing.Color.Red; lnk.BackColor = System.Drawing.Color.FromArgb(250, 200, 135); e.Cell.Attributes.Add("onclick", e.SelectUrl); e.Cell.Style.Add("cursor", "pointer"); e.Cell.Controls.Add(lnk); } } e.Cell.DataBind(); }
protected void cldGroupApplicant_CLICK(Boolean CountAgain)//code เดิมพี่ฟิลด์แค่มาเพิ่มboolean กับตรงที่regionไว้ { gvGroupApplicant.Visible = true; DateTime cldselectDate = cldGroupApplicant.SelectedDate; BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); string strYear = cldGroupApplicant.SelectedDate.Year.ToString(); string strMonth = cldGroupApplicant.SelectedDate.Month.ToString(); if (cldGroupApplicant.SelectedDate.Month < 10) { strMonth = "0" + strMonth; } #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.Trim() == "0")) { rowPerpage.Text = PageSize.ToString(); } else { PageSize = Convert.ToInt32(rowPerpage.Text); } #endregion page if (CountAgain) { #region Page var CountPage = biz.GetExamByCriteria("", "", "", "", strYear + strMonth, "", cldselectDate, resultPage, PageSize, true); 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(gvGroupApplicant, totalROWs, Convert.ToInt32(rowPerpage.Text), true); if (Rpage == 0) { NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage); } } else { VisibleGV(gvGroupApplicant, 0, Convert.ToInt32(rowPerpage.Text), true); if (Rpage == 0) { NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage); } txtTotalPage.Text = "1"; } } #endregion Page } var res = biz.GetExamByCriteria("", "", "", strYear + strMonth, "", cldselectDate, resultPage, PageSize, false); gvGroupApplicant.DataSource = res.DataResponse; gvGroupApplicant.DataBind(); }
private void SaveMode() { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); if (string.IsNullOrEmpty(txtDetailExamCode.Text)) { ExamSchedule ent = new ExamSchedule(); ent.USER_ID = "AGDOI"; ent.EXAM_PLACE_GROUP_CODE = ddlDetailYardGroupCode.SelectedValue; ent.EXAM_PLACE_CODE = ddlDetailExamYardCode.SelectedValue; ent.TESTING_DATE = Convert.ToDateTime(txtDetailDateExam.Text); ent.TEST_TIME_CODE = ddlDetailTimeExamCode.SelectedValue; ent.LICENSE_TYPE_CODE = ddlDetailOfficerCode.SelectedValue; ent.USER_DATE = DateTime.Now; ent.EXAM_ADMISSION = txtDetailNumberOfSeat.Text.ToShort(); ent.EXAM_FEE = txtDetailFee.Text.ToDecimal(); ent.EXAM_STATUS = "E"; ent.EXAM_APPLY = 0; //if (base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) //{ // ent.EXAM_OWNER = "B"; //} //else if (base.UserProfile.MemberType == DTO.RegistrationType.TestCenter.GetEnumValue()) //{ // ent.EXAM_OWNER = "C"; //} //else //{ // ent.EXAM_OWNER = "A"; //} if (Convert.ToDateTime(txtDetailDateExam.Text) > DateTime.Now.Date) { var res = biz.InsertExam(ent); if (res.IsError) { UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess; UCModalSuccess.ShowModalSuccess(); } } else { UCModalError.ShowMessageError = Resources.errorExamSchedule_001; UCModalError.ShowModalError(); } } else { string testingNo = txtDetailExamCode.Text; string examPlaceCode = ddlDetailExamYardCode.SelectedValue; if (biz.CanChangeExam(testingNo, examPlaceCode).ResultMessage) { ExamSchedule ent = new ExamSchedule(); var exam = biz.GetExamByTestingNoAndPlaceCode(testingNo, examPlaceCode); ent.TESTING_NO = txtDetailExamCode.Text; ent.TESTING_DATE = Convert.ToDateTime(txtDetailDateExam.Text); ent.EXAM_FEE = txtDetailFee.Text.ToShort(); ent.EXAM_STATUS = "E"; ent.EXAM_FEE = txtDetailFee.Text.ToShort(); ent.TEST_TIME_CODE = ddlDetailTimeExamCode.SelectedValue; ent.EXAM_PLACE_GROUP_CODE = ddlDetailYardGroupCode.SelectedValue; if (ddlDetailYardGroupCode.SelectedValue != "") { ent.EXAM_PLACE_CODE = ddlDetailExamYardCode.SelectedValue; } ent.LICENSE_TYPE_CODE = ddlDetailOfficerCode.SelectedValue; ent.EXAM_APPLY = 0; ent.EXAM_ADMISSION = txtDetailNumberOfSeat.Text.ToShort(); //ent.EXAM_OWNER = "A"; biz.UpdateExam(ent); DateTime dtExam = Convert.ToDateTime(txtDetailDateExam.Text); string strMonth = string.Empty; if (dtExam.Date.Month < 10) { strMonth = "0" + dtExam.Date.Month; } //var re = biz.GetExamByCriteria("", "", "", dtExam.Year.ToString() + strMonth, "", Convert.ToDateTime(txtDetailDateExam.Text)); //if (re.IsError) //{ // UCModalError.ShowMessageError = re.ErrorMsg; // UCModalError.ShowModalError(); //} //UCModalSuccess.ShowMessageSuccess = SysMessage.SaveSucess; //UCModalSuccess.ShowModalSuccess(); //gvExamSchedule.DataSource = re.DataResponse; //gvExamSchedule.DataBind(); //gvTable.DataSource = re.DataResponse; //gvTable.DataBind(); } else { UCModalError.ShowMessageError = SysMessage.CannotEditExamTestingNo; UCModalError.ShowModalError(); } } }
// โหลดข้อมูลตาราง private void BindExamScheduleByTable(Boolean CountAgain) { #region page int Rpage = (txt_page_now.Text.Trim() == "") ? 0 : txt_page_now.Text.Trim().ToInt(); int resultPage = (Rpage == 0) ? 1 : txt_page_now.Text.Trim().ToInt(); resultPage = resultPage == 0 ? 1 : resultPage; if ((txt_input.Text.Trim() == null) || (txt_input.Text.Trim() == "") || (txt_input.Text.Trim() == "0")) { txt_input.Text = PageSize.ToString(); } else { PageSize = Convert.ToInt32(txt_input.Text); } #endregion page BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedIndex == 0 ? "" : ddlTypeLicense.SelectedValue); string strYearMonth = GetCrit(ConvertToYearMonth()); string strTime = GetCrit(ddlTime.SelectedIndex == 0 ? "" : ddlTime.SelectedValue); if (CountAgain) { #region Page var CountPage = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null, resultPage, PageSize, true); 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(gvTable, totalROWs, Convert.ToInt32(txt_input.Text), true); if (Rpage == 0) { NPbutton(btnP_table, txt_page_now, btnN_table, "", lbl_pageMax); } } else { VisibleGV(gvTable, 0, Convert.ToInt32(txt_input.Text), true); if (Rpage == 0) { NPbutton(btnP_table, txt_page_now, btnN_table, "", lbl_pageMax); } lbl_pageMax.Text = "1"; } } #endregion Page } var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null, resultPage, PageSize, false); gvTable.DataSource = ls.DataResponse; gvTable.DataBind(); }
protected void btnOkApproveRegis_Click(object sender, EventArgs e) { var data = new List <DTO.ConfigEntity>(); foreach (GridViewRow gr in gvApproveRegis.Rows) { Label lblIdGvApproveRegis = (Label)gr.FindControl("lblIdGvApproveRegis"); //Label lblValueGvApproveRegis = (Label)gr.FindControl("lblValueGvApproveRegis"); DropDownList ddlDateExpiration = (DropDownList)gr.FindControl("ddlDateExpiration"); if (lblIdGvApproveRegis.Text == "09") { if (((CheckBox)gr.FindControl("chkSpecifiedValue")).Checked == true) { data.Add(new DTO.ConfigEntity { Id = lblIdGvApproveRegis.Text, GROUP_CODE = "AP001", Value = "1" }); } else { data.Add(new DTO.ConfigEntity { Id = lblIdGvApproveRegis.Text, GROUP_CODE = "AP001", Value = "0" }); } } else if (lblIdGvApproveRegis.Text == "10") { data.Add(new DTO.ConfigEntity { Id = lblIdGvApproveRegis.Text, GROUP_CODE = "AP001", Value = ddlDateExpiration.SelectedValue }); } } if (data != null) { var biz = new BLL.ExamScheduleBiz(); var res = biz.UpdateManageApplicantIn_OutRoom(data); if (res.IsError) { var errorMsg = res.ErrorMsg; UCModalError.ShowMessageError = res.ErrorMsg; UCModalError.ShowModalError(); } else { UCModalSuccess.ShowMessageSuccess = "บันทึกเรียบร้อย"; UCModalSuccess.ShowModalSuccess(); BindDataInGridView(); UpdatePanelGrid.Update(); } } }
protected void cldExam_DayRender(object sender, DayRenderEventArgs e) { if (IsCanRender == true) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedIndex == 0 ? "" : ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedIndex == 0 ? "" : ddlTypeLicense.SelectedValue); string strYearMonth = string.Empty; strYearMonth = GetCrit(ConvertToYearMonth(e.Day.Date.Month)); string strTime = GetCrit(ddlTime.SelectedIndex == 0 ? "" : ddlTime.SelectedValue); //var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null); //DataSet ds = ls.DataResponse; //if (ds != null) //{ // DataTable dt = ds.Tables[0]; // var list = dt.AsEnumerable().Select(s => s.Field<DateTime>("TESTING_DATE")).Distinct().ToList(); // for (int i = 0; i < list.Count; i++) // { // ExamRender examrender = new ExamRender(); // if (e.Day.Date == list[i].Date) // { // e.Cell.Controls.Add(new LiteralControl("</br>")); // Label lbl = new Label { ID = "btn" + i.ToString(), Text = "รายละเอียด" }; // e.Cell.Controls.Add(lbl); // examrender.testingDate = e.Day.Date; // examrender.ID = "btn" + i.ToString(); // examrender.Name = "รายละเอียด"; // lsRender.Add(examrender); // } // else // { // } // } //} } else { if (lsRender.Count != 0) { DateTime dtToday = DateTime.Today; DateTime dtFinish = DateTime.Today.AddDays(+5); foreach (ExamRender item in lsRender) { if (e.Day.Date == item.testingDate) { e.Cell.Controls.Add(new LiteralControl("</br>")); Label lbl = new Label { ID = item.ID, Text = item.Name }; e.Cell.Controls.Add(lbl); } if (e.Day.Date == item.testingDate && item.IsSetProperty) { e.Cell.Enabled = false; e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } } } } }