public JsonResult SetIdentity(int id, int identity)
        {
            Message msg = new Message();

            AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);

            if (identity == 0)
            {
                customer.CustomerIdentity = AdsCustomer.IdentiyStatus.审核失败;
            }
            else
            {
                customer.CustomerIdentity = AdsCustomer.IdentiyStatus.已认证;
            }

            if (ModelState.IsValid)
            {
                unitOfWork.adsCustomersRepository.Update(customer);
                unitOfWork.Save();
                msg.MessageStatus = "true";
                msg.MessageInfo   = identity == 1 ? "身份认证通过!" : "身份认证资料不符合要求,认证不通过";
            }
            else
            {
                msg.MessageStatus = "false";
                msg.MessageInfo   = "身份审核过程出现问题,认证操作失败!";
            }


            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult MemberCenter()
        {
            if (Session["CustomerId"] != null)
            {
                int         id       = int.Parse(Session["CustomerId"].ToString());
                AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);
                AdsBaby     baby     = new AdsBaby();
                var         babys    = unitOfWork.adsBabysRepository.Get(filter: u => u.CustomerId == id && u.Babystatus == true);
                int         count    = babys.Count();
                if (count > 0)
                {
                    baby         = babys.First() as AdsBaby;
                    ViewBag.baby = true;
                }
                else
                {
                    ViewBag.baby = false;
                }
                return(View(customer));
            }

            else
            {
                return(RedirectToAction("Login"));
            }
        }
        public ActionResult Create(AdsCustomer customer)
        {
            if (ModelState.IsValid)
            {
                customer.CustomerIdentity = AdsCustomer.IdentiyStatus.未申请计划;
                unitOfWork.adsCustomersRepository.Insert(customer);
                unitOfWork.Save();
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
Beispiel #4
0
 public ActionResult Setting()
 {
     if (Session["CustomerId"] != null)
     {
         int         id       = int.Parse(Session["CustomerId"].ToString());
         AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);
         return(View(customer));
     }
     else
     {
         return(RedirectToAction("Login"));
     }
 }
        // GET: /Customer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);

            if (customer == null)
            {
                return(HttpNotFound());
            }
            return(View(customer));
        }
        public static string GetCustomerName(int id)
        {
            UnitOfWork  unitOfWork = new UnitOfWork();
            string      cname      = string.Empty;
            AdsCustomer customer   = unitOfWork.adsCustomersRepository.GetByID(id);

            if (customer == null)
            {
                cname = "查无此人";
            }
            else
            {
                cname = unitOfWork.adsCustomersRepository.GetByID(id).CustomerNickName;
            }
            unitOfWork.Dispose();
            return(cname);
        }
