コード例 #1
0
        /// <summary>
        /// 注册页面第一步
        /// </summary>
        /// <returns></returns>
        public ActionResult Register()
        {
            string phone  = string.Empty;
            string jyCode = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["phone"]))
            {
                phone = Request.Form["phone"];
            }
            if (!string.IsNullOrEmpty(Request.Form["jyCode"]))
            {
                jyCode = Request.Form["jyCode"];
            }
            if (!string.IsNullOrEmpty(jyCode) && !string.IsNullOrEmpty(jyCode))
            {
                //Response.Redirect("/UserCenter/Register_Step2?phone="+ phone);
                string error = string.Empty;
                if (SellerInfoBll.CheckRegisterVerificationCode(phone, jyCode, out error))
                {
                    Response.Redirect("/UserCenter/Register_Step2?phone=" + phone + "&jyCode=" + jyCode);
                }
                else
                {
                    Response.Write("<script>alert('" + error + "')</script>");
                }
            }
            return(View());
        }
コード例 #2
0
        /// <summary>
        /// 登录页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Login()
        {
            string name = string.Empty;
            string pwd  = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["name"]))
            {
                name = Request.Form["name"];
            }
            if (!string.IsNullOrEmpty(Request.Form["name"]))
            {
                pwd = Request.Form["pwd"];
            }
            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pwd))
            {
                string     error = string.Empty;
                SellerInfo model = new SellerInfo();
                SellerInfoBll.RequestLogin(name, pwd, out model, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    Response.Write("<script>alert('" + error + "');</script>");
                    //Response.Redirect("/UserCenter/Login");
                }
                else
                {
                    HttpCookie cookie = new HttpCookie("userId");
                    cookie.Value   = model.SellerId.ToString();
                    cookie.Expires = DateTime.Now.AddDays(1);
                    Response.Cookies.Add(cookie);
                    Session["UserId"] = model.SellerId;
                    Response.Redirect("/BackStage/Index");
                }
            }
            return(View());
        }
コード例 #3
0
        // GET: Product/Product
        public ActionResult Index()
        {
            ViewBag.Title = "我的卖家";
            List <SellerInfo> sellers = SellerInfoBll.GetList().ToList();

            return(View(sellers));
        }
コード例 #4
0
        // GET: Goods
        public ActionResult List(int sellerId = -1, int classId = 0)
        {
            if (sellerId < 0)
            {
                try
                {
                    sellerId = Convert.ToInt32(Session["SellerId"]);
                    classId  = Convert.ToInt32(Session["ClassId"]);
                }
                catch (Exception ex)
                {
                    ViewBag.SellerName = "获取商家信息失败";
                }
            }

            Session["SellerId"] = sellerId;
            Session["ClassId"]  = classId;

            string msg;

            ViewBag.SellerId   = sellerId;
            ViewBag.SelectType = "";

            var seller = SellerInfoBll.GetModel(sellerId, out msg);

            if (seller == null)
            {
                ViewBag.SellerName = "获取商家信息失败";
            }
            else
            {
                ViewBag.SellerName = seller.CompanyName;
            }


            var user = GetUser();

            if (user == null)
            {
                return(RedirectToAction("Login", "Login"));
            }



            List <BuyerProductView> list = new List <BuyerProductView>();

            if (classId == 0)
            {
                list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId);
            }
            else
            {
                ViewBag.SelectType = "class";
                list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId, classId);
            }

            return(View(list));
        }
コード例 #5
0
ファイル: SellerInfoBllTest.cs プロジェクト: Jeff-Bee/qdh
        public void RequestRegisterNewUserTest()
        {
            var phone = "18903838100";
            var code  = "99999999";

            code = "942684";
            int id = 0;

            Assert.IsTrue(SellerInfoBll.RequestRegisterNewUser("阿里巴巴", "123456", "龚俊", phone, 1001, code, out id, out _errMsg));
        }
コード例 #6
0
        public string GetSellerUserInfo()
        {
            string     errMsg = string.Empty;
            SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);

            if (model != null)
            {
                model.MobilePhone = model.MobilePhone.Substring(0, 3) + "****" + model.MobilePhone.Substring(model.MobilePhone.Length - 4, 4);
            }
            return(JsonConvert.SerializeObject(model));
        }
