Beispiel #1
0
        public ActionResult GetShopByID(int id)
        {
            ComResult com = new ComResult();

            try
            {
                base_shop shop = _service.GetShopByID(id);
                if (null != shop)
                {
                    com.DataResult = shop;
                    com.State      = 1;
                    return(Json(com));
                }
                else
                {
                    com.Msg   = "获取店铺信息失败!";
                    com.State = 0;
                    return(Json(com));
                }
            }
            catch (Exception ex)
            {
                com.Msg   = ex.ToString();
                com.State = 0;
                return(Json(com));
            }
        }
Beispiel #2
0
        public ActionResult UpdateShop(base_shop model)
        {
            ComResult com = new ComResult();

            try
            {
                bool isok = _service.UpdateShop(model);
                if (isok)
                {
                    com.Msg   = "更新成功";
                    com.State = 1;
                    return(Json(com));
                }
                else
                {
                    com.Msg   = "更新失败";
                    com.State = 0;
                    return(Json(com));
                }
            }
            catch (Exception ex)
            {
                com.Msg   = ex.Message;
                com.State = 0;
                return(Json(com));
            }
        }
Beispiel #3
0
        public ActionResult DeletePSKU(string id)   //AddPSKU
        {
            ComResult com = new ComResult();

            try
            {
                var isok = CommService.DeletePSKU(Convert.ToInt32(id));
                if (isok)
                {
                    com.State = 1;
                    com.Msg   = "删除成功";
                }
                else
                {
                    com.State = 0;
                    com.Msg   = "删除失败";
                }
                return(Json(com));
            }
            catch (Exception ex)
            {
                com.State = 0;
                com.Msg   = "删除失败,原因:" + ex.ToString();
                return(Json(com));
            }
        }
Beispiel #4
0
        public ActionResult AddPSKU(string PSKU, string SSKU, string GSKU, string shopid)
        {
            ComResult com = new ComResult();

            try
            {
                if (!Regex.IsMatch(shopid, @"^\+?[1-9][0-9]*$") && !string.IsNullOrEmpty(shopid))
                {
                    com.Msg   = "只能是数字且不能为空";
                    com.State = 0;
                    return(Json(com));
                }
                var isok = CommService.AddPSKU(PSKU, SSKU, GSKU, Convert.ToInt32(shopid));
                if (isok)
                {
                    com.State = 1;
                    com.Msg   = "添加成功";
                }
                else
                {
                    com.State = 0;
                    com.Msg   = "添加失败";
                }
                return(Json(com));
            }
            catch (Exception ex)
            {
                com.State = 0;
                com.Msg   = "添加失败,原因:" + ex.ToString();
                return(Json(com));
            }
        }
Beispiel #5
0
        public ActionResult GetPSKUpage(string pagenum, string onepagecount, string shopID)
        {
            ComResult com = new ComResult();

            try
            {
                if (!Regex.IsMatch(pagenum, @"^\+?[1-9][0-9]*$") && !string.IsNullOrEmpty(pagenum))
                {
                    com.Msg   = "只能是数字";
                    com.State = 0;
                    return(Json(com));
                }
                if (!Regex.IsMatch(onepagecount, @"^\+?[1-9][0-9]*$") && !string.IsNullOrEmpty(onepagecount))
                {
                    com.Msg   = "只能是数字";
                    com.State = 0;
                    return(Json(com));
                }
                if (!Regex.IsMatch(shopID, @"^\+?[1-9][0-9]*$") && !string.IsNullOrEmpty(shopID))
                {
                    com.Msg   = "只能是数字";
                    com.State = 0;
                    return(Json(com));
                }
                if (string.IsNullOrEmpty(shopID))
                {
                    com.Msg   = "没有选择店铺";
                    com.State = 0;
                    return(Json(com));
                }
                int           totil       = 0;
                int           totilpage   = 0;
                var           PSKUlist    = CommService.GetPSKUListByshopID(Convert.ToInt32(pagenum), Convert.ToInt32(onepagecount), Convert.ToInt32(shopID), out totil, out totilpage);
                PSKUViewmodel mypkskulist = new PSKUViewmodel();
                mypkskulist.PSKUlist   = PSKUlist;
                mypkskulist.totilcount = totil.ToString();
                mypkskulist.totilpage  = totilpage.ToString();
                com.State      = 1;
                com.DataResult = mypkskulist;
                return(Json(com));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        public ActionResult LoginCheck(string username, string password, string ValidCode, bool remember)
        {
            //识别是否主库登录
            var ismainlogin = false;//false从库登录true主库登录

            CookieHelper.SetCookie("ismainlogin", ismainlogin.ToString());
            LCWebApp.Controllers.Base.ComResult com = new LCWebApp.Controllers.Base.ComResult();
            //1.判断验证码
            if (ValidCode.ToLower() != SessionHelper.Get("RandomCode").ToString().ToLower())
            {
                com.Msg   = "验证码错误!";
                com.State = 0;
                return(Json(com));
            }

            //2.验证账号密码
            var result = _service.VerifyUserLogin(1, username, EncodeHepler.GetMD5(password), false);

            //3.判断用户是否记住密码功能
            if (result.State == 1 && remember)
            {
                CookieHelper.SetCookie("username", username);
                CookieHelper.SetCookie("password", password);
                CookieHelper.SetCookie("remember", remember.ToString());
            }
            else
            {
                CookieHelper.ClearCookie("username");
                CookieHelper.ClearCookie("password");
                CookieHelper.ClearCookie("remember");
                SessionHelper.Delete("RandomCode");
            }
            if (result.State == 1)
            {
                CookieHelper.SetCookie("username", username);
                result.URL = "/Main/index";
                SessionHelper.Delete("RandomCode");
                return(Json(result));
            }
            else
            {
                return(Json(result));
            }
        }