Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
 protected void btnPopUp_Click(object sender, EventArgs e)
 {
     try
     {
         BLL.ExamScheduleBiz biz = new ExamScheduleBiz();
         lblSeatAmountPlace.Text = biz.SumSeatFromPlace(ddlExamPlace.SelectedValue.ToString(), "").DataResponse.ToString();
         // ClearControl();
         if (ddlExamPlaceGroup.SelectedIndex > 0 && ddlExamPlace.SelectedIndex > 0)
         {
             // ddlExamPlace.Enabled = true;
             // ddlExamPlaceGroup.Enabled = true;
             txtCodeRoom.Enabled = true;
             btnUpdate.Visible   = false;
             btnSave.Visible     = true;
             ClearControl();
             mpeExamRoom.Show();
             uplPopUp.Update();
         }
         else
         {
             UCError.ShowMessageError = SysMessage.ChooseData;
             UCError.ShowModalError();
         }
     }
     catch
     { }
 }
Beispiel #3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                BLL.DataCenterBiz     biz = new BLL.DataCenterBiz();
                DTO.ConfigAssociation ent = new DTO.ConfigAssociation();
                ent.ASSOCIATION_CODE = txtAssociationCode.Text;
                ent.ASSOCIATION_NAME = txtAssociationName.Text;
                ent.UPDATED_BY       = base.UserId.ToString();
                ent.UPDATED_DATE     = DateTime.Now;
                ent.ACTIVE           = "Y";

                List <DTO.AssociationLicense> al = new List <DTO.AssociationLicense>();
                var res = biz.InsertExamPlaceGroupR(ent, UserProfile, al);
                if (!res.IsError)
                {
                    initGridAssociation();
                    UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                    UCSuccess.ShowModalSuccess();
                }
                else
                {
                    UCError.ShowMessageError = res.ErrorMsg;
                    UCError.ShowModalError();
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
            }
        }
Beispiel #4
0
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                BLL.DataCenterBiz biz = new BLL.DataCenterBiz();
                GridViewRow       gr  = (GridViewRow)((LinkButton)sender).Parent.Parent;
                string            ID  = ((Label)gr.FindControl("lblAssociationCode")).Text;

                var res = biz.DeleteAsscoiation(ID);
                if (!res.IsError)
                {
                    initGridAssociation();
                    UCSuccess.ShowMessageSuccess = SysMessage.DeleteSuccess;
                    UCSuccess.ShowModalSuccess();
                }
                else
                {
                    UCError.ShowMessageError = res.ErrorMsg;
                    UCError.ShowModalError();
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
            }
        }
Beispiel #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtAssociationCode.Text.Length == 3)
                {
                    BLL.DataCenterBiz     biz = new BLL.DataCenterBiz();
                    DTO.ConfigAssociation ent = new DTO.ConfigAssociation();
                    ent.ASSOCIATION_CODE = txtAssociationCode.Text.Trim();
                    ent.ASSOCIATION_NAME = txtAssociationName.Text.Trim();
                    if (ddlAgentType.SelectedValue != "")
                    {
                        ent.AGENT_TYPE = ddlAgentType.SelectedValue;
                    }
                    if (ddlCompType.SelectedValue != "")
                    {
                        ent.COMP_TYPE = ddlCompType.SelectedValue;
                    }
                    ent.ACTIVE = "Y";

                    List <DTO.AssociationLicense> al = new List <DTO.AssociationLicense>();
                    foreach (ListItem i in chkLicense.Items)
                    {
                        al.Add(new DTO.AssociationLicense
                        {
                            LICENSE_TYPE_CODE = i.Value,
                            ACTIVE            = i.Selected ? "Y" : "N"
                        });
                    }
                    var res = biz.InsertAssociation(ent, UserProfile, al);
                    if (!res.IsError)
                    {
                        initGridAssociation();
                        UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                        UCSuccess.ShowModalSuccess();
                    }
                    else
                    {
                        UCError.ShowMessageError = res.ErrorMsg;
                        UCError.ShowModalError();
                        mpeAssociation.Show();
                        UplPopUp.Update();
                    }
                }
                else
                {
                    UCError.ShowMessageError = "รหัสสมาคมต้องมีจำนวน 3 หลักเท่านั้น";
                    UCError.ShowModalError();
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
                mpeAssociation.Show();
                UplPopUp.Update();
            }
            //txtAssociationCode.Text = "";
            //txtAssociationName.Text = "";
        }
