Example #1
0
 protected void btnNext_Click(object sender, ImageClickEventArgs e)
 {
     if (ddlLicenseApprover.SelectedItem.Value.Equals("0"))
     {
         this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = "เลือกสมาคมที่ต้องการจะยื่นเรื่องเพื่อขอรับใบอนุญาต";
         this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
         this.MasterLicense.UpdatePanelLicense.Update();
         return;
     }
     else
     {
         DTO.ResponseMessage <bool> res = this.DocValidation();
         if ((res.ResultMessage == false) || (res.IsError))
         {
             this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = res.ErrorMsg;
             this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
             this.MasterLicense.UpdatePanelLicense.Update();
             return;
         }
         else if (res.ResultMessage == true)
         {
             this.MasterLicense.LicenseApprover = ddlLicenseApprover.SelectedValue;
             this.MenuForwardValidation();
         }
     }
 }
        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);
        }
Example #3
0
        protected void hplCancel_Click(object sender, EventArgs e)
        {
            try
            {
                var                        gr          = (GridViewRow)((LinkButton)sender).NamingContainer;
                var                        lblTimeCode = (Label)gr.FindControl("lblPlaceCode");
                string                     Key         = lblTimeCode.Text;
                ExamScheduleBiz            biz         = new ExamScheduleBiz();
                DTO.ResponseMessage <bool> DelP        = biz.DelPlace(Key, base.UserId.ToString());

                Boolean Del_time = DelP.ResultMessage;
                if (!Del_time)
                {
                    UCModalSuccess1.ShowMessageSuccess = "บันทึกสำเร็จ";
                    UCModalSuccess1.ShowModalSuccess();
                }
                else
                {
                    UCModalError1.ShowMessageError = "ไม่สามารถบันทึกได้";
                    UCModalError1.ShowModalError();
                }
                btn_Search_Click(sender, e);
            }
            catch
            {
            }
        }
Example #4
0
        protected void gvPayment_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            PaymentBiz bizPay = new PaymentBiz();

            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
            List <string> lsRegNo          = new List <string>();

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (gvPayment.DataSource != null)
                {
                    Label lblApproveDoc = (Label)e.Row.FindControl("lblApproveDoc");
                    if (lblApproveDoc != null)
                    {
                        if (lblApproveDoc.Text.Equals(SysMessage.LicenseApproveW) || lblApproveDoc.Text.Equals(SysMessage.LicenseApproveN))
                        {
                            e.Row.Enabled = false;
                        }
                        else
                        {
                            e.Row.Enabled = true;

                            #region สร้างใบสั่งจ่ายย่อย > NewCreatePayment

                            //Label lblRequestNo = (Label)e.Row.FindControl("lblHeadRequestNo");
                            //if (lblRequestNo != null)
                            //{

                            //    lsRegNo.Add(lblRequestNo.Text);

                            //    string ref1 = string.Empty;
                            //    //res = bizPay.NewCreatePayment(lsRegNo.ToArray(), "", this.MasterLicense.UserProfile.Id, "", Convert.ToString(this.MasterLicense.UserProfile.MemberType), );
                            //    res = bizPay.NewCreatePayment(lsRegNo.ToArray(), "", this.MasterLicense.UserProfile.Id, "", Convert.ToString(this.MasterLicense.UserProfile.MemberType), out ref1);


                            //    //Get RefNo
                            //    string refNo = ref1;
                            //    ImageButton btnPayment = (ImageButton)e.Row.FindControl("btnPayment");
                            //    btnPayment.Attributes.Add("onclick", string.Format("OpenPopup('{0}')", refNo));

                            //    if ((res.IsError) || (res.ResultMessage == false))
                            //    {

                            //        this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = res.ErrorMsg;
                            //        this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                            //    }
                            //    else
                            //    {
                            //        //this.MasterLicense.UCLicenseModelSuccess.ShowMessageSuccess = SysMessage.CreatePaymentSuccess;
                            //        //this.MasterLicense.UCLicenseModelSuccess.ShowModalSuccess();
                            //    }

                            //}

                            #endregion
                        }
                    }
                }
            }
        }
        private void GetDocReqName()
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
            DataCenterBiz biz = new DataCenterBiz();

            IAS.DTO.ResponseService <IAS.DTO.ConfigDocument[]> getDoc = biz.GetDocRequire(Convert.ToString(DTO.DocFunction.LICENSE_FUNCTION.GetEnumValue()),
                                                                                          Convert.ToString(this.MasterLicense.UserProfile.MemberType), this.MasterLicense.LicenseTypeCode, this.MasterLicense.PettionTypeCode);

            //Add Doc Req to lblDocReq
            if ((getDoc.DataResponse.Count() > 0) && (getDoc.DataResponse != null))
            {
                StringBuilder docName = new StringBuilder();
                if (getDoc.DataResponse.Count() == 1)
                {
                    docName.Append(getDoc.DataResponse[0].DOCUMENT_NAME + "&nbsp;" + "" + Environment.NewLine + "");
                }
                else
                {
                    for (int i = 0; i < getDoc.DataResponse.Count(); i++)
                    {
                        docName.Append((i + 1).ToString() + "." + getDoc.DataResponse[i].DOCUMENT_NAME + Environment.NewLine);
                    }
                }

                lblNote1.Visible = true;
                lblDocReq.Text   = docName.ToString();
            }
            //กรณีไม่ต้องแนบเอกสาร 25/11/2556
            else
            {
                lblNote1.Visible = false;
            }
        }
