public ContentResult GetShopList(Lib.GridPager pager, string queryStr)
        {
            //查询出所有未删除的
            IQueryable <T_ShopFromGY> queryData = db.T_ShopFromGY.Where(a => a.Isdelete == "0");

            //根据订单号,提交者姓名,会员号码查询
            if (!string.IsNullOrEmpty(queryStr))
            {
                queryData = queryData.Where(a => a.name.Contains(queryStr) || a.code.Contains(queryStr));
            }
            //根据状态查询
            //分页
            pager.totalRows = queryData.Count();
            queryData       = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows);
            List <T_ShopFromGY> list = new List <T_ShopFromGY>();

            foreach (var item in queryData)
            {
                T_ShopFromGY i = new T_ShopFromGY();
                i = item;
                list.Add(i);
            }
            string json = "{\"total\":" + pager.totalRows + ",\"rows\":" + JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()) + "}";

            return(Content(json));
        }
Beispiel #2
0
        /// <summary>
        /// 根据店铺代码获得店铺名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetShopName(string code)
        {
            EBMSEntities db       = new EBMSEntities();
            string       ShopName = "";
            T_ShopFromGY shop     = db.T_ShopFromGY.SingleOrDefault(a => a.code == code);

            if (shop != null)
            {
                ShopName = shop.name;
            }
            return(ShopName);
        }
Beispiel #3
0
        public ActionResult ViewShopEdit(int ID)
        {
            T_ShopFromGY model = db.T_ShopFromGY.Find(ID);

            if (model != null)
            {
                return(View(model));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Beispiel #4
0
 public JsonResult ShopAddSave(T_ShopFromGY model)
 {
     model.Isdelete = "0";
     db.T_ShopFromGY.Add(model);
     try
     {
         db.SaveChanges();
         return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
     }
     catch (DbEntityValidationException ex)
     {
         return(Json(new { State = "Faile", Message = ex.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage }, JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #5
0
        public JsonResult ShopDelete(int ID)
        {
            T_ShopFromGY editModel = db.T_ShopFromGY.Find(ID);

            editModel.Isdelete = "1";
            db.Entry <T_ShopFromGY>(editModel).State = System.Data.Entity.EntityState.Modified;
            try
            {
                db.SaveChanges();
                return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
            }
            catch (DbEntityValidationException ex)
            {
                return(Json(new { State = "Faile", Message = ex.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #6
0
        public JsonResult ShopEditSave(T_ShopFromGY model)
        {
            T_ShopFromGY editModel = db.T_ShopFromGY.Find(model.ID);

            editModel.code         = model.code;
            editModel.company_Name = model.company_Name;
            editModel.DutyFinance  = model.DutyFinance;
            editModel.name         = model.name;
            editModel.nick         = model.nick;
            editModel.number       = model.number;
            editModel.type_name    = model.type_name;

            db.Entry <T_ShopFromGY>(editModel).State = System.Data.Entity.EntityState.Modified;
            try
            {
                db.SaveChanges();
                return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
            }
            catch (DbEntityValidationException ex)
            {
                return(Json(new { State = "Faile", Message = ex.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #7
0
        /// <summary>
        /// 获得补发货名字
        /// </summary>
        /// <returns></returns>
        public static string GetReissueName(string code, string reson)
        {
            EBMSEntities db = new EBMSEntities();

            if (reson.Equals("呼吸机专用"))
            {
                return("阿奎");
            }
            else
            {
                T_ShopFromGY shop = db.T_ShopFromGY.SingleOrDefault(s => s.code.Equals(code));

                if (shop.type_name.Equals("天猫"))
                {
                    return("紫荆");
                }
                //else if (shop.type_name.Equals("淘宝"))
                //    return "欧阳";
                else if (shop.type_name.Equals("京东"))
                {
                    return("丹丹");
                }
                else if (shop.type_name.Equals("Ebay"))
                {
                    return("叮当");
                }
                else if (shop.type_name.Equals("贝贝网"))
                {
                    return("辉驮");
                }
                else
                {
                    return("成风");
                }
            }
        }