Exemplo n.º 1
0
        public ActionResult DeleteGoods(long id)
        {
            t_goods model    = new t_goods();
            var     vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_goods> >();

            vmResult.TData = new VMGDataGrid <t_goods>();

            try
            {
                //删除
                int t1 = GoodsDAL.DeleteGoods(id);
                vmResult.BFlag           = CommonResponseBFlag.Success;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = string.Format("删除产品成功。");
                return(Json(vmResult));
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.LogicError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = "编辑报错" + ex.Message;
            }

            return(Json(vmResult));
        }
Exemplo n.º 2
0
        //添加商品 -编辑
        public ActionResult AddGoods(string formVals = "{}")
        {
            var vmResult = new CommonAjaxResponseModel <bool>();

            try
            {
                t_goods model = formVals.ToModel <t_goods>();

                if (model.id != 0)
                {
                    GoodsDAL.UpdateGoods(model);

                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
                else
                {
                    //插入
                    model.status = 1;
                    GoodsDAL.AddGoods(model);
                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
            }
            catch (Exception ex)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = ex.Message;
            }
            return(Json(vmResult));
        }
Exemplo n.º 3
0
        public ActionResult Create(int id)
        {
            List <t_unit_goods> list = new List <t_unit_goods>();
            string code     = "";
            var    vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit> >();

            vmResult.TData = new VMGDataGrid <t_unit>();
            try
            {
                //创建
                list = UnitDAL.GetGoodsByUnitID(id, ref code);

                RandomGoodsListSerives.getList(list, code, id);

                vmResult.BFlag           = CommonResponseBFlag.Success;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = string.Format("生成系列成功.");
                return(Json(vmResult));
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.LogicError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = "生成系列失败" + ex.Message;
            }

            return(Json(vmResult));
        }
Exemplo n.º 4
0
        public ActionResult GoodsList(int pageIndex, int pageSize, string type, string goodsName, string minPrice, string maxPrice)
        {
            int            total    = 0;
            List <t_goods> list     = new List <t_goods>();
            var            vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_goods> >();

            vmResult.TData = new VMGDataGrid <t_goods>();
            try
            {
                list                       = GoodsDAL.GetGoodsList(pageIndex, pageSize, type, goodsName, minPrice, maxPrice, ref total);
                vmResult.BFlag             = CommonResponseBFlag.Success;
                vmResult.TData.data        = list;
                vmResult.TData.dataCount   = total;
                vmResult.TData.currentPage = pageIndex;
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.SysError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = ex.Message;
            }


            return(Json(vmResult));
        }
Exemplo n.º 5
0
        public JsonResult IndexList()
        {
            CommonAjaxResponseModel <IndexList> vmResult = new CommonAjaxResponseModel <IndexList>();

            IndexList model = new IndexList();

            try
            {
                //获取轮播图
                List <t_index_banner> banner_list = banner_bll.GetModelList("");
                //获取通知列表
                List <t_index_announce> announce_list = announce_bll.GetModelList("");

                model.bannerList   = banner_list;
                model.announceList = announce_list;
                vmResult.BFlag     = CommonResponseBFlag.Success;
                vmResult.TData     = model;
            }
            catch (Exception e)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = e.Message;
            }
            return(Json(vmResult, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public ActionResult GetList(int pageIndex, int pageSize, string code, string unit_kind, string unit_name, string price, string status_code)
        {
            int           total    = 0;
            List <t_unit> list     = new List <t_unit>();
            var           vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit> >();

            vmResult.TData = new VMGDataGrid <t_unit>();
            try
            {
                list                       = UnitDAL.GetList(pageIndex, pageSize, code, unit_kind, unit_name, price, status_code, ref total);
                vmResult.BFlag             = CommonResponseBFlag.Success;
                vmResult.TData.data        = list;
                vmResult.TData.dataCount   = total;
                vmResult.TData.currentPage = pageIndex;
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.SysError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = ex.Message;
            }


            return(Json(vmResult));
        }
Exemplo n.º 7
0
        public ActionResult GetUnitGoodsList(int?id)
        {
            UnitGoodsDetailVM list = new UnitGoodsDetailVM();
            var vmResult           = new CommonAjaxResponseModel <VMGDataGrid <UnitGoodsDetailVM> >();

            vmResult.TData = new VMGDataGrid <UnitGoodsDetailVM>();
            if (id == null)
            {
                Response.Redirect(Url.Action("Index", "Unit"));
                return(View());
            }
            else
            {
                int newId = (int)id;


                try
                {
                    list = UnitDAL.GetUnitGoodsList(newId);

                    vmResult.BFlag            = CommonResponseBFlag.Success;
                    vmResult.TData.singleData = list;
                }
                catch (Exception ex)
                {
                    vmResult.BFlag      = CommonResponseBFlag.LogicError;
                    vmResult.TData.data = null;
                    vmResult.Msg        = ex.Message;
                }
            }


            return(Json(vmResult));
        }
Exemplo n.º 8
0
        //copy复制
        public ActionResult Copy(string formVals = "{}")
        {
            var vmResult = new CommonAjaxResponseModel <bool>();

            try
            {
                t_unit model = formVals.ToModel <t_unit>();


                //  t_unit model2 = UnitDAL.GetModel(model.id);

                int unit_id = UnitDAL.CopyUnit(model);

                //List<t_unit_goods> uglist = UnitDAL.GetUnitGoodsListById(model.id);

                if (unit_id != 0 && unit_id != model.id)
                {
                    UnitDAL.CopyUnitGoods(model.id, unit_id);

                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
            }
            catch (Exception ex)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = ex.Message;
            }
            return(Json(vmResult));
        }
Exemplo n.º 9
0
        public JsonResult carouselList()
        {
            CommonAjaxResponseModel <List <t_index_banner> > vmResult = new CommonAjaxResponseModel <List <t_index_banner> >();

            try
            {
                List <t_index_banner> result = banner_bll.GetModelList("");
                vmResult.BFlag = CommonResponseBFlag.Success;
                vmResult.TData = result;
            }
            catch (Exception e)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = e.Message;
            }
            return(Json(vmResult, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        public ActionResult AddUnitGoods(string formVals = "{}")
        {
            var vmResult = new CommonAjaxResponseModel <bool>();

            try
            {
                t_unit_goods model = formVals.ToModel <t_unit_goods>();

                if (!string.IsNullOrWhiteSpace(model.goods_name))
                {
                    model.goods_id   = int.Parse(model.goods_name.Split('(', ')')[1]);
                    model.goods_name = model.goods_name.Split('(', ')')[0];
                }
                else
                {
                    vmResult.BFlag = CommonResponseBFlag.SysError;
                    vmResult.Msg   = "商品id解析出错";

                    return(Json(vmResult));
                }


                if (model.id != 0)
                {
                    UnitDAL.UpdateUnitGoods(model);

                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
                else
                {
                    //插入
                    UnitDAL.AddUnitGoods(model);
                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
            }
            catch (Exception ex)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = ex.Message;
            }
            return(Json(vmResult));
        }
Exemplo n.º 11
0
        public ActionResult GetUnitGoodsListData(string unit_id, string goods_type, string goods_name, string MD5, decimal?min_price, decimal?max_price, int pageIndex = 1, int pageSize = 15)
        {
            int total = 0;
            List <t_unit_goods_list> list = new List <t_unit_goods_list>();
            var vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit_goods_list> >();

            vmResult.TData = new VMGDataGrid <t_unit_goods_list>();
            try
            {
                list                       = UnitDAL.GetUnitGoodsListData(unit_id, goods_type, goods_name, MD5, min_price, max_price, pageIndex, pageSize, ref total);
                vmResult.BFlag             = CommonResponseBFlag.Success;
                vmResult.TData.data        = list;
                vmResult.TData.dataCount   = total;
                vmResult.TData.currentPage = pageIndex;
            }
            catch (Exception ex)
            {
                vmResult.BFlag      = CommonResponseBFlag.SysError;
                vmResult.TData.data = null;
                vmResult.Msg        = ex.Message;
            }

            return(Json(vmResult));
        }