Example #6
0
        public DTO.ResponseMessage Authenticate(string usr, string pwd)
        {
            HttpClient client = new HttpClient();

            DTO.ResponseMessage responseMessage = new DTO.ResponseMessage();

            //La ruta se coloca asi directo para motivos de ejemplo, pero esto iria en un archivo de configuracion
            string path = string.Format("http://localhost:55918/api/Login?usr={0}&pwd={1}", usr, pwd);

            var task = client.GetAsync(path).ContinueWith((taskwithresponse) =>
            {
                var r          = taskwithresponse.Result;
                var jsonString = r.Content.ReadAsStringAsync();
                jsonString.Wait();
                //Corregir el parseo, existe el objeto response desde el controlador origen
                responseMessage = JsonConvert.DeserializeObject <DTO.ResponseMessage>(jsonString.Result);

                if (!r.IsSuccessStatusCode)
                {
                    responseMessage.HasError = true;
                }

                if (string.IsNullOrEmpty(responseMessage.HttpReDirect))
                {
                    responseMessage.HttpReDirect = "/Home/DetailList";
                }
            });

            task.Wait();

            return(responseMessage);
        }
Example #7
0
        public DTO.ResponseMessage <bool> UpdateOIC(string userId, string oicUserName, string preNameCode,
                                                    string firstName, string lastName,
                                                    string sex, string memberType, byte[] imgSign)
        {
            if (memberType == "5")
            {
                DTO.ResponseMessage <bool>       res      = new DTO.ResponseMessage <bool>();
                FileManagement.RemoteFileInfo    remote   = new FileManagement.RemoteFileInfo();
                FileManagement.FileServiceClient svc_file = new FileManagement.FileServiceClient();
                Stream stream = new MemoryStream(imgSign);
                remote.FileByteStream = stream;
                remote.firstName      = firstName;
                remote.lastName       = lastName;
                remote.memberType     = memberType;
                remote.oicUserName    = oicUserName;
                remote.preNameCode    = preNameCode;
                remote.sex            = sex;
                remote.userId         = userId;

                svc_file.UpdateOIC(firstName, lastName, memberType, oicUserName, preNameCode, sex, userId, stream);
                return(res);
            }
            else
            {
                return(svc.UpdateOIC(userId, oicUserName, preNameCode, firstName, lastName, sex, memberType, imgSign));
            }
        }
Example #8
0
        protected void btnGenReceiptAll_Click(object sender, EventArgs e)
        {
            if (lsGenRecive.Count == 0)
            {
                this.MasterSite.ModelError.ShowMessageError = SysMessage.ChooseData;
                this.MasterSite.ModelError.ShowModalError();
            }
            else
            {
                BLL.PaymentBiz             biz = new BLL.PaymentBiz();
                DTO.ResponseMessage <bool> res = biz.GenReceiptAll(lsGenRecive.ToArray());
                if (res.ResultMessage == false)
                {
                    this.MasterSite.ModelError.ShowMessageError = res.ErrorMsg;
                    this.MasterSite.ModelError.ShowModalError();
                }
                else
                {
                    this.MasterSite.ModelSuccess.ShowMessageSuccess = Resources.infoGenPayment_001;
                    this.MasterSite.ModelSuccess.ShowModalSuccess();
                    lsGenRecive.Clear();
                }

                BindDataInGridView();
                this.UpdatePanelSearch.Update();
            }
        }
Example #9
0
        public DTO.ResponseMessage <bool> SubmitReceiveLicenseGroupUpload(string groupId,
                                                                          List <DTO.AttachFileDetail> attachFiles,
                                                                          string targetAttatchFilePath, string userId)
        {
            var res = new DTO.ResponseMessage <bool>();


            try
            {
                if (!res.IsError)
                {
                    List <DTO.AttatchFileLicense> attchList = new List <DTO.AttatchFileLicense>();
                    DTO.ResponseService <DTO.AttatchFileLicense[]> resmove = svc.MoveExtachFile(userId, groupId, attachFiles.ToArray());
                    //res = svc.SubmitSingleOrGroupReceiveLicense(groupId, attchList.ToArray());
                    if (resmove.IsError)
                    {
                        res.ErrorMsg = resmove.ErrorMsg;
                        return(res);
                    }

                    //res = svc.SubmitSingleOrGroupReceiveLicense(groupId, resmove.DataResponse);
                }
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ";
            }
            return(res);
        }
