Exemple #1
0
        public ActionResult ProductWeight()
        {
            //门店下拉数据
            //ViewBag.stores = ListToSelect(WarehouseService.GetList().Select(o => new SelectListItem() { Value = o.StoreId, Text = o.Title }), emptyTitle: "全部");
            //ViewBag.stores = .Title;
            var store = WarehouseService.GetAdminList(CommonService.CompanyId, Sys.SysCommonRules.CurrentStore).FirstOrDefault();

            ViewBag.stores = string.Empty;
            if (store != null)
            {
                ViewBag.stores = store.Title;
            }

            //电子秤下拉数据
            ViewBag.scale = ListToSelect(settingbll.GetAllSettingsByStore().Select(o => new SelectListItem()
            {
                Value = o.IpAddress, Text = o.SN + " " + o.Title
            }), emptyTitle: "请选择");
            //历史批次下拉数据
            ViewBag.history = ListToSelect(scaleHistory.GetAllHistoryByStore().Skip(0).Take(10).Select(o => new SelectListItem()
            {
                Value = o, Text = o
            }), emptyTitle: "重新选择商品");
            //商品分类数据

            return(View());
        }
        //
        // GET: /MakeLabel/

        public ActionResult Index()
        {
            ViewBag.stores = ListToSelect(WarehouseService.GetAdminList().Select(o => new SelectListItem()
            {
                Value = o.StoreId, Text = o.Title, Selected = o.StoreId == CurrentUser.StoreId
            }));
            return(View());
        }
        public ActionResult Login(UserLogin user)
        {
            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            var obj = UserInfoService.GetStoreUserBy(user.UserName, Pharos.Utility.Security.MD5_Encrypt(user.UserPwd), user.StoreId.Split('~')[0]);

            if (obj == null)
            {
                ViewBag.msg = "帐户或密码输入不正确!";
                //ViewBag.stores = ListToSelect(WarehouseService.GetAdminList().Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title }), emptyTitle: "请选择门店");
                ViewBag.stores = ListToSelect(WarehouseService.GetAdminList(user.CID, user.StoreId.Split('~')[0]).Select(o => new SelectListItem()
                {
                    Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == user.StoreId.Split('~')[0]
                }));
                return(View(user));
            }
            //obj.StoreId = user.StoreId;
            obj.RoleIds = "10";
            new Sys.CurrentStoreUser().StoreLogin(obj, user.StoreId, user.RememberMe);

            //csID csid = ipLocalhost();
            //if (csid.message == "禁止访问")
            //{
            //    Response.Redirect("/Account/noBusiness");
            //    return null;
            //}
            ////ip、localhost门店登录
            //else if (csid.message == "localhost" || csid.message == "ip")
            //{
            //    Response.Redirect("/store"+csid.cid+"-"+csid.sid+"/Store/Index");
            //    return null;
            //}

            return(Redirect(Url.Action("Index")));
        }
        public ActionResult Login(string id)
        {
            /*var user = new UserLogin();
             * csID csid2 = ipLocalhost();
             *
             * //url中cid
             * string s_cid = "";
             *
             * if (!RouteData.Values["cid"].IsNullOrEmpty())
             * {
             *  s_cid = RouteData.Values["cid"].ToString();
             * }
             * //url中sid
             * string s_sid = "";
             *
             * if (!RouteData.Values["sid"].IsNullOrEmpty())
             * {
             *  s_sid = RouteData.Values["sid"].ToString();
             * }
             *
             * if (csid2.message == "禁止访问")
             * {
             *  Response.Redirect("/Account/noBusiness");
             *  return null;
             * }
             *
             * csID csid = new csID();
             * if (!s_cid.IsNullOrEmpty() && !s_sid.IsNullOrEmpty())
             * {
             *  Authorize authorize = new Authorize();
             *  csid = authorize.getCidSid(s_cid, s_sid);
             *  if (csid.message == "格式错误")
             *  {
             *      Response.Redirect("/Account/noBusiness");
             *      return null;
             *  }
             *  else if (csid.message == "域名的store后面必须是数字")
             *  {
             *      Response.Redirect("/Account/noBusiness");
             *      return null;
             *  }
             *  else if (csid.message == "success")
             *  {
             *      user.CID = Convert.ToInt32(csid.cid);
             *      if (Cookies.IsExist("remuc"))
             *      {
             *          //cookie的CID
             *          string cid = Cookies.Get("remuc", "_cid").Trim();
             *          //cookie的门店ID
             *          string sid = Server.UrlDecode(Cookies.Get("remuc", "_storeId"));
             *          sid = sid.Split('~')[0];
             *
             *          if (cid.IsNullOrEmpty())
             *          {
             *              cid = "0";
             *          }
             *          if (sid.IsNullOrEmpty())
             *          {
             *              sid = "0";
             *          }
             *
             *          if (csid.cid.Trim() == cid || csid.sid.Trim() == sid)
             *          {
             *              user.UserName = Cookies.Get("remuc", "_uname");
             *              user.UserPwd = Cookies.Get("remuc", "_pwd");
             *              user.StoreId = Server.UrlDecode(Cookies.Get("remuc", "_storeId"));
             *              user.RememberMe = true;
             *          }
             *      }
             *  }
             * }
             * else
             * {
             *  Response.Redirect("/Account/noBusiness");
             *  return null;
             * }
             *
             *
             * List<SelectListItem> list = ListToSelect(WarehouseService.GetAdminList(Convert.ToInt32(csid.cid), csid.sid).Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == csid.sid })).ToList();
             * if (list.Count == 0)
             * {
             *  Response.Redirect("/Account/error?msg=" + Pharos.Utility.DESEncrypt.Encrypt("无效门店,请联系管理员检查该门店是否存在或开放!"));
             *  return null;
             * }
             *
             *
             * ViewBag.stores = list;
             * return View(user);
             */

            var user = new UserLogin();

            user.CID       = Pharos.Utility.Config.GetAppSettings("CompanyId").ToType <int>();
            user.StoreId   = Sys.SysCommonRules.CurrentStore;
            ViewBag.stores = ListToSelect(WarehouseService.GetAdminList().Select(o => new SelectListItem()
            {
                Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == user.StoreId
            }));
            if (Cookies.IsExist("storeremuc"))
            {
                user.UserName   = Cookies.Get("storeremuc", "_uname");
                user.StoreId    = Server.UrlDecode(Cookies.Get("storeremuc", "_storeId"));
                user.RememberMe = true;
            }
            return(View(user));
        }