Beispiel #6
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckBeforeSave())
                {
                    if (lblSeatAmountPlace.Text.ToInt() < txtSeatAmount.Text.ToInt())
                    {
                        UCError.ShowMessageError = "จำนวนที่นั่งของทุกห้องมากเกินกว่า<br>จำนวนที่นั่งที่สนามสอบนี้สามารถรองรับได้";
                        UCError.ShowModalError();
                    }
                    else
                    {
                        BLL.ExamRoomBiz    biz = new BLL.ExamRoomBiz();
                        DTO.ConfigExamRoom ent = new DTO.ConfigExamRoom();
                        ent.EXAM_ROOM_CODE  = txtCodeRoom.Text;
                        ent.EXAM_ROOM_NAME  = txtNameRoom.Text;
                        ent.SEAT_AMOUNT     = txtSeatAmount.Text.ToShort();
                        ent.EXAM_PLACE_CODE = ddlExamPlace.SelectedValue;

                        var res = biz.UpdateExamRoom(ent, UserProfile);
                        if (!res.IsError)
                        {
                            //initGvExamRoom();


                            UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                            UCSuccess.ShowModalSuccess();
                            btnSearch_Click(sender, e);
                            UpdatePanelGridviw.Update();
                        }
                        else
                        {
                            UCError.ShowMessageError = res.ErrorMsg;
                            UCError.ShowModalError();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
            }
            //ClearControl();
            lblSeatAmountPlace.Text = "";
            txtCodeRoom.Text        = "";
            txtNameRoom.Text        = "";
            txtSeatAmount.Text      = "";
            uplPopUp.Update();
        }
Beispiel #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtAssociationCode.Text) && !string.IsNullOrEmpty(txtAssociationName.Text))
                {
                    if (txtAssociationCode.Text.Length == 3)
                    {
                        BLL.DataCenterBiz biz = new BLL.DataCenterBiz();
                        var checkid           = biz.GetExamPlaceGroupRByCheckID(txtAssociationCode.Text, txtAssociationName.Text);

                        List <DTO.AssociationLicense> al  = new List <DTO.AssociationLicense>();
                        DTO.ConfigAssociation         ent = new DTO.ConfigAssociation();
                        ent.ASSOCIATION_CODE = txtAssociationCode.Text;
                        ent.ASSOCIATION_NAME = txtAssociationName.Text;
                        ent.ACTIVE           = "Y";

                        var res = biz.InsertExamPlaceGroupR(ent, UserProfile, al);
                        if (!res.IsError)
                        {
                            initGridAssociation();
                            UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                            UCSuccess.ShowModalSuccess();
                        }
                        else
                        {
                            UCError.ShowMessageError = res.ErrorMsg;
                            UCError.ShowModalError();
                        }
                    }
                    else
                    {
                        UCError.ShowMessageError = "รหัสหน่วยงานจัดสอบต้องมีจำนวน 3 ตัวอักษรเท่านั้น";
                        UCError.ShowModalError();
                    }
                }
                else
                {
                    UCError.ShowMessageError = "กรุณากรอกข้อมูลสมาคมให้ครบถ้วน";
                    UCError.ShowModalError();
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
            }
            txtAssociationCode.Text = "";
            txtAssociationName.Text = "";
        }
 protected void btnViewer_Click(object sender, EventArgs e)
 {
     if (txtDateStart.Text == "" && txtDateEnd.Text != "")
     {
         UCError.ShowMessageError = "กรุณาเลือก วันที่";
         UCError.ShowModalError();
     }
     else if (txtDateEnd.Text == "" && txtDateStart.Text != "")
     {
         UCError.ShowMessageError = "กรุณาเลือก วันที่สิ้นสุด";
         UCError.ShowModalError();
     }
     else
     {
         string src = string.Format("'{0}', '{1}', '{2}', '{3}'"
                                    , ddlLicenseType.SelectedValue, txtDateStart.Text, txtDateEnd.Text, ddlLicenseType.SelectedItem.Text);
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "", "OpenPopupViewer(" + src + ")", true);
     }
 }
