コード例 #1
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
 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));
 }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
        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));
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
        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));
            }
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
        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
                });
            }
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
 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));
 }
コード例 #6
0
ファイル: HomeController.cs プロジェクト: wachara-yanu/OCPB
        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));
        }