示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var validate = Validation.Validate(this, "a");

            if (validate != "")
            {
                UCModalError1.ShowMessageError = validate;
                UCModalError1.ShowModalError();
            }
            else
            {
                DTO.ConditionGroup  conditiongroup = new DTO.ConditionGroup();
                List <DTO.Subjectr> subject        = new List <DTO.Subjectr>();
                conditiongroup.LICENSE_TYPE_CODE = ddlType.SelectedValue;
                conditiongroup.NOTE       = txtNote.Text;
                conditiongroup.START_DATE = Convert.ToDateTime(txtStartDate.Text);
                conditiongroup.USER_ID    = base.UserId;
                conditiongroup.USER_DATE  = DateTime.Now;

                if (check.Checked)
                {
                    conditiongroup.STATUS = "A";
                }
                else
                {
                    conditiongroup.STATUS = "I";
                }


                if (txtEndDate.Text != "")
                {
                    conditiongroup.END_DATE = Convert.ToDateTime(txtEndDate.Text);
                    if (conditiongroup.START_DATE > conditiongroup.END_DATE)
                    {
                        UCModalError1.ShowMessageError = "วันที่มีผลบังคับใช้ต้องมากกว่าถึงวันที่";
                        UCModalError1.ShowModalError();
                        return;
                    }
                }
                else
                {
                    conditiongroup.END_DATE = null;
                }

                foreach (GridViewRow item in GvGroup.Rows)
                {
                    subject.Add(new DTO.Subjectr
                    {
                        LICENSE_TYPE_CODE = ddlType.SelectedValue,
                        SUBJECT_CODE      = ((Label)(item.FindControl("lblSubjectCode"))).Text,
                        MAX_SCORE         = ((Label)(item.FindControl("lblMaxScore"))).Text.ToShort(),
                        GROUP_ID          = ((Label)(item.FindControl("lblGroup"))).Text.ToDecimal()
                    });
                }
                conditiongroup.Subject = subject;
                var res = biz.AddExamGroup(conditiongroup);
                if (res.ErrorMsg == null)
                {
                    txtEndDate.Text   = string.Empty;
                    txtStartDate.Text = string.Empty;
                    check.Checked     = false;
                    UCModalSuccess1.ShowMessageSuccess = "บันทึกข้อมูลเรียบร้อย";
                    UCModalSuccess1.ShowModalSuccess();
                    gvSearch.DataSource = biz.GetSubjectGroupSearch(ddlType.SelectedValue, 1, 100).DataResponse;
                    gvSearch.DataBind();

                    txtNote.Text         = "";
                    fieldSubject.Visible = false;
                }
                else
                {
                    if (res.ErrorMsg == "1")
                    {
                        UCModalError1.ShowMessageError = "วันที่มีผลบังคับใช้ต้องมากกว่าหรือเท่ากับหลักสูตรล่าสุด";
                        UCModalError1.ShowModalError();
                    }
                    else if (res.ErrorMsg == "2")
                    {
                        UCModalError1.ShowMessageError = "วันที่มีผลบังคับใช้ต้องน้อยกว่าหรือเท่าถึงวันที่ของหลักสูตรล่าสุด";
                        UCModalError1.ShowModalError();
                    }
                    else
                    {
                        UCModalError1.ShowMessageError = res.ErrorMsg;
                        UCModalError1.ShowModalError();
                    }
                }
            }
        }
示例#2
0
 public DTO.ResponseService <string> AddExamGroup(DTO.ConditionGroup conditiongroup)
 {
     return(svc.AddExamGroup(conditiongroup));
 }