public void AddDetail(AG_IAS_PAYMENT_G_T payment) { _currentRow++; AG_IAS_PERSONAL_T person = _ctx.AG_IAS_PERSONAL_T.Where(p => p.ID == payment.CREATED_BY).FirstOrDefault(); LineKTBBankDetail detail = new LineKTBBankDetail() { SequenceNo = _currentRow.ToString(), BankCode = _bankCode, CompanyAccount = _companyAccount, PaymentDate = EffactiveDateString, PaymentTime = _effactiveDate.AddMinutes(30).AddSeconds(8).ToString("HHmmss"), CustomerName = (person == null) ? "" : String.Format("{0} {1}", person.NAMES, person.LASTNAME), Customer_No_Ref1 = payment.GROUP_REQUEST_NO, Ref2 = (payment.REF2 == null)?"":payment.REF2, Ref3 = "", BranchNo = "0602", TellerNo = "9953", KindOfTransaction = "C", TransactionCode = "CSH", ChequeNo = "", Amount = ((payment.GROUP_AMOUNT == null)?"": ((Decimal)payment.GROUP_AMOUNT).ToString("0.00").Replace(".", "")), ChequeBankCode = "", Spece = "" }; _lineKTBBankDetails.Add(detail); }
public static bool SendMailChangePasswordRegistration(AG_IAS_PERSONAL_T person, String username, String oldpassword, String newpassword) { StringBuilder emailBody = new StringBuilder(); String webUrl = String.Empty; if (person.MEMBER_TYPE.Equals(DTO.MemberType.General.GetEnumValue().ToString()) || person.MEMBER_TYPE.Equals(DTO.MemberType.Association.GetEnumValue().ToString()) || person.MEMBER_TYPE.Equals(DTO.MemberType.Insurance.GetEnumValue().ToString())) { webUrl = ConfigurationManager.AppSettings["WebPublicUrlForUser"].ToString(); } else { webUrl = ConfigurationManager.AppSettings["WebPublicUrl"].ToString(); } string emailAddress = person.EMAIL; string fullname = String.Format("{0} {1} {2}", "", person.NAMES, person.LASTNAME); emailBody.AppendLine(String.Format("เนื่องด้วย {0} ได้ทำการเปลี่ยนรหัสผ่าน ระบบช่องทางการบริการตัวแทนหรือนายหน้าประกันภัยแบบเบ็ดเสร็จ<br/><br />", fullname)); emailBody.AppendLine(String.Format("ชื่อผู้ใช้ระบบ : {0} <br />", username)); emailBody.AppendLine(String.Format("รหัสผ่านใหม่ของคุณคือ {0} <br /><br />", newpassword)); String paras = Utils.CryptoBase64.Encryption(String.Format("{0}||{1}||{2}||{3}", username, oldpassword, newpassword, person.EMAIL)); String linkrenew = String.Format("<a href='{0}ForgetPassword/ConfirmRenew.aspx?renew={1}'>คลิกเพื่อยืนยันการเปลี่ยนรหัสผ่าน</a>", webUrl, paras); String link = String.Format("<a href='{0}home.aspx'>คลิกเพื่อเข้าใช้ระบบ</a>", webUrl); emailBody.AppendLine(linkrenew + "<br /><br />"); emailBody.AppendLine(link + "<br /><br />"); try { EmailSender.Sending(emailBody, emailAddress).Sent(); } catch (Exception) { return(false); } return(true); }
public void Test() { String email = "*****@*****.**"; String username = "******"; String idCard = "1944316199773"; String emailchange = "*****@*****.**"; IAS.DAL.Interfaces.IIASPersonEntities ctx = DAL.DALFactory.GetPersonContext(); AG_IAS_PERSONAL_T entExist = ctx.AG_IAS_PERSONAL_T .FirstOrDefault(s => ((s.EMAIL == email)) && (s.ID_CARD_NO != idCard)); Assert.IsNull(entExist); AG_IAS_PERSONAL_T entExistChange = ctx.AG_IAS_PERSONAL_T .FirstOrDefault(s => ((s.EMAIL == emailchange)) && (s.ID_CARD_NO != idCard)); AG_IAS_PERSONAL_T entExistChange2 = ctx.AG_IAS_PERSONAL_T .FirstOrDefault(s => ((s.EMAIL == emailchange)) && (s.ID_CARD_NO != idCard)); Assert.IsNotNull(entExistChange); }
public void InsertOIC(RemoteFileInfoAddOic request) { // var res = new DTO.ResponseMessage<bool>(); try { var ctx = new IASPersonEntities(); string memberType = ""; if (request.oicTypeCode == "1") { memberType = DTO.RegistrationType.OICAgent.GetEnumValue().ToString(); } if (request.oicTypeCode == "2") { memberType = DTO.RegistrationType.OICFinace.GetEnumValue().ToString(); } if (request.oicTypeCode == "0") { memberType = DTO.RegistrationType.OIC.GetEnumValue().ToString(); } var entExist = ctx.AG_IAS_USERS .Where(w => w.USER_NAME == request.oicUserName) .FirstOrDefault(); if (entExist != null) { // res.ErrorMsg = Resources.errorPersonService_012 + oicUserName + Resources.errorPersonService_013; // return res; } var per = new AG_IAS_PERSONAL_T(); using (MemoryStream ms = new MemoryStream()) { request.FileByteStream.CopyTo(ms); per.IMG_SIGN = ms.ToArray(); } per.ID = OracleDB.GetGenAutoId(); per.EMPLOYEE_NO = request.oicEmpNo; per.PRE_NAME_CODE = request.preNameCode; per.NAMES = request.firstName; per.LASTNAME = request.lastName; per.MEMBER_TYPE = memberType; per.SEX = request.sex; ctx.AG_IAS_PERSONAL_T.AddObject(per); var user = new AG_IAS_USERS(); user.USER_ID = per.ID; user.USER_NAME = request.oicUserName; user.MEMBER_TYPE = memberType; if (request.oicTypeCode == "1") { user.USER_TYPE = user.USER_RIGHT = DTO.RegistrationType.OICAgent.GetEnumValue().ToString(); } if (request.oicTypeCode == "2") { user.USER_TYPE = user.USER_RIGHT = DTO.RegistrationType.OICFinace.GetEnumValue().ToString(); } if (request.oicTypeCode == "0") { user.USER_TYPE = user.USER_RIGHT = DTO.RegistrationType.OIC.GetEnumValue().ToString(); } user.OIC_TYPE = request.oicTypeCode; user.OIC_EMP_NO = request.oicEmpNo; user.CREATED_BY = user.UPDATED_BY = "AGDOI"; user.CREATED_DATE = user.UPDATED_DATE = DateTime.Now; user.IS_ACTIVE = "A"; user.IS_APPROVE = "Y"; ctx.AG_IAS_USERS.AddObject(user); ctx.SaveChanges(); //res.ResultMessage = true; } catch (Exception ex) { //res.ErrorMsg = "กรุณาติดต่อผู้ดูแลระบบ"; LoggerFactory.CreateLog().Fatal("PersonService_InsertOIC", ex); } // return res; }
public DTO.ResponseMessage <bool> EditMemberTypeAndActive(DTO.AccountDetail ent, DTO.UserProfile userProfile) { DTO.ResponseMessage <Boolean> res = new DTO.ResponseMessage <bool>(); try { string loginfo = string.Empty; var Person = base.ctx.AG_IAS_PERSONAL_T.FirstOrDefault(x => x.ID == ent.ID); var User = base.ctx.AG_IAS_USERS.FirstOrDefault(s => s.USER_ID == ent.ID); if (Person == null || User == null) { res.ErrorMsg = "ไม่พบข้อมูลผู้ใช้งาน"; LoggerFactory.CreateLog().LogError(String.Format("ไม่พบข้อมูลผู้ใช้งาน USER_ID :{0} ในตาราง AG_IAS_PERSONAL_T หรือ AG_IAS_USERS", ent.ID)); return(res); } #region Check from TYPE to TYPE string err = "ไม่สามารถย้ายประเภทผู้ใช้งาน"; switch (Person.MEMBER_TYPE) { case "1": if (ent.MEMBER_TYPE != "1") { res.ErrorMsg = err; return(res); } break; case "2": case "3": case "7": if (ent.MEMBER_TYPE != "2" && ent.MEMBER_TYPE != "3" && ent.MEMBER_TYPE != "7") { res.ErrorMsg = err; return(res); } break; case "4": case "5": case "6": if (ent.MEMBER_TYPE != "5" && ent.MEMBER_TYPE != "6" && ent.MEMBER_TYPE != "4") { res.ErrorMsg = err; return(res); } break; } #endregion Check from TYPE to TYPE /** * ย้าย MEMBER_TYPE จาก (02-บริษัท, 03-สมาคม) ไปเป็น (07-เจ้าหน้าที่สนามสอบ) * ให้ตรวจสอบ (02-บริษัท, 03-สมาคม) ว่ามีการสมัครสอบหรือไม่? * หากมีการสมัครสอบจะไม่สามารถย้ายไปเป็น (07-เจ้าหน้าที่สนามสอบ) */ if ((Person.MEMBER_TYPE == "2" || Person.MEMBER_TYPE == "3") && ent.MEMBER_TYPE == "7") { OracleDB ora = new OracleDB(); string sql = "select count(*) haveCount from AG_APPLICANT_T where ID_CARD_NO = '" + Person.ID_CARD_NO + "' and " + " EXAM_PLACE_CODE in (select EXAM_PLACE_CODE from AG_EXAM_PLACE_R) "; DataTable dt = ora.GetDataTable(sql); if (dt.Rows[0]["haveCount"].ToInt() > 0) { res.ErrorMsg = "ไม่สามารถย้ายประเภทผู้ใช้งาน"; return(res); } } /* * 2-บริษัท, 3-สมาคม, 5-คปภ.การเงิน, 6-คปภ.ตัวแทน, 7-เจ้าหน้าที่สนามสอบ */ if (ent.MEMBER_TYPE == "2" || ent.MEMBER_TYPE == "3" || ent.MEMBER_TYPE == "7") { if (ent.COMP_CODE == Person.COMP_CODE && Person.MEMBER_TYPE == ent.MEMBER_TYPE) { res.ErrorMsg = "ไม่มีการเปลี่ยนแปลงข้อมูล"; return(res); } var Regis = base.ctx.AG_IAS_REGISTRATION_T.FirstOrDefault(s => s.ID == ent.ID); if (Regis == null) { res.ErrorMsg = "ไม่พบข้อมูลผู้ใช้งาน"; return(res); } // ย้ายได้เฉพาะ status = 2-อนุมัติ(สมัคร), 5-อนุมัติ(แก้ไข) if (Person.STATUS != "2" && Person.STATUS != "5" && Person.STATUS != null) { var Status = base.ctx.AG_IAS_STATUS.FirstOrDefault(s => s.STATUS_CODE == Person.STATUS); res.ErrorMsg = "ไม่สามารถย้ายประเภทผู้ใช้งาน เนื่องจากสถานะ " + Status.STATUS_NAME; return(res); } string ID = OracleDB.GetGenAutoId(); #region AG_IAS_PERSONAL_T AG_IAS_PERSONAL_T newPerson = new AG_IAS_PERSONAL_T { ID = ID, //new Data MEMBER_TYPE = ent.MEMBER_TYPE, //new Data ID_CARD_NO = Person.ID_CARD_NO, EMPLOYEE_NO = Person.EMPLOYEE_NO, PRE_NAME_CODE = Person.PRE_NAME_CODE, NAMES = Person.NAMES, LASTNAME = Person.LASTNAME, NATIONALITY = Person.NATIONALITY, BIRTH_DATE = Person.BIRTH_DATE, SEX = Person.SEX, EDUCATION_CODE = Person.EDUCATION_CODE, ADDRESS_1 = Person.ADDRESS_1, ADDRESS_2 = Person.ADDRESS_2, AREA_CODE = Person.AREA_CODE, PROVINCE_CODE = Person.PROVINCE_CODE, ZIP_CODE = Person.ZIP_CODE, TELEPHONE = Person.TELEPHONE, LOCAL_ADDRESS1 = Person.LOCAL_ADDRESS1, LOCAL_ADDRESS2 = Person.LOCAL_ADDRESS2, LOCAL_AREA_CODE = Person.LOCAL_AREA_CODE, LOCAL_PROVINCE_CODE = Person.LOCAL_PROVINCE_CODE, LOCAL_ZIPCODE = Person.LOCAL_ZIPCODE, LOCAL_TELEPHONE = Person.LOCAL_TELEPHONE, EMAIL = Person.EMAIL, STATUS = Person.STATUS, TUMBON_CODE = Person.TUMBON_CODE, LOCAL_TUMBON_CODE = Person.LOCAL_TUMBON_CODE, COMP_CODE = ent.COMP_CODE, //new Data CREATED_BY = userProfile.Id, //new Data CREATED_DATE = DateTime.Now, //new Data UPDATED_BY = userProfile.Id, //new Data UPDATED_DATE = DateTime.Now, //new Data APPROVE_RESULT = Person.APPROVE_RESULT, APPROVED_BY = Person.APPROVED_BY, AGENT_TYPE = Person.AGENT_TYPE, SIGNATUER_IMG = Person.SIGNATUER_IMG, IMG_SIGN = Person.IMG_SIGN }; #endregion #region AG_IAS_USERS AG_IAS_USERS newUser = new AG_IAS_USERS { USER_ID = ID, //new Data USER_NAME = User.USER_NAME, USER_PASS = User.USER_PASS, USER_TYPE = ent.MEMBER_TYPE, //new Data IS_ACTIVE = User.IS_ACTIVE, USER_RIGHT = ent.MEMBER_TYPE, //new Data USER_TERM_ACCEPTED = User.USER_TERM_ACCEPTED, CREATED_BY = userProfile.Id, //new Data CREATED_DATE = DateTime.Now, //new Data UPDATED_BY = userProfile.Id, //new Data UPDATED_DATE = DateTime.Now, //new Data RESET_TIMES = User.RESET_TIMES, OIC_TYPE = User.OIC_TYPE, MEMBER_TYPE = ent.MEMBER_TYPE, //new Data OIC_EMP_NO = User.OIC_EMP_NO, IS_APPROVE = User.IS_APPROVE, APPROVED_BY = User.APPROVED_BY, STATUS = User.STATUS, APP_CLOSED = User.APP_CLOSED, LASTPASSWORD_CHANGDATE = User.LASTPASSWORD_CHANGDATE, OTH_USER_TYPE = ent.OTH_USER_TYPE //new Data }; #endregion #region AG_IAS_REGISTRATION_T AG_IAS_REGISTRATION_T newRegis = new AG_IAS_REGISTRATION_T { ID = ID, MEMBER_TYPE = ent.MEMBER_TYPE, ID_CARD_NO = Regis.ID_CARD_NO, EMPLOYEE_NO = Regis.EMPLOYEE_NO, PRE_NAME_CODE = Regis.PRE_NAME_CODE, NAMES = Regis.NAMES, LASTNAME = Regis.LASTNAME, NATIONALITY = Regis.NATIONALITY, BIRTH_DATE = Regis.BIRTH_DATE, SEX = Regis.SEX, EDUCATION_CODE = Regis.EDUCATION_CODE, ADDRESS_1 = Regis.ADDRESS_1, ADDRESS_2 = Regis.ADDRESS_2, AREA_CODE = Regis.AREA_CODE, PROVINCE_CODE = Regis.PROVINCE_CODE, ZIP_CODE = Regis.ZIP_CODE, TELEPHONE = Regis.TELEPHONE, LOCAL_ADDRESS1 = Regis.LOCAL_ADDRESS1, LOCAL_ADDRESS2 = Regis.LOCAL_ADDRESS2, LOCAL_AREA_CODE = Regis.LOCAL_AREA_CODE, LOCAL_PROVINCE_CODE = Regis.LOCAL_PROVINCE_CODE, LOCAL_ZIPCODE = Regis.LOCAL_ZIPCODE, LOCAL_TELEPHONE = Regis.LOCAL_TELEPHONE, EMAIL = Regis.EMAIL, STATUS = Regis.STATUS, TUMBON_CODE = Regis.TUMBON_CODE, LOCAL_TUMBON_CODE = Regis.LOCAL_TUMBON_CODE, COMP_CODE = ent.COMP_CODE, CREATED_BY = userProfile.Id, CREATED_DATE = DateTime.Now, UPDATED_BY = userProfile.Id, UPDATED_DATE = DateTime.Now, NOT_APPROVE_DATE = Regis.NOT_APPROVE_DATE, LINK_REDIRECT = Regis.LINK_REDIRECT, REG_PASS = Regis.REG_PASS, APPROVE_RESULT = Regis.APPROVE_RESULT, APPROVED_BY = Regis.APPROVED_BY, AGENT_TYPE = Regis.AGENT_TYPE, IMPORT_STATUS = Regis.IMPORT_STATUS }; #endregion base.ctx.AG_IAS_PERSONAL_T.AddObject(newPerson); base.ctx.AG_IAS_USERS.AddObject(newUser); base.ctx.AG_IAS_REGISTRATION_T.AddObject(newRegis); Person.STATUS = "7"; Regis.STATUS = "7"; User.IS_ACTIVE = "C"; User.UPDATED_BY = userProfile.Id; User.UPDATED_DATE = DateTime.Now; User.OTH_USER_TYPE = ent.OTH_USER_TYPE; loginfo = string.Format("{0} {1} เปลี่ยนประเภทผู้ใช้งานจาก USER_ID:{2} เป็น USER_ID:{3}", Person.NAMES, Person.LASTNAME, ent.ID, ID); } else if (ent.MEMBER_TYPE == "5" || ent.MEMBER_TYPE == "6" || ent.MEMBER_TYPE == "4") { if (ent.MEMBER_TYPE == Person.MEMBER_TYPE) { res.ErrorMsg = "ไม่มีการเปลี่ยนแปลงข้อมูล"; return(res); } loginfo = string.Format("[OIC] USER_ID:{0} {1} {2} เปลี่ยนประเภทผู้ใช้งานจาก MEMBER_TYPE:{3} เป็น MEMBER_TYPE:{4}", ent.ID, Person.NAMES, Person.LASTNAME, Person.MEMBER_TYPE, ent.MEMBER_TYPE); Person.MEMBER_TYPE = ent.MEMBER_TYPE; Person.UPDATED_BY = userProfile.Id; Person.UPDATED_DATE = DateTime.Now; User.USER_TYPE = ent.MEMBER_TYPE; User.MEMBER_TYPE = ent.MEMBER_TYPE; User.UPDATED_BY = userProfile.Id; User.UPDATED_DATE = DateTime.Now; User.OTH_USER_TYPE = ent.OTH_USER_TYPE; } else { res.ErrorMsg = "ไม่มีการเปลี่ยนแปลงข้อมูล"; return(res); } base.ctx.SaveChanges(); LoggerFactory.CreateLog().LogInfo(loginfo); } catch (Exception ex) { res.ErrorMsg = "พบข้อผิดพลาดในการเปลี่ยนประเภทผู้ใช้งาน"; LoggerFactory.CreateLog().Fatal(string.Format("AccountService_EditMemberTypeAndActive USER_ID: {0}", ent.ID), ex); } return(res); }