Example #10
0
        public void UpdateOIC(RemoteFileInfo request)
        {
            var res = new DTO.ResponseMessage <bool>();

            try
            {
                var ctx      = new IASPersonEntities();
                var entExist = ctx.AG_IAS_USERS
                               .Where(w => w.USER_ID == request.userId)
                               .FirstOrDefault();
                if (entExist == null)
                {
                    res.ErrorMsg = Resources.errorPersonService_014 + request.oicUserName + Resources.errorPersonService_015;
                    // return res;
                }


                var personExist = ctx.AG_IAS_PERSONAL_T.Where(w => w.ID == request.userId).FirstOrDefault();
                if (personExist == null)
                {
                    res.ErrorMsg = Resources.errorPersonService_014 + request.oicUserName + Resources.errorPersonService_015;
                    // return res;
                }

                //บันทึกข้อมูลลง HIS
                AG_IAS_HIST_PERSONAL_T HisPerson = new AG_IAS_HIST_PERSONAL_T();
                HisPerson.TRANS_ID      = OracleDB.GetGenAutoId();
                HisPerson.PRE_NAME_CODE = personExist.PRE_NAME_CODE;
                HisPerson.NAMES         = personExist.NAMES;
                HisPerson.LASTNAME      = personExist.LASTNAME;
                HisPerson.SEX           = personExist.SEX;
                HisPerson.MEMBER_TYPE   = personExist.MEMBER_TYPE;
                HisPerson.IMG_SIGN      = personExist.IMG_SIGN;
                ctx.AG_IAS_HIST_PERSONAL_T.AddObject(HisPerson);

                personExist.PRE_NAME_CODE = request.preNameCode;
                personExist.NAMES         = request.firstName;
                personExist.LASTNAME      = request.lastName;
                personExist.SEX           = request.sex;

                if (personExist.MEMBER_TYPE == "5" && request.FileByteStream != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        request.FileByteStream.CopyTo(ms);
                        personExist.IMG_SIGN = ms.ToArray();
                    }
                }

                ctx.SaveChanges();
                res.ResultMessage = true;
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ";
                LoggerFactory.CreateLog().Fatal("PersonService_UpdateOIC", ex);
            }
        }
Example #11
0
        public DTO.ResponseMessage <bool> IsChangePassword(DTO.UserProfile userProfile)
        {
            DTO.ResponseMessage <Boolean> res = new DTO.ResponseMessage <bool>();
            try
            {
                var User = base.ctx.AG_IAS_USERS.FirstOrDefault(s => s.USER_ID == userProfile.Id);
                if (User == null)
                {
                    res.ErrorMsg = "ไม่พบข้อมูลผู้ใช้งาน";
                    LoggerFactory.CreateLog().LogError(String.Format("ไม่พบข้อมูลผู้ใช้งาน AG_IAS_USERS->USER_ID :{0}", userProfile.Id));
                    return(res);
                }

                res.ResultMessage = false;

                // เปลี่ยนรหัสผ่านครั้งแรกที่ Login เฉพาะเจ้าหน้าที่สนามสอบ
                if (User.USER_TYPE == "7")
                {
                    var begin_config = base.ctx.AG_IAS_APPROVE_CONFIG.FirstOrDefault(s => s.KEYWORD == "Change_Password_Begin");
                    if (begin_config.ITEM_VALUE == "Y" && String.IsNullOrEmpty(User.RESET_TIMES.ToString()))
                    {
                        res.ResultMessage = true;
                        return(res);
                    }
                }

                //เปลี่ยนทุก 3 เดือน
                var month_config = base.ctx.AG_IAS_APPROVE_CONFIG.FirstOrDefault(s => s.KEYWORD == "Change_Password_3months");
                if (month_config.ITEM_VALUE == "Y")
                {
                    int      addMonths  = 3;
                    DateTime ChangsPass = (DateTime)User.LASTPASSWORD_CHANGDATE;

                    string formatCurrDate = DateTime.Now.ToString("dd/MM/yyyy");
                    string formatPassDate = (ChangsPass.AddMonths(addMonths)).ToString("dd/MM/yyyy");

                    DateTime currTime = DateTime.Parse(formatCurrDate);
                    DateTime passTime = DateTime.Parse(formatPassDate);

                    int dateCompare = DateTime.Compare(passTime, currTime);
                    // วันที่เปลี่ยน password ล่าสุด + เงื่อนไข  แล้วน้อยกว่าวันที่ปัจจุบัน
                    if (dateCompare < 1)
                    {
                        res.ResultMessage = true;
                    }
                    else
                    {
                        res.ResultMessage = false;
                    }
                }
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "พบข้อผิดพลาดในการตรวจสอบการเปลี่ยนรหัสผ่าน";
                LoggerFactory.CreateLog().Fatal(string.Format("AccountService_IsChangePassword USER_ID :{0}", userProfile.Id), ex);
            }
            return(res);
        }