コード例 #7
0
        /// <summary>
        /// 注册获取校验码
        /// </summary>
        /// <returns></returns>
        public string GetVerCode()
        {
            string phone = Request.Params["phone"];
            string error = string.Empty;

            if (SellerInfoBll.RequestRegisterVerificationCode(phone, out error))
            {
                return("");
            }
            else
            {
                return(error);
            }
        }
コード例 #8
0
        /// <summary>
        /// 修改密码保存
        /// </summary>
        /// <returns></returns>
        public string ChangePwd()
        {
            string newValue = string.Empty;
            string oldValue = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["oldPwd"]))
            {
                oldValue = Request.Form["oldPwd"];
            }
            if (!string.IsNullOrEmpty(Request.Form["newPwd"]))
            {
                newValue = Request.Form["newPwd"];
            }
            if (!string.IsNullOrEmpty(oldValue) && !string.IsNullOrEmpty(newValue))
            {
                string     errMsg = string.Empty;
                SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);
                if (model != null)
                {
                    if (model.Password == oldValue)
                    {
                        model.Password = newValue;
                        if (SellerInfoBll.Update(model))
                        {
                            return("修改成功");
                        }
                        else
                        {
                            return("修改失败");
                        }
                    }
                    else
                    {
                        return("原密码不正确");
                    }
                }
                else
                {
                    return("请重新登录后操作");
                }
            }
            else
            {
                return("参数信息出错,请重试");
            }
        }
コード例 #9
0
ファイル: BackStageController.cs プロジェクト: Jeff-Bee/qdh
 // GET: BackStage
 public ActionResult Index()
 {
     ViewBag.menu = GetMenuList();
     //ViewBag.UserName = "******";
     if (Request.Cookies["userId"] != null && !string.IsNullOrEmpty(Request.Cookies["userId"].Value))
     {
         string     errMsg = string.Empty;
         SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);
         ViewBag.UserName = model.CompanyName;
         //ViewBag.phone = model.MobilePhone.Substring(0,3)+"****"+model.MobilePhone.Substring(model.MobilePhone.Length-4,4);
     }
     else
     {
         Response.Redirect("/UserCenter/Login");
     }
     return(View());
 }
コード例 #10
0
 public string UpdateSellerUserInfo()
 {
     if (!string.IsNullOrEmpty(Request.Params["str"]))
     {
         string     errMsg   = string.Empty;
         string     str      = Request.Params["str"];
         JObject    Jjson    = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(str);
         SellerInfo model    = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);
         SellerInfo NewModel = new SellerInfo();
         NewModel.MobilePhone = Jjson["MobilePhone"].ToString();
         NewModel.CompanyName = Jjson["CompanyName"].ToString();
         NewModel.ContactName = Jjson["ContactName"].ToString();
         NewModel.EMail       = Jjson["EMail"].ToString();
         NewModel.IndustryId  = int.Parse(Jjson["IndustryId"].ToString());
         //判断手机是否重复
         if (!string.IsNullOrEmpty(NewModel.MobilePhone) && model.MobilePhone != NewModel.MobilePhone)//如果手机不为空且与原来的不一样则判断是否重复
         {
             if (SellerInfoBll.GetModelByMobilePhone(NewModel.MobilePhone, out errMsg) != null)
             {
                 return("手机号已经存在");
             }
         }
         if (model != null)
         {
             if (!string.IsNullOrEmpty(NewModel.MobilePhone))
             {
                 model.MobilePhone = NewModel.MobilePhone;
             }
             model.IndustryId  = NewModel.IndustryId;
             model.CompanyName = NewModel.CompanyName;
             model.ContactName = NewModel.ContactName;
             model.EMail       = NewModel.EMail;
             if (SellerInfoBll.Update(model))
             {
                 return("修改成功");
             }
             else
             {
                 return("修改失败");
             }
         }
     }
     return("参数错误,请刷新重试");
 }