Beispiel #9
0
        private void DelThisRoom(string Room)
        {
            try
            {
                BLL.ExamRoomBiz biz = new BLL.ExamRoomBiz();

                if (biz.DelExamRoom(Room).ResultMessage)
                {
                    UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                    UCSuccess.ShowModalSuccess();
                }
                else
                {
                    UCError.ShowMessageError = SysMessage.ServerError;
                    UCError.ShowModalError();
                }
            }
            catch
            {
            }
        }
Beispiel #10
0
        private Boolean CheckBeforeSave()
        {
            Boolean BeforeSave = true;

            try
            {
                if (txtSeatAmount.Text.ToInt() == 0)
                {
                    UCError.ShowMessageError = "จำนวนที่นั่งต้องมีค่ามากกว่า 0";
                    UCError.ShowModalError();
                    BeforeSave = false;
                }
                else
                {
                    if (txtSeatAmount.Text.ToInt() > 30000)
                    {
                        UCError.ShowMessageError = "ห้องสอบแต่ละห้องสามารถรองรับผู้สมัครสอบได้สูงสุด 30,000 คน เท่านั้น";
                        UCError.ShowModalError();
                        BeforeSave = false;
                    }
                    else
                    {
                        BLL.ExamScheduleBiz biz = new ExamScheduleBiz();
                        string Room             = "";
                        if (txtCodeRoom.Enabled == false)
                        {
                            Room = txtCodeRoom.Text;
                        }
                        lblSeatAmountPlace.Text = (lblSeatAmountPlace.Text == "") ? biz.SumSeatFromPlace(ddlExamPlace.SelectedValue.ToString(), Room).DataResponse.ToString() : lblSeatAmountPlace.Text;
                        lbltotalSeat.Text       = biz.SumSeat(ddlExamPlace.SelectedValue.ToString()).DataResponse.ToString();
                        lbltotalSeat.Text       = lbltotalSeat.Text == "" ? "0" : lbltotalSeat.Text;
                        BeforeSave = true;
                    }
                }
            }
            catch
            {
            }
            return(BeforeSave);
        }
Beispiel #11
0
        protected void functionDelete(string ID)
        {
            BLL.DataCenterBiz             biz = new BLL.DataCenterBiz();
            DTO.ConfigAssociation         ent = new DTO.ConfigAssociation();
            List <DTO.AssociationLicense> al  = new List <DTO.AssociationLicense>();

            ent.ASSOCIATION_CODE = ID;
            ent.ACTIVE           = "N";
            var res = biz.InsertExamPlaceGroupR(ent, UserProfile, al);

            //var res = biz.DeleteAsscoiation(ID);
            if (!res.IsError)
            {
                initGridAssociation();
                UCSuccess.ShowMessageSuccess = SysMessage.DeleteSuccess;
                UCSuccess.ShowModalSuccess();
            }
            else
            {
                UCError.ShowMessageError = res.ErrorMsg;
                UCError.ShowModalError();
            }
        }