Example #12
0
        /// <summary>
        /// RequiredFieldValidator & RegularExpressionValidator Validation Function
        /// Added new & Last Update 31/10/2556
        /// by Nattapong
        /// </summary>
        /// <param name="registrationType"></param>
        /// <param name="registration"></param>
        public DTO.ResponseMessage <bool> ControlValidationBeforeSubmit(Page child)
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
            StringBuilder strBuild         = new StringBuilder();

            this.Page.Validate(this.GroupValidation);
            if (this.Page.IsValid)
            {
                res.ResultMessage = true;
            }
            else
            {
                if (child.Validators.Count > 0)
                {
                    for (int i = 0; i < child.Validators.Count; i++)
                    {
                        string nameType = child.Validators[i].GetType().Name;
                        if (nameType == "RequiredFieldValidator")
                        {
                            bool validate = child.Validators[i].IsValid;
                            if (validate == false)
                            {
                                strBuild.Append(child.Validators[i].ErrorMessage + "<br/>");
                            }
                        }
                        if (nameType == "RegularExpressionValidator")
                        {
                            bool validate = child.Validators[i].IsValid;
                            if (validate == false)
                            {
                                strBuild.Append(child.Validators[i].ErrorMessage + "<br/>");
                            }
                        }
                        if (nameType == "CompareValidator")
                        {
                            bool validate = child.Validators[i].IsValid;
                            if (validate == false)
                            {
                                strBuild.Append(child.Validators[i].ErrorMessage + "<br/>");
                            }
                        }
                    }
                }
            }

            if (strBuild.ToString() != string.Empty)
            {
                res.ErrorMsg      = strBuild.ToString();
                res.ResultMessage = false;
            }
            else
            {
                res.ResultMessage = true;
            }

            return(res);
        }
Example #13
0
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddlPlaceGroup.SelectedValue != "")
         {
             if (txtSeat.Text.Trim() == "" || txtPlace.Text.Trim() == "" || txtCode.Text.Trim() == "")
             {
                 UCModalError1.ShowMessageError = "กรุณาระบุข้อมูลให้ครบ";
                 UCModalError1.ShowModalError();
             }
             else
             {
                 if (txtSeat.Text.ToInt() > 30000)
                 {
                     UCModalError1.ShowMessageError = "สนามสอบแต่ละแห่งสามารถรองรับผู้สมัครสอบได้สูงสุด 30,000 คน เท่านั้น";
                     UCModalError1.ShowModalError();
                 }
                 else
                 {
                     if (txtCode.Text.Length == 5)
                     {
                         Boolean addnew = true;
                         if (txtCode.Enabled == false)
                         {
                             addnew = false;
                         }
                         ExamScheduleBiz            biz    = new ExamScheduleBiz();
                         DTO.ResponseMessage <bool> SaveOK = biz.SavePlace(ddlPlaceG.SelectedValue.ToString(), ddlProvince.SelectedValue.ToString(), txtCode.Text, txtPlace.Text, txtSeat.Text, chkFree.Checked, base.UserId.ToString(), addnew, ddlPlaceGroup.SelectedValue.ToString());
                         if (SaveOK.ResultMessage == true)
                         {
                             UCModalSuccess1.ShowMessageSuccess = SysMessage.SaveSucess;
                             UCModalSuccess1.ShowModalSuccess();
                             btn_Search_Click(sender, e);
                             btn_Cancle_Click(sender, e);
                             UpdatePanelUpload.Update();
                         }
                         else
                         {
                             UCModalError1.ShowMessageError = SaveOK.ErrorMsg;
                             UCModalError1.ShowModalError();
                         }
                     }
                     else
                     {
                         UCModalError1.ShowMessageError = "รหัสสนามสอบต้องมีจำนวน 5 ตัวอักษรเท่านั้น";
                         UCModalError1.ShowModalError();
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }
Example #14
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            DTO.ResponseMessage <bool> resValidate = this.RegPassValidation();
            if (resValidate.ResultMessage == false)
            {
                UCModalError.ShowMessageError = this.RegPassValidation().ErrorMsg;
                UCModalError.ShowModalError();
                return;
            }
            else if (resValidate.ResultMessage == true)
            {
                if (txtNewPassword.Text == txtConfirmPassword.Text)
                {
                    //chek รหัสเดิมห้ามตรงกับรหัสใหม่
                    if (txtOldPassword.Text == txtNewPassword.Text)
                    {
                        UCModalError.ShowMessageError = "รหัสผ่านใหม่ห้ามซ้ำกับรหัสผ่านเดิม";
                        UCModalError.ShowModalError();
                        return;
                    }



                    var biz = new BLL.UserAuthenBiz();

                    if (Session[PageList.UserProfile] != null)
                    {
                        DTO.UserProfile userProfile = (DTO.UserProfile)Session[PageList.UserProfile];
                        var             res         = biz.ChangePassword(userProfile.Id, txtOldPassword.Text, txtNewPassword.Text);
                        if (res.IsError)
                        {
                            var errorMsg = res.ErrorMsg;

                            UCModalError.ShowMessageError = res.ErrorMsg;
                            UCModalError.ShowModalError();
                            return;
                        }
                        else
                        {
                            string Alert = "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.assign('../home.aspx')";
                            ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Alert, true);
                        }
                    }
                    else
                    {
                        var errorMsg = Resources.errorChangePass_001;

                        UCModalError.ShowMessageError = errorMsg;
                        UCModalError.ShowModalError();
                        return;
                    }
                }
            }
        }
Example #15
0
        public DTO.ResponseMessage <bool> ValidateApplicantSingleBeforeSubmit(IEnumerable <DTO.ApplicantTemp> app)
        {
            DTO.ResponseMessage <bool> response = new DTO.ResponseMessage <bool>();

            //ValidateApplicantSingleBeforeSubmitRequest applicants = new ValidateApplicantSingleBeforeSubmitRequest() { Applicants = app };
            //return svc.ValidateApplicantSingleBeforeSubmit(applicants);
            //return response;
            FileManagement.FileServiceClient file = new FileManagement.FileServiceClient();

            return(file.ValidateApplicantSingleBeforeSubmit(app.ToArray()));
        }
Example #16
0
        public DTO.ResponseMessage <bool> ChangePassword(DTO.User user, string newPassword)
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
            try
            {
                string _oldPassword = Utils.EncryptSHA256.Encrypt(user.USER_PASS);
                string _newPassword = Utils.EncryptSHA256.Encrypt(newPassword);

                AG_IAS_USERS ent = base.ctx.AG_IAS_USERS.FirstOrDefault(s => s.USER_ID == user.USER_ID);
                if (ent == null)
                {
                    res.ErrorMsg = "ไม่พบข้อมูลผู้ใช้งาน";
                    LoggerFactory.CreateLog().LogError(String.Format("ไม่พบข้อมูลผู้ใช้งาน AG_IAS_USERS->USER_ID :{0}", user.USER_ID));
                    return(res);
                }

                if (ent.USER_PASS != _oldPassword)
                {
                    res.ErrorMsg = "รหัสผ่านเดิมไม่ถูกต้อง";
                    return(res);
                }

                if (ent.USER_PASS == _newPassword)
                {
                    res.ErrorMsg = "รหัสผ่านใหม่ต้องไม่ซ้ำรหัสผ่านเดิม";
                    return(res);
                }

                ent.USER_PASS = _newPassword;
                ent.LASTPASSWORD_CHANGDATE = DateTime.Now;
                ent.UPDATED_BY             = user.USER_ID;
                ent.UPDATED_DATE           = DateTime.Now;

                int Reset_pass_time = (ent.RESET_TIMES != null) ? Convert.ToInt16(ent.RESET_TIMES) : 0;
                if (Reset_pass_time == 0)
                {
                    ent.RESET_TIMES = 1;
                }
                else
                {
                    ent.RESET_TIMES = Reset_pass_time + 1;
                }

                base.ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "พบข้อผิดพลาดในการเปลี่ยนรหัสผ่าน";
                LoggerFactory.CreateLog().Fatal(String.Format("AccountService_ChangePassword USER_ID :{0}", user.USER_ID), ex);
            }
            return(res);
        }