コード例 #11
0
        public string GetPwd()
        {
            string telphone = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["telphone"]))
            {
                telphone = Request.Form["telphone"];
            }
            if (!string.IsNullOrEmpty(telphone))//!string.IsNullOrEmpty(cname) && !string.IsNullOrEmpty(telphone) && !string.IsNullOrEmpty(varcode)
            {
                string error = string.Empty;
                if (SellerInfoBll.RequestGetPassword(telphone, out error))
                {
                    return("1");
                }
                else
                {
                    return(error);
                }
            }
            return("获取参数失败!");
        }
コード例 #12
0
        /// <summary>
        /// 注册页面第二步
        /// </summary>
        /// <returns></returns>
        public ActionResult Register_Step2()
        {
            //第一步跳转过来传的参数
            if (!string.IsNullOrEmpty(Request.Params["phone"]))
            {
                ViewBag.phone = Request.Params["phone"];
            }
            if (!string.IsNullOrEmpty(Request.Params["jyCode"]))
            {
                ViewBag.jyCode = Request.Params["jyCode"];
            }
            List <IndustryInfo> models = IndustryInfoBll.GetList().ToList();

            ViewBag.modes = models;
            //第二步保存提交的参数
            string cname    = string.Empty;
            string pwd      = string.Empty;
            string contact  = string.Empty;
            string telphone = string.Empty;
            string industry = string.Empty;
            string jyCode   = string.Empty;//验证码

            if (!string.IsNullOrEmpty(Request.Form["cname"]))
            {
                cname = Request.Form["cname"];
            }
            if (!string.IsNullOrEmpty(Request.Form["pwd"]))
            {
                pwd = Request.Form["pwd"];
            }
            if (!string.IsNullOrEmpty(Request.Form["contact"]))
            {
                contact = Request.Form["contact"];
            }
            if (!string.IsNullOrEmpty(Request.Form["Tel_phone"]))
            {
                telphone = Request.Form["Tel_phone"];
            }
            if (!string.IsNullOrEmpty(Request.Form["industry"]))
            {
                industry = Request.Form["industry"];
            }
            if (!string.IsNullOrEmpty(Request.Form["rs2_jyCode"]))
            {
                jyCode = Request.Form["rs2_jyCode"];
            }
            if (!string.IsNullOrEmpty(cname) && !string.IsNullOrEmpty(pwd))
            {
                //Response.Redirect("/UserCenter/Register_Step3?name=");

                int    sellerId = 0;
                string error    = string.Empty;
                if (SellerInfoBll.RequestRegisterNewUser(cname, pwd, contact, telphone, int.Parse(industry), jyCode, out sellerId, out error))
                {
                    SellerInfo model = SellerInfoBll.GetModel(sellerId, out error);
                    if (string.IsNullOrEmpty(error))
                    {
                        Response.Redirect("/UserCenter/Register_Step3?name=" + model.LoginName);
                    }
                }
                else
                {
                    Response.Write("<script>alert('" + error + "');</script>");
                    Response.Redirect("/UserCenter/Register");
                }
            }
            return(View());
        }
コード例 #13
0
ファイル: SellerInfoBllTest.cs プロジェクト: Jeff-Bee/qdh
        public void RequestGetPasswordTest()
        {
            var phone = "18903838100";

            Assert.IsTrue(SellerInfoBll.RequestGetPassword(phone, out _errMsg));
        }
コード例 #14
0
ファイル: SellerInfoBllTest.cs プロジェクト: Jeff-Bee/qdh
        public void RequestRegisterVerificationCodeTest()
        {
            var phone = "18903838100";

            Assert.IsTrue(SellerInfoBll.RequestRegisterVerificationCode(phone, out _errMsg));
        }
コード例 #15
0
ファイル: SellersGoodsViewModel.cs プロジェクト: Jeff-Bee/qdh
 public SellersGoodsViewModel(int sellerId, int buyerId)
 {
     sellerInfo        = SellerInfoBll.GetModel(sellerId, out msg);
     buyerInfo         = BuyerInfoBll.GetModel(buyerId, out msg);
     productClassInfos = BuyerInfoBll.GetProductClassInfo(buyerInfo.BuyerId, sellerId, out msg);
 }