// PUT api/mcomplain/5 //public void Put(int id, [FromBody]string value) //{ //} // DELETE api/mcomplain/5 public void Delete(string ID, string UserKeys, string Description, string Case_id, int CancelID) { result = falseresult("ข้อมูลไม่ถูกต้อง"); try { CustomerMapDao CusMap = new CustomerMapDao(); int _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp()); var Cus = CusMap.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault(); if (Cus != null) { ComplainsMapDao Map = new ComplainsMapDao(); var CompObj = Map.FindByCustomerID(Cus.ID).Where(o => o.Complain_Code_ID == Case_id).FirstOrDefault(); if (CompObj != null) { SaveComplain.Cancel(CompObj.Keygen, Description, CancelID); result = Trueresult("ยกเลิกข้อมูลสำเร็จ"); } else { result = falseresult("ไม่พบข้อมูล"); } } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public ActionResult Password(LocalPasswordModel obj) { if (ModelState.IsValid) { CustomerMapDao map = new CustomerMapDao(); var _obj = map.FindById(Helplibery.GetUserID()); if (_obj.Password == Encryption.Encrypt(obj.OldPassword)) { _obj.Password = Encryption.Encrypt(obj.NewPassword.Trim()); map.AddOrUpdate(_obj); map.CommitChange(); if (!string.IsNullOrEmpty(_obj.Email)) { //ChangePasswordViewModel newObj = new ChangePasswordViewModel(); //newObj.ConfirmPassword = obj.NewPassword; //newObj.NewPassword = obj.NewPassword; //newObj.OldPassword = obj.OldPassword; SendEmail.SendMail(_obj.Email, "แก้ไขรหัสผ่านสํานักงานคณะกรรมการคุ้มครองผู้บริโภค", RenderPartialViewToString("ChangePasswordTemplate", _obj)); //SendMail.Send(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("ChangePassword", obj)); } return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Manage") }, JsonRequestBehavior.AllowGet)); } } ModelState.AddModelError("", "ข้อมูลไม่ถูกต้อง"); return(Json(new ResultData() { Status = false, text = "ข้อมูลไม่ถูกต้อง" }, JsonRequestBehavior.AllowGet)); }
public ActionResult Nation(IdentityCheck obj, string mode) { try { if (ModelState.IsValid) { CustomerMapDao map = new CustomerMapDao(); if (map.FindIdentityCard(obj.IdentStr).Count == 0) { return(Json(new ResultData() { Status = true, text = Url.Action("Register", "Home", new { mode = mode, key = Encryption.Encrypt(obj.IdentStr) }) }, JsonRequestBehavior.AllowGet)); //return Json(new { RedirectUrl = }); } else { //return Json("Is Dupplicate!!!",JsonRequestBehavior.AllowGet ); return(Json(new ResultData() { Status = false, text = "Is Dupplicate!!!" }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { SaveUtility.logError(ex); } return(Json(new ResultData() { Status = false, text = "ข้อมูลไม่ถูกต้อง" }, JsonRequestBehavior.AllowGet)); }
public void Post([FromUri] Pfile items) { // Encryption.Encrypt try { result = falseresult("ข้อมูลไม่ถูกต้อง"); CustomerMapDao map = new CustomerMapDao(); int _id = MobileEncryption.Decrypt(items.ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(items.UserKeys.UrlDescriptHttp()); var Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault(); if (Obj != null) { SaveAccount.UpdateUser(Obj.ID, items.TitleID, items.Fname, items.Lname, items.DateOfBirth, items.OccupationID, items.SalaryID, items.Address, items.ProvinceID, items.PrefectureID, items.DistrictID, items.ZipCode, items.Tel, items.Tel_ext, items.Mobile, items.Fax, items.Email); result = Trueresult("แก้ไขข้อมูลเรียบร้อย"); } else { result = falseresult("ข้อมูลไม่ถูกต้อง"); } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public void Get(string ID, string UserKeys, string Oldpass, string newPass, string PassCompare) { //_MChange(Identity, Email); int _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp()); CustomerMapDao map = new CustomerMapDao(); var _obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault(); result = falseresult("ข้อมูลไม่ถูกต้อง"); if (newPass == PassCompare || _obj != null) { if (_obj.Password == Encryption.Encrypt(Oldpass)) { _obj.Password = Encryption.Encrypt(newPass); map.AddOrUpdate(_obj); map.CommitChange(); result = Trueresult("แก้ไขข้อมูลเรียบร้อยแล้ว"); } } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public PartialViewResult CustomerDetial() { Customer obj = new Customer(); CustomerMapDao map = new CustomerMapDao(); obj = map.FindById(Helplibery.GetUserID()); return(PartialView("_CustomerDetail", obj)); }
public ActionResult RegisterTH(Customer obj) { try { ModelState.Remove("IdentityID"); if (ModelState.IsValid) { obj.IdentityID = obj.tempIden.UrlDescriptHttp(); /* * var rst = _RegisterTH(obj); * if(rst.Status == true) * { * rst.text = Url.Action("Index", "Home"); * } */ //return Json(rst,JsonRequestBehavior.AllowGet); CustomerMapDao map = new CustomerMapDao(); if (map.FindIdentityCard(obj.IdentityID).Count == 0) { //obj.IdentityID = obj.IdentValid.UrlDescriptHttp(); int ID = SaveAccount.Register(obj.IdentityID, obj.TitleID, obj.Fname, obj.Lname, obj.Sex, obj.DateOfBirthStr, obj.Address, obj.DistrictID, obj.PrefectureID, obj.ProvinceID, obj.ZipCode, obj.Tel, obj.Tel_ext, obj.Mobile, obj.Fax, obj.Email, obj.OccupationID, obj.SalaryID, obj.TypeCustomer, obj.FromApp, obj.IsOversea); CustomerMapDao _CusMap = new CustomerMapDao(); obj = _CusMap.FindById(ID); if (!string.IsNullOrEmpty(obj.Email)) { SendEmail.SendMail(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("regisTemplate", obj)); //SendMail.Send(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("ChangePassword", obj)); } if (!string.IsNullOrEmpty(obj.Mobile)) { //SmsLibs.SendSMS(obj.Mobile, SmsLibs.TypeMessage.register); SmsLibs.SendSMS(obj.Mobile, string.Format(SmsLibs.CallStr(SmsLibs.TypeMessage.register), obj.IdentityID, Encryption.Decrypt(obj.Password))); } return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet)); } else { return(Json(new ResultData() { Status = false, text = Resources.Message.MsgDuplicate }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { SaveUtility.logError(ex); } return(View(obj)); }
public ActionResult Confirm() { ComplainsMapDao Map = new ComplainsMapDao(); var Obj = Map.FindByCustomerID(Helplibery.GetUserID()).LastOrDefault(); CustomerMapDao CusMap = new CustomerMapDao(); var Cmap = CusMap.FindById(Obj.CustomerID.Toint()); ViewBag.fullname = Cmap.FullNameStr; return(View(Obj)); }
// POST api/login private void _resultLogin(string tokenId, string Identity) { try { if (string.IsNullOrEmpty(tokenId)) { result = falseresult("UnAuthorized."); } if (string.IsNullOrEmpty(Identity)) { result = falseresult("Please provide citizen id."); } //if (!IsValidateToken(key)) // result = falseresult("UnAuthorized."); if (!IsValidateToken(tokenId)) { result = falseresult("UnAuthorized."); } result = falseresult("ข้อมูลไม่ถูกต้อง"); if (!string.IsNullOrEmpty(Identity)) { CustomerMapDao map = new CustomerMapDao(); var _obj = map.FindAll().Where(o => o.IdentityID == Identity && o.Active == true).FirstOrDefault(); if (_obj != null) { string _ID = MobileEncryption.Encrypt(_obj.ID.ToString()).UrlEnscriptHttp(); string UserKeys = MobileEncryption.Encrypt(_obj.Keygen).UrlEnscriptHttp(); result = Trueresult(new _resultValue { Fullname = _obj.FullNameStr, ID = _ID, UserKeys = UserKeys }); } } else { result = falseresult("ข้อมูลไม่ถูกต้อง"); } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public ResultData _Forget(string Identity, string Email) { if (!string.IsNullOrEmpty(Identity) && !string.IsNullOrEmpty(Email)) { CustomerMapDao map = new CustomerMapDao(); var obj = map.FindByIdentityAndEmail(Identity.Trim(), Email.Trim()); if (obj != null) { String newPass = Helplibery.CreatePassword(10); // Method ส่ง Email obj.Password = Encryption.Encrypt(newPass); map.AddOrUpdate(obj); map.CommitChange(); Log_Customer_reset_passMapDao logmap = new Log_Customer_reset_passMapDao(); logmap.Add(new Log_Customer_reset_pass { CreateDate = DateTime.Now, EmailTo = Email, ErrorText = "", IPAddress = Extension.GetIPAddress(), Result = true }); logmap.CommitChange(); if (!string.IsNullOrEmpty(Email)) { // string ttt = System.Web.Mvc.Html.PartialExtensions.Partial("ChangePassword", obj); string filePath = Path.Combine(HttpRuntime.AppDomainAppPath, "Templates/ChgPass.htm"); string html = System.IO.File.ReadAllText(filePath); SendEmail.SendMail(Email, "แก้ไขรหัสผ่านสํานักงานคณะกรรมการคุ้มครองผู้บริโภค", string.Format(html, obj.FullNameStr, obj.IdentityID, Encryption.Decrypt(obj.Password), obj.Email)); //SendMail.Send(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("ChangePassword", obj)); } return(new ResultData() { Status = true, text = "รหัสผ่านใหม่ ถูกจัดส่งไปยังอีเมลของท่าน เรียบร้อยแล้ว" }); } else { return(new ResultData() { Status = false, text = "ข้อมูลไม่ถูกต้อง" }); } } else { return(new ResultData() { Status = false, text = "กรุณากรอกข้อมูลให้ครบถ้วน" }); } }
public JsonResult CheckIden(string IdentityID) { CustomerMapDao map = new CustomerMapDao(); if (map.FindIdentityCard(IdentityID.Trim()).Count == 0) { TempData["identity"] = IdentityID.UrlEnscriptHttp(); return(Json(new ResultData() { Status = true, text = IdentityID.UrlEnscriptHttp() }, JsonRequestBehavior.AllowGet)); } else { return(Json(new ResultData() { Status = false, text = Resources.Message.MsgDuplicate }, JsonRequestBehavior.AllowGet)); } }
private void _resultLogin(string Username, string Password) { try { result = falseresult("ข้อมูลไม่ถูกต้อง"); if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password)) { CustomerMapDao map = new CustomerMapDao(); Username = MobileEncryption.Decrypt(Username.UrlDescriptHttp()); var _obj = map.FindAll().Where(o => o.IdentityID == Username && o.Active == true).ToList(); if (_obj.Count() != 0) { var PEncrypt = MobileEncryption.Decrypt(Password.UrlDescriptHttp()); var obj = _obj.Where(o => o.Password == Encryption.Encrypt(PEncrypt) && o.Active == true).FirstOrDefault(); if (obj != null) { string _ID = MobileEncryption.Encrypt(obj.ID.ToString()).UrlEnscriptHttp(); string UserKeys = MobileEncryption.Encrypt(obj.Keygen).UrlEnscriptHttp(); result = Trueresult(new _resultValue { Fullname = obj.FullNameStr, ID = _ID, UserKeys = UserKeys }); } } } else { result = falseresult("ข้อมูลไม่ถูกต้อง"); } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public ResultData _RegisterTH(Customer obj) { CustomerMapDao map = new CustomerMapDao(); if (map.FindIdentityCard(obj.IdentityID).Count == 0) { //obj.IdentityID = obj.IdentValid.UrlDescriptHttp(); int ID = SaveAccount.Register(obj.IdentityID, obj.TitleID, obj.Fname, obj.Lname, obj.Sex, obj.DateOfBirthStr, obj.Address, obj.DistrictID, obj.PrefectureID, obj.ProvinceID, obj.ZipCode, obj.Tel, obj.Tel_ext, obj.Mobile, obj.Fax, obj.Email, obj.OccupationID, obj.SalaryID, obj.TypeCustomer, obj.FromApp, obj.IsOversea); CustomerMapDao _CusMap = new CustomerMapDao(); obj = _CusMap.FindById(ID); if (!string.IsNullOrEmpty(obj.Email)) { string filePath = Path.Combine(HttpRuntime.AppDomainAppPath, "Templates/regisTemplate.cshtml"); string html = System.IO.File.ReadAllText(filePath); SendEmail.SendMail(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", string.Format(html, obj.FullNameStr, obj.IdentityID, Encryption.Decrypt(obj.Password))); if (!string.IsNullOrEmpty(obj.Mobile)) { //SmsLibs.SendSMS(obj.Mobile, SmsLibs.TypeMessage.register); SmsLibs.SendSMS(obj.Mobile, string.Format(SmsLibs.CallStr(SmsLibs.TypeMessage.register), obj.IdentityID, Encryption.Decrypt(obj.Password))); } //SendEmail.SendMail(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("regisTemplate", obj)); } return(new ResultData() { Status = true }); } else { return(new ResultData() { Status = false, text = Resources.Message.MsgDuplicate }); } }
public ActionResult Index(loginModel lm) { try { if (ModelState.IsValid) { CustomerMapDao map = new CustomerMapDao(); var _obj = map.FindIdentityCard(lm.Username); var PEncrypt = Encryption.Encrypt(lm.Passwordd); var obj = _obj.Where(o => o.Password == Encryption.Encrypt(lm.Passwordd) && o.Active == true).FirstOrDefault(); if (obj != null) { FormsAuthentication.SetAuthCookie(obj.ID.ToString(), false); MYSession.Current.UserId = obj.ID.ToString(); MYSession.Current.UserName = obj.Fname + " " + obj.Lname; // MYSession.Current.Role = obj.level_id.ToString(); //return Json(new { RedirectUrl = Url.Action("Index", "Manage") }); return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Manage") }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { SaveUtility.logError(ex); return(Json(new ResultData() { Status = false, text = ex.Message }, JsonRequestBehavior.AllowGet)); } //return View(lm); return(Json(new ResultData() { Status = false, text = "ข้อมูลไม่ถูกต้อง" }, JsonRequestBehavior.AllowGet)); }
public void Get(string ID, string UserKeys) { result = falseresult("ข้อมูลไม่ถูกต้อง"); try { CustomerMapDao map = new CustomerMapDao(); int _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp()); var Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).ToList(); if (Obj.Count() > 0) { result = Trueresult(Obj.Select(o => new { o.Address, o.ContinentsID, o.CountriesID, o.DateOfBirthStr, o.DistrictID, o.Email, o.Fax, o.Fname, o.IdentityID, o.Lname, o.Mobile, o.OccupationID, o.PrefectureID, o.ProvinceID, o.RegisterAddress, o.SalaryID, o.Sex, o.Tel, o.Tel_ext, o.TitleID, o.ZipCode }).FirstOrDefault()); } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public void Get(string ID, string UserKeys) { result = falseresult("ข้อมูลไม่ถูกต้อง"); try { CustomerMapDao map = new CustomerMapDao(); int _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp()); var Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault(); if (Obj != null) { result = Trueresult(ComplainData.GetComplainTimeLine(null, null, null, null, Obj.ID)); } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
private void _AddComplain(string tokenId, string Identification_number, string Consumer_firstname, string Consumer_lastname, string Consumer_gender, string Consumer_Birth , string Consumer_Address, string Consumer_ZipCode, string Consumer_Tel, string Consumer_Tel_Ex, string Consumer_Mobile, string Consumer_Fax, string Consumer_Email, string Complain_Subject , string Complain_Details, string DefendentName, string DefendentDescription, string Payment, string PlacePurchase, string Motive, string IsOversea, string OverseaAddress) { if (string.IsNullOrEmpty(tokenId)) { result = falseresult("UnAuthorized."); } if (string.IsNullOrEmpty(Identification_number)) { result = falseresult("Please provide Identification number."); } //string key = Encryption.Decrypt(tokenId); //if (!IsValidateToken(key)) // result = falseresult("UnAuthorized."); if (!IsValidateToken(tokenId)) { result = falseresult("UnAuthorized."); } try { Department_ExMapDao _departMap = new Department_ExMapDao(); AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao(); CustomerMapDao _cusMap = new CustomerMapDao(); CustomerVerifyMapDao _mapVer = new CustomerVerifyMapDao(); ComplainsMapDao _Map = new ComplainsMapDao(); Complains_WebService_logMapDao _logMap = new Complains_WebService_logMapDao(); Complains _Item = new Complains(); //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault(); //if (objToken != null) //{ string Complain_Code_ID = null; var Dep_ex = _departMap.FindByKeygen(TokenValid.ApiKey).FirstOrDefault(); int? ChannelID = Dep_ex.ChanelID; int? CusID = SaveAccount.CheckUserAndNewregis(null, Identification_number, Consumer_firstname, Consumer_lastname, Consumer_gender, Consumer_Birth, Consumer_Address, null, null, null, Consumer_ZipCode, Consumer_Tel, Consumer_Tel_Ex, Consumer_Mobile, Consumer_Fax, Consumer_Email, false, null, null); if (IsOversea.ToUpper().Trim() == "TRUE") { var CusObj = _cusMap.FindById(CusID.Toint()); CusObj.IsOversea = true; _cusMap.AddOrUpdate(CusObj); _cusMap.CommitChange(); Customer_OverseaMapDao OverSeaMap = new Customer_OverseaMapDao(); if (OverSeaMap.FindAll().Where(o => o.CustomerID == CusID).ToList().Count() == 0) { Customer_Oversea SMapObj = new Customer_Oversea(); SMapObj.CustomerID = CusID; SMapObj.address_oversea = OverseaAddress; OverSeaMap.Add(SMapObj); OverSeaMap.CommitChange(); } } int Id = SaveComplain.AddnewComplain(Complain_Subject, ChannelID, CusID, DefendentName, DefendentDescription, Complain_Details , null, null, null, null, PlacePurchase, null, Payment, null, Motive, null, null, ref Complain_Code_ID); SaveComplain.StartTrack(Id, 3, TokenValid.ApiKey, null); _Item = _Map.FindById(Id); //*********************Save Complain Service Log Complains_WebService_log _log = new Complains_WebService_log(); _log.IdentityID = Identification_number; _log.Sex = Consumer_gender != null?Consumer_gender.ToLower() : ""; _log.ApiKey = TokenValid.ApiKey; _log.CreateDate = DateTime.Now; _log.FullName = Consumer_firstname + " " + Consumer_lastname; // _log.TitleID = TitleID; _log.Fname = Consumer_firstname; _log.Lname = Consumer_lastname; _log.DateOfBirth = Consumer_Birth; _log.Address = Consumer_Address; _log.ZipCode = Consumer_ZipCode; _log.Tel = Consumer_Tel; _log.Tel_ext = Consumer_Tel_Ex; _log.Mobile = Consumer_Mobile; _log.Fax = Consumer_Fax; _log.Email = Consumer_Email; _log.Complain_Subject = Complain_Subject; _log.Complain_Details = Complain_Details; _log.CompanyName = DefendentName; _log.CompanyDescription = DefendentDescription; //_log.PaymentID = PaymentID; //_log.PlacePurchaseID = PlacePurchaseID; //_log.MotiveID = Motive; _log.Payment_Text = Payment; _log.PlacePurchase_Text = PlacePurchase; _log.Motive_Text = Motive; _log.IsOversea = (IsOversea.Trim().ToUpper() == "TRUE") ? true : false; _log.OverseaAddress = OverseaAddress; _logMap.AddOrUpdate(_log); _logMap.CommitChange(); Complains_DepartmentMapDao DepTMapDao = new Complains_DepartmentMapDao(); Complains_Department _Dept = new Complains_Department(); _Dept.ComplainID = Id; _Dept.DepartmentID = Dep_ex.ID; DepTMapDao.Add(_Dept); DepTMapDao.CommitChange(); SaveUtility.SaveTransactionLog(_Item.Keygen, "Add Complain", SaveUtility.TransStatus.Create, TokenValid.ApiKey, IPAddress, "s"); //s: service result = Trueresult(new OCPB.Service.Model.Complain(_Item.Complain_Code_ID, _Item.Complain_Date.ToThaiFormate(), _Item.Complain_Time, _Item.Complain_Subject)); //} //else //{ // result = falseresult("UnAuthorized."); //} } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } //finally //{ // _mapVer = null; // _Map = null; // _logMap = null; // _departMap = null; // _authenMap = null; // _cusMap = null; //} HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
public ActionResult RegisterEN(Customer_Oversea obj) { if (ModelState.IsValid) { if (TempData["Customer"] != null) { CustomerMapDao Map = new CustomerMapDao(); Customer Cusobj = new Customer(); Cusobj = (Customer)TempData["Customer"]; Cusobj.Keygen = Guid.NewGuid().ToString(); Cusobj.CreateDate = DateTime.Now; Cusobj.Active = true; Cusobj.IsConfirmRegister = false; Cusobj.IsOversea = true; Cusobj.DateOfBirth = Cusobj.DateOfBirthStr.todate(); //obj.Password = Helplibery.CreatePassword(8); //Cusobj.Password = Encryption.Encrypt("12345678"); Cusobj.Password = Encryption.Encrypt(Helplibery.CreatePassword(8)); //Cusobj.Password = Helplibery.CreatePassword(10); Map.Add(Cusobj); Map.CommitChange(); int ID = GetAccount.GetCustomerLastID(); Customer_OverseaMapDao OverMap = new Customer_OverseaMapDao(); obj.CustomerID = ID; if (obj.PurposeIList != null) { obj.purpose_id = Convert.ToInt32(string.Join(",", obj.PurposeIList)); } OverMap.Add(obj); OverMap.CommitChange(); ////////////////////////////////////////////////////////////////////////////////////////////////////////// CustomerMapDao map = new CustomerMapDao(); if (map.FindIdentityCard(Cusobj.IdentityID).Count == 0) { //obj.IdentityID = obj.IdentValid.UrlDescriptHttp(); int CusID = SaveAccount.Register(Cusobj.IdentityID, Cusobj.TitleID, Cusobj.Fname, Cusobj.Lname, Cusobj.Sex, Cusobj.DateOfBirthStr, Cusobj.Address, Cusobj.DistrictID, Cusobj.PrefectureID, Cusobj.ProvinceID, Cusobj.ZipCode, Cusobj.Tel, Cusobj.Tel_ext, Cusobj.Mobile, Cusobj.Fax, Cusobj.Email, Cusobj.OccupationID, Cusobj.SalaryID, Cusobj.TypeCustomer, Cusobj.FromApp, Cusobj.IsOversea); CustomerMapDao _CusMap = new CustomerMapDao(); Cusobj = _CusMap.FindById(CusID); if (!string.IsNullOrEmpty(Cusobj.Email)) { SendEmail.SendMail(Cusobj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("regisTemplate", Cusobj)); //SendMail.Send(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("ChangePassword", obj)); } return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet)); } else { //return Json(new ResultData() { Status = false, text = Resources.Message.MsgDuplicate }, JsonRequestBehavior.AllowGet); CustomerMapDao _CusMap = new CustomerMapDao(); int CusID = GetAccount.GetCustomerLastID(); if (!string.IsNullOrEmpty(Cusobj.Email)) { SendEmail.SendMail(Cusobj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("regisTemplate", Cusobj)); //SendMail.Send(obj.Email, "สํานักงานคณะกรรมการคุ้มครองผู้บริโภค ยินดีต้อนรับเข้าสู่การเป็นสมาชิก", RenderPartialViewToString("ChangePassword", obj)); } return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet)); } ////////////////////////////////////////////////////////////////////////////////////////////////////////// return(Json(new ResultData() { Status = true, text = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet)); //return Json(new { RedirectUrl = Url.Action("Index", "Home") }); } } return(View(obj)); }
public void Get(string ID, string UserKeys, string Case_id) { result = falseresult("ข้อมูลไม่ถูกต้อง"); try { CustomerMapDao map = new CustomerMapDao(); int _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint(); string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp()); var Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault(); if (Obj != null) { var comList = ComplainData.GetComplainByCaseId(null, Case_id); foreach (var i in comList) { i.AttachmentFiles = OCPB.Controllers.Service.GetCaseController.GetfileUpload(i.ID); } if (comList.Count > 0) { var selected = from c in comList select new { Complain_Code_ID = c.Complain_Code_ID, Complain_Date = c.Complain_Date, Complain_Time = c.Complain_Time, Complain_Subject = c.Complain_Subject, Complain_Details = c.Complain_Details, Complain_Channel_id = c.Complain_Channel_id, Complain_Channel_Text = c.Complain_Channel_Text, Consumer_Citizen_id = c.CusIden, Consumer_Name = c.Cusname, Case_id = c.Complain_Cause_id, Defendent_Name = c.CompanyName, Defendent_Detail = c.Complain_Details, PaymentID = c.PaymentID, PaymentText = c.PaymentText, Complain_TypeID = c.Complain_TypeID, Complain_Type_Text = c.Complain_Type_Text, Complain_Type_Sub_ID = c.Complain_Type_Sub_ID, Complain_Type_Sub_Text = c.Complain_Type_Sub_Text, Complain_Cause_ID = c.Complain_Cause_id, Complain_Cause_Text = c.Complain_Cause_Text, PlacePurchaseID = c.PlacePurchaseID, PlacePurchase_Text = c.PlacePurchase_Text, MotiveID = c.MotiveID, Motive_Text = c.Motive_Text, Complain_Status_text = c.Complain_Status_text, AttachmentFiles = c.AttachmentFiles }; result = Trueresult(selected); } } } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }
// // GET: /Profile/ public ActionResult Index() { CustomerMapDao map = new CustomerMapDao(); return(View(map.FindById(Helplibery.GetUserID()))); }