Example #17
0
 /// <summary>
 /// นำผลการสอบจาก Temp เข้าระบบ
 /// </summary>
 /// <param name="groupId">เลขที่กลุ่ม Upload</param>
 /// <param name="userId">user id</param>
 /// <param name="expireDate">วันที่หมดอายุ</param>
 /// <returns>ResponseMessage<bool></returns>
 public DTO.ResponseMessage<bool> ExamResultUploadToSubmitNew(string groupId, string userId, DateTime? expireDate,string testingNo)
 {
     try
     {
         return svc.ExamResultUploadToSubmitNew(groupId, userId, expireDate, testingNo);
     }
     catch (Exception ex)
     {
         DTO.ResponseMessage<bool> res = new DTO.ResponseMessage<bool>();
         res.ErrorMsg = ex.Message;
         return res;
     }
 }
Example #18
0
        private DTO.ResponseMessage <bool> PasswordValidation()
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
            try
            {
                this.Page.Validate("ChangePW");
                if (this.Page.IsValid)
                {
                    res.ResultMessage = true;
                }
                else
                {
                    if (this.reqNewPW.IsValid == false)
                    {
                        res.ErrorMsg      = this.reqNewPW.ErrorMessage;
                        res.ResultMessage = false;
                    }
                    else if (this.reqRegNewPW.IsValid == false)
                    {
                        res.ErrorMsg      = this.reqRegNewPW.ErrorMessage;
                        res.ResultMessage = false;
                    }
                    else if (this.reqConfirmPW.IsValid == false)
                    {
                        res.ErrorMsg      = this.reqConfirmPW.ErrorMessage;
                        res.ResultMessage = false;
                    }
                    else if (this.reqRegConfirmPW.IsValid == false)
                    {
                        res.ErrorMsg      = this.reqRegConfirmPW.ErrorMessage;
                        res.ResultMessage = false;
                    }
                    else if (this.reqComparePW.IsValid == false)
                    {
                        res.ErrorMsg      = this.reqComparePW.ErrorMessage;
                        res.ResultMessage = false;
                    }
                    else if ((this.reqNewPW.IsValid == true) && (this.reqRegNewPW.IsValid == true) && (this.reqConfirmPW.IsValid == true) &&
                             (this.reqRegConfirmPW.IsValid == true) && (this.reqComparePW.IsValid == true))
                    {
                        res.ResultMessage = true;
                    }
                }
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ";
            }

            return(res);
        }
