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 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)); }
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 }); } }
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(); }
// // GET: /Profile/ public ActionResult Index() { CustomerMapDao map = new CustomerMapDao(); return(View(map.FindById(Helplibery.GetUserID()))); }
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)); }