Beispiel #7
0
        public ActionResult Setting(AdsCustomer customer)
        {
            if (ModelState.IsValid)
            {
                AdsCustomer cus = unitOfWork.adsCustomersRepository.GetByID(customer.CustomerId);
                cus.CustomerBirthdayType = "公历";
                cus.CustomerBirthday     = DateTime.Parse(customer.CustomerBirthday.ToString());
                cus.CustomerEmail        = customer.CustomerEmail;
                cus.CustomerNickName     = customer.CustomerNickName;

                unitOfWork.adsCustomersRepository.Update(cus);
                unitOfWork.Save();

                return(RedirectToAction("MemberCenter"));
            }

            return(View(customer));
        }
        public JsonResult ResetPassword(int id)
        {
            Message msg = new Message();

            AdsCustomer customer        = unitOfWork.adsCustomersRepository.GetByID(id);
            string      password        = CommonTools.GenerateRandomNumber(8);
            string      confirmpassword = CommonTools.ToMd5(password);

            customer.CustomerPassword = confirmpassword;
            if (ModelState.IsValid)
            {
                unitOfWork.adsCustomersRepository.Update(customer);
                unitOfWork.Save();
                string EmailContent = "密码已经被重置为" + password.ToString() + ",并已经发送邮件到" + customer.CustomerEmail + ",请注意查收!";
                //  AdsEmailServices.SendEmail(EmailContent, customer.CustomerEmail);
                msg.MessageStatus = "true";
                msg.MessageInfo   = EmailContent;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
        public ActionResult IdentityEdit(FormCollection fc)
        {
            int         id       = int.Parse(fc["CustomerId"]);
            AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);

            customer.CustomerRealName = fc["CustomerRealName"];
            customer.CustomerIDCard   = fc["CustomerIDCard"];
            customer.CustomerIDCardzm = fc["CustomerIDCardzm"];
            customer.CustomerIDCardsm = fc["CustomerIDCardsm"];
            customer.CustomerHoldCard = fc["CustomerHoldCard"];
            customer.CustomerIdentity = AdsCustomer.IdentiyStatus.正在审核;

            if (ModelState.IsValid)
            {
                unitOfWork.adsCustomersRepository.Update(customer);
                unitOfWork.Save();

                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
        public JsonResult UpdateStatus(int?id, bool status)
        {
            Message msg = new Message();

            if (id == null)
            {
                msg.MessageStatus = "false";
                msg.MessageInfo   = "找不到ID";
            }
            AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);

            customer.CustomerStatus = status;
            if (ModelState.IsValid)
            {
                unitOfWork.adsCustomersRepository.Update(customer);
                unitOfWork.Save();
                msg.MessageStatus = "true";
                msg.MessageInfo   = "已经更改为" + customer.CustomerStatus.ToString();
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(FormCollection fc)
        {
            int         id       = int.Parse(fc["CustomerId"]);
            AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id);

            customer.CustomerNickName     = fc["CustomerNickName"];
            customer.CustomerAvatar       = fc["CustomerAvatar"];
            customer.CustomerBirthdayType = fc["CustomerBirthdayType"];
            customer.CustomerBirthday     = DateTime.Parse(fc["CustomerBirthday"]);
            customer.CustomerSex          = fc["CustomerSex"];
            customer.CustomerProvince     = fc["CustomerProvince"];
            customer.CustomerCity         = fc["CustomerCity"];
            customer.CustomerDistrict     = fc["CustomerDistrict"];
            customer.CustomerAddress      = fc["CustomerAddress"];

            if (ModelState.IsValid)
            {
                unitOfWork.adsCustomersRepository.Update(customer);
                unitOfWork.Save();

                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
Beispiel #12
0
        public ActionResult Index()
        {
            string userAgent = Request.UserAgent;

            string CODE = Request["code"];

            string STATE = Request["state"];

            if (string.IsNullOrEmpty(CODE))
            {
                return(RedirectToAction("Login"));
            }
            else
            {
                WebchatJsUserinfo userinfo = WechatJsServices.GetUserInfo(userAgent, CODE);

                var         cus      = unitOfWork.adsCustomersRepository.Get(filter: u => u.CustomerOpenid == userinfo.openid);
                int         aa       = cus.Count();
                AdsCustomer customer = new AdsCustomer();
                if (aa == 0)
                {
                    customer.CustomerOpenid   = userinfo.openid;
                    customer.CustomerNickName = userinfo.nickname;
                    if (userinfo.sex == 0)
                    {
                        customer.CustomerSex = "未知";
                    }
                    if (userinfo.sex == 1)
                    {
                        customer.CustomerSex = "男";
                    }
                    if (userinfo.sex == 2)
                    {
                        customer.CustomerSex = "女";
                    }
                    customer.CustomerUnionid       = userinfo.unionid;
                    customer.CustomerIdentity      = AdsCustomer.IdentiyStatus.未申请计划;
                    customer.CustomerLastLoginTime = System.DateTime.Now;
                    customer.CustomerRegTime       = System.DateTime.Now;

                    customer.CustomerAvatar   = userinfo.headimgurl;
                    customer.CustomerUserName = userinfo.openid;
                    customer.CustomerProvince = userinfo.province;
                    customer.CustomerCity     = userinfo.city;

                    unitOfWork.adsCustomersRepository.Insert(customer);
                    unitOfWork.Save();
                }
                else
                {
                    customer = cus.First() as AdsCustomer;
                }

                Session["CustomerNickName"] = customer.CustomerNickName;
                Session["CustomerOpenid"]   = customer.CustomerOpenid;
                Session["openid"]           = customer.CustomerOpenid;
                Session["CustomerId"]       = customer.CustomerId;

                //   return Redirect(STATE);
                return(RedirectToAction("Calendar"));
            }



            // return View();
        }