Example #19
0
        public DTO.ResponseMessage <bool> MoveFile(string sourceFile, string targetFile)
        {
            var res = new DTO.ResponseMessage <bool>();

            try
            {
                res.ResultMessage = true;
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ";
            }
            return(res);
        }
Example #20
0
        public DTO.ResponseMessage <bool> EMailValidation()
        {
            //var res = new DTO.ResponseMessage<bool>();
            BLL.RegistrationBiz biz = new BLL.RegistrationBiz();
            DTO.Registration    ent = new Registration();
            ent.ID_CARD_NO  = txtIDCard.Text;
            ent.MEMBER_TYPE = DTO.MemberType.Association.GetEnumValue().ToString();
            ent.NAMES       = txtFirstName.Text;
            ent.LASTNAME    = txtLastName.Text;
            ent.EMAIL       = txtEmail.Text;
            DTO.ResponseMessage <bool> res = biz.EntityValidation(DTO.RegistrationType.Association, ent);
            //DTO.ResponseMessage<bool> res = biz.EntityValidation(DTO.RegistrationType.Association, GetAsscoEntity());

            return(res);
        }
Example #21
0
        public DTO.ResponseMessage <bool> EMailValidation()
        {
            //var res = new DTO.ResponseMessage<bool>();
            BLL.RegistrationBiz biz = new BLL.RegistrationBiz();
            DTO.Registration    ent = new Registration();
            ent.ID_CARD_NO  = txtIDNumber.Text;
            ent.MEMBER_TYPE = ((int)DTO.MemberType.General).ToString();
            ent.NAMES       = txtFirstName.Text;
            ent.LASTNAME    = txtLastName.Text;
            ent.EMAIL       = txtEmail.Text;
            DTO.ResponseMessage <bool> res = biz.EntityValidation(DTO.RegistrationType.General, ent);
            //DTO.ResponseMessage<bool> res = biz.EntityValidation(DTO.RegistrationType.General, GetRegistrationFromDataControl());

            return(res);
        }
Example #22
0
        protected void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(st_hr.SelectedValue) > Convert.ToInt32(en_hr.SelectedValue))
                {
                    UCModalError1.ShowMessageError = "เวลาเริ่มต้นมากกว่าเวลาสิ้นสุด";
                    UCModalError1.ShowModalError();
                    return;
                }
                else if (st_hr.SelectedValue.ToString() == en_hr.SelectedValue.ToString())
                {
                    UCModalError1.ShowMessageError = "เวลาเริ่มต้นเท่ากับเวลาสิ้นสุด";
                    UCModalError1.ShowModalError();
                    return;
                }
                ExamRoomBiz biz = new ExamRoomBiz();
                DTO.ResponseMessage <bool> AddTime = biz.Add_Time(st_hr.SelectedValue.ToString(), st_min.SelectedValue.ToString(),
                                                                  en_hr.SelectedValue.ToString(), en_min.SelectedValue.ToString(), base.UserId.ToString());

                Boolean add_time = AddTime.ResultMessage;
                if (add_time)
                {
                    UCModalSuccess1.ShowMessageSuccess = "บันทึกสำเร็จ";
                    UCModalSuccess1.ShowModalSuccess();
                }
                else
                {
                    UCModalError1.ShowMessageError = "ไม่สามารถบันทึกได้";
                    UCModalError1.ShowModalError();
                }
                btn_Add.Visible    = false;
                btn_Search.Visible = true;
                //st_hr.SelectedIndex = 0;
                //st_min.SelectedIndex = 0;
                //en_hr.SelectedIndex = 0;
                //en_min.SelectedIndex = 0;
                st_hr.Enabled  = true;
                st_min.Enabled = true;
                en_min.Enabled = true;
                en_hr.Enabled  = true;
                btn_Search_Click(sender, e);
                UpdatePanelGridviewExamTime.Update();
            }
            catch
            {
            }
        }
Example #23
0
        protected void btnSubmitExtraApproveRegis_Click(object sender, EventArgs e)
        {
            DataCenterBiz biz = new DataCenterBiz();
            //int chkCount = 0;
            List <CheckBox> chkls             = new List <CheckBox>();
            List <DTO.ConfigExtraEntity> data = new List <DTO.ConfigExtraEntity>();


            foreach (CheckBox chk in pnlProfile.Controls.OfType <CheckBox>())
            {
                if (chk.Checked == true)
                {
                    data.Add(new DTO.ConfigExtraEntity
                    {
                        Name  = chk.Text,
                        Value = 1
                    });
                }
                else
                {
                    data.Add(new DTO.ConfigExtraEntity
                    {
                        Name  = chk.Text,
                        Value = 0
                    });
                }
            }

            if (data != null)
            {
                DTO.ResponseMessage <bool> res = biz.UpdateNewConfigApproveMember(data.ToArray(), base.UserProfile);
                if (res.IsError)
                {
                    UCModalError.ShowMessageError = res.ErrorMsg;
                    UCModalError.ShowModalError();
                }
                else
                {
                    UCModalSuccess.ShowMessageSuccess = "บันทึกข้อมูลเรียบร้อย";
                    UCModalSuccess.ShowModalSuccess();

                    this.GetNewRegistrationApprove();
                    UpdatePanelGrid.Update();
                }
            }
        }