Beispiel #12
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
                ExamScheduleBiz biz = new ExamScheduleBiz();
                if (Count)
                {
                    #region Page
                    var CountPage = biz.GetGVExamRoomByPlaceCode(ddlExamPlace.SelectedValue.ToString(), 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(gvExamRoom, totalROWs, Convert.ToInt32(rowPerpage.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                            }
                        }
                        else
                        {
                            VisibleGV(gvExamRoom, 0, Convert.ToInt32(rowPerpage.Text), true);
                            if (Rpage == 0)
                            {
                                NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                            }
                            txtTotalPage.Text = "1";
                        }
                    }
                    #endregion Page
                }
                if (ddlExamPlace.SelectedIndex > 0 && ddlExamPlaceGroup.SelectedIndex > 0)
                {
                    DTO.ResponseService <DataSet> Place = biz.GetGVExamRoomByPlaceCode(ddlExamPlace.SelectedValue.ToString(), resultPage, PageSize, false);
                    gvExamRoom.DataSource = Place.DataResponse;
                    gvExamRoom.DataBind();
                    gvExamRoom.Visible = true;
                    btnPopUp.Visible   = true;
                    if (gvExamRoom.Visible == true)
                    {
                        PanalPage.Visible = true;
                    }
                    else
                    {
                        PanalPage.Visible = false;
                    }
                }
                else
                {
                    UCError.ShowMessageError = SysMessage.ChooseData;
                    UCError.ShowModalError();
                    btnPopUp.Visible = false;
                    if (gvExamRoom.Visible == true)
                    {
                        PanalPage.Visible = true;
                    }
                    else
                    {
                        PanalPage.Visible = false;
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckBeforeSave())
                {
                    if (lblSeatAmountPlace.Text.ToInt() < txtSeatAmount.Text.ToInt())
                    {
                        UCError.ShowMessageError = "จำนวนที่นั่งของทุกห้องมากเกินกว่า<br>จำนวนที่นั่งที่สนามสอบนี้สามารถรองรับได้";
                        UCError.ShowModalError();
                    }
                    else
                    {
                        if (txtCodeRoom.Text.Length == 6)
                        {
                            BLL.ExamRoomBiz    biz = new BLL.ExamRoomBiz();
                            DTO.ConfigExamRoom ent = new DTO.ConfigExamRoom();
                            ent.EXAM_ROOM_CODE  = txtCodeRoom.Text;
                            ent.EXAM_ROOM_NAME  = txtNameRoom.Text;
                            ent.SEAT_AMOUNT     = txtSeatAmount.Text.ToShort();
                            ent.EXAM_PLACE_CODE = ddlExamPlace.SelectedValue;

                            var res = biz.InsertExamRoom(ent, UserProfile);
                            if (!res.IsError)
                            {
                                //initGvExamRoom();
                                UCSuccess.ShowMessageSuccess = SysMessage.SaveSucess;
                                UCSuccess.ShowModalSuccess();
                                btnSearch_Click(sender, e);
                                UpdatePanelGridviw.Update();
                            }
                            else
                            {
                                #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
                                ExamScheduleBiz bizGV = new ExamScheduleBiz();
                                var             Place = bizGV.GetGVExamRoomByPlaceCode(ddlExamPlace.SelectedValue.ToString(), resultPage, PageSize, false);

                                for (int i = 0; i < Place.DataResponse.Tables[0].Rows.Count; i++)
                                {
                                    DataTable DT = Place.DataResponse.Tables[0];
                                    DataRow   DR = DT.Rows[i];
                                    ExamRoomCode = DR["Exam_room_code"].ToString();
                                    if (ExamRoomCode == txtCodeRoom.Text)
                                    {
                                        break;
                                    }
                                }
                                if (ExamRoomCode == txtCodeRoom.Text)
                                {
                                    UCError.ShowMessageError = res.ErrorMsg;
                                    UCError.ShowModalError();
                                }
                                else
                                {
                                    UCError.ShowMessageError = "ไม่สามารถเพิ่มข้อมูลได้ เนื่องจากมีการยกเลิกการใช้งานรหัสห้องสอบ " + txtCodeRoom.Text + " แล้ว<br>กรุณาใช้รหัสห้องสอบอื่น";
                                    UCError.ShowModalError();
                                }
                            }
                        }
                        else
                        {
                            UCError.ShowMessageError = "รหัสห้องสอบต้องมีจำนวน 6 ตัวอักษรเท่านั้น";
                            UCError.ShowModalError();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UCError.ShowMessageError = ex.Message;
                UCError.ShowModalError();
            }
            // ClearControl();

            lblSeatAmountPlace.Text = "";
            txtCodeRoom.Text        = "";
            txtNameRoom.Text        = "";
            txtSeatAmount.Text      = "";
            uplPopUp.Update();
        }