Example #24
0
        /// <summary>
        /// Files check before Agreement confirmed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private DTO.ResponseMessage <bool> DocValidation()
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();

            DTO.ResponseMessage <bool> docRes = this.ucAttachLicense.DocRequire();

            if (docRes.ResultMessage == true)
            {
                res = docRes;
            }
            else if ((docRes.ResultMessage == false) || (docRes.IsError))
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = docRes.ErrorMsg.ToString();
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                this.MasterLicense.UpdatePanelLicense.Update();
                res = docRes;
            }

            return(res);
        }
Example #25
0
        /// <summary>
        /// DateTime Compare
        /// Result ได้ -1 If  Time_1 น้อยกว่า  Time_2
        /// Result ได้ 0  If  Time_1 เท่ากับ Time_2
        /// Result ได้ 1  If  Time_1 มากกว่า Time_2
        /// How to use Compare?
        /// 1.เวลาปัจจุบัน เทียบกับ เวลาที่เลือก
        /// Coding BY Natta
        /// </summary>
        public DTO.ResponseMessage <bool> DateValidation(string birthDay)
        {
            DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();

            if ((birthDay != null) && (birthDay != ""))
            {
                DateTime currDate     = DateTime.Now;
                DateTime dateFromCtrl = Convert.ToDateTime(birthDay);

                string   currDateFormat  = String.Format("{0:dd/MM/yyy}", currDate).ToString();
                string   birthDateFormat = String.Format("{0:dd/MM/yyy}", dateFromCtrl).ToString();
                DateTime currTime        = DateTime.Parse(currDateFormat);
                DateTime birthTime       = DateTime.Parse(birthDateFormat);

                int dateCompare = DateTime.Compare(birthTime, currTime);
                //BirthDay < CurrentTime
                if (dateCompare == -1)
                {
                    res.ResultMessage = true;
                }
                //BirthDay == CurrentTime
                if (dateCompare == 0)
                {
                    res.ErrorMsg      = SysMessage.RegBirthDayValidationF;
                    res.ResultMessage = false;
                }
                //BirthDay > CurrentTime
                if (dateCompare == 1)
                {
                    res.ErrorMsg      = SysMessage.RegBirthDayValidationF;
                    res.ResultMessage = false;
                }
            }
            else
            {
                res.ErrorMsg      = Resources.errorSysMessage_RegBirthDayValidationF;
                res.ResultMessage = false;
            }

            return(res);
        }
Example #26
0
        /// <summary>
        /// Control Validate Before Edit
        /// If CurPage = "1" is GeneralMemberType must to validate birthday before submit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOk_Click(object sender, EventArgs e)
        {
            //General BirthDay Validation
            //CurrentPage Check
            if ((this.CurPage != null) && (this.CurPage != ""))
            {
                //PersonGeneral
                if (this.CurPage.Equals("1"))
                {
                    //Control Validation
                    //DTO.ResponseMessage<bool> res = this.ControlValidationBeforeSubmit(this.Page);
                    DTO.ResponseMessage <bool> resBirthDay = this.DateValidation(PersonGeneral.TextboxBirthDay.Text);
                    if ((resBirthDay.ResultMessage == false) || (resBirthDay.IsError))
                    {
                        ModelError.ShowMessageError = resBirthDay.ErrorMsg;
                        ModelError.ShowModalError();
                        return;
                    }
                }

                //Control Validation
                DTO.ResponseMessage <bool> res = this.ControlValidationBeforeSubmit(this.Page);
                if (res.ResultMessage == true)
                {
                    if (OkRegister_Click != null)
                    {
                        OkRegister_Click(sender, e);
                    }
                }
                if ((res.ResultMessage == false) || (res.IsError))
                {
                    ModelError.ShowMessageError = res.ErrorMsg;
                    ModelError.ShowModalError();
                    return;
                }
            }

            //PnlAddButton.Visible = false;
        }
Example #27
0
        //log4net
        protected void StatusA_Click(object sender, EventArgs e)
        {
            GridViewRow gr               = (GridViewRow)((LinkButton)sender).NamingContainer;
            Label       group_request    = (Label)gr.FindControl("lblGroupRequsetNo");
            Label       lblReceiptNo     = (Label)gr.FindControl("lblReceiptNo");
            Label       lblHEADREQUESTNO = (Label)gr.FindControl("lblHEADREQUESTNO");
            Label       lblPAYMENTNO     = (Label)gr.FindControl("lblPAYMENTNO");

            lsGenRecive.Add(new DTO.GenReceipt
            {
                RECEIPT_NO      = lblReceiptNo.Text,
                HEAD_REQUEST_NO = lblHEADREQUESTNO.Text,
                PAYMENT_NO      = lblPAYMENTNO.Text,
                RECEIPT_BY_ID   = base.UserProfile.Id,
            });
            if (lsGenRecive.Count == 0)
            {
                this.MasterSite.ModelError.ShowMessageError = SysMessage.ChooseData;
                this.MasterSite.ModelError.ShowModalError();
            }
            else
            {
                BLL.PaymentBiz             biz = new BLL.PaymentBiz();
                DTO.ResponseMessage <bool> res = biz.GenReceiptAll(lsGenRecive.ToArray());
                if (res.ResultMessage == false)
                {
                    this.MasterSite.ModelError.ShowMessageError = res.ErrorMsg;
                    this.MasterSite.ModelError.ShowModalError();
                }
                else
                {
                    this.MasterSite.ModelSuccess.ShowMessageSuccess = Resources.infoGenPayment_001;
                    this.MasterSite.ModelSuccess.ShowModalSuccess();
                }
                BindDataInGridView();
                lsGenRecive.Clear();
                this.UpdatePanelSearch.Update();
            }
        }
Example #28
0
        public Boolean SaveChanges()
        {
            BLL.DataCenterBiz          biz             = new BLL.DataCenterBiz();
            IList <DTO.ConfigDocument> configDocuments = new List <DTO.ConfigDocument>();

            foreach (GridViewRow row in this.Rows)
            {
                String             id         = ((Label)row.Cells[0].Controls[0]).Text;
                Boolean            checkValue = ((CheckBox)row.Cells[4].Controls[0]).Checked;
                DTO.ConfigDocument config     = new DTO.ConfigDocument();
                config.ID = Convert.ToInt16(id);
                config.DOCUMENT_REQUIRE = (checkValue) ? "Y" : "N";
                configDocuments.Add(config);
            }
            DTO.UserProfile profile           = (DTO.UserProfile)Context.Session[PageList.UserProfile];
            DTO.ResponseMessage <Boolean> res = biz.UpdateConfigApproveLicense(configDocuments.ToList(), profile);
            if (res.IsError)
            {
                return(false);
            }

            return(true);
        }
Example #29
0
        protected void btnNext_Click(object sender, ImageClickEventArgs e)
        {
            //Control Validation
            DTO.ResponseMessage <bool> res = this.MasterLicense.ControlValidationBeforeSubmit(this.Page);
            if ((res.ResultMessage == false) || (res.IsError))
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = res.ErrorMsg;
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                return;
            }

            if ((this.MasterLicense.SelectedLicenseNo == null) || (this.MasterLicense.SelectedLicenseNo == ""))
            {
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.LicenseNull;
                this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                this.MasterLicense.UpdatePanelLicense.Update();
                return;
            }
            else
            {
                if (this.ucReplaceLi.GridviewRenewLicense.Rows.Count > 0)
                {
                    this.MasterLicense.LicenseRenameFirstName = txtFirstName.Text.Trim();
                    this.MasterLicense.LicenseRenameLastName  = txtLastName.Text.Trim();
                    MasterLicense.Step += 1;
                    Response.Redirect("../License/LicenseAttatchFiles.aspx?M=" + MasterLicense.Menu + "&S=" + MasterLicense.Step + "");
                }
                else
                {
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowMessageError = SysMessage.RenewLicenseNotFound;
                    this.MasterLicense.UCLicenseUCLicenseModelError.ShowModalError();
                    this.MasterLicense.UpdatePanelLicense.Update();
                    return;
                }
            }
        }
Example #30
0
 /// <summary>
 /// เพิ่มข้อมูล User ที่เป็น คปภ.
 /// </summary>
 /// <param name="employeeNo">รหัสพนักงาน คปภ.</param>
 /// <param name="preNameCode">รหัสคำนำ</param>
 /// <param name="firstName">ชื่อ</param>
 /// <param name="lastName">นามสกุล</param>
 /// <param name="sex">เพศ M=ชาย, F=หญิง</param>
 /// <returns>ResponseMessage<bool></returns>
 public DTO.ResponseMessage <bool> InsertOIC(string oicEmpNo, string oicUserName, string preNameCode,
                                             string firstName, string lastName,
                                             string sex, string oicTypeCode, byte[] sign)
 {
     //ไม่ต้องเซ็ค รหัส AD ของเจ้าหน้าที่ คปภ.
     if (svc.IsRightUserOIC(oicUserName).ResultMessage)
     {
         // if(true)
         if (oicTypeCode == "2")
         {
             DTO.ResponseMessage <bool>       res      = new DTO.ResponseMessage <bool>();
             FileManagement.FileServiceClient svc_file = new FileManagement.FileServiceClient();
             Stream stream = new MemoryStream(sign);
             try
             {
                 svc_file.InsertOIC(firstName, lastName, oicEmpNo, oicTypeCode, oicUserName, preNameCode, sex, stream);
             }
             catch (Exception ex)
             {
                 res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ";
             }
             return(res);
         }
         else
         {
             return(svc.InsertOIC(oicEmpNo, oicUserName, preNameCode, firstName, lastName, sex, oicTypeCode, sign));
         }
     }
     else
     {
         DTO.ResponseMessage <bool> res = new DTO.ResponseMessage <bool>();
         res.ResultMessage = false;
         res.ErrorMsg      = Resources.errorPersonBiz_002 + oicUserName + Resources.errorPersonBiz_003;
         return(res);
     }
 }