public ActionResult Menu_Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            WX_Menu         m      = new WX_Menu();

            TryUpdateModel <WX_Menu>(m, form);
            m.CompanyID = UserDateTicket.Company.ID;
            switch (m.Type)
            {
            case 0:
                m.URL = "";
                break;

            case 1:
                m.KeyWordID = Guid.Empty;
                break;

            case 2:
                m.URL       = "";
                m.KeyWordID = Guid.Empty;
                break;
            }
            if (m.ID == Guid.Empty)
            {
                result.status = WX_MenuService.instance().Insert(m);
            }
            else
            {
                result.status = WX_MenuService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/WeChat/Menu_Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public JsonResult NewEdit(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            News            m      = new News();

            TryUpdateModel <News>(m, form);
            m.IsAudit     = form["IsAudit"] == "1";
            m.IsRecommend = form["IsRecommend"] == "1";
            m.IsTop       = form["IsTop"] == "1";
            m.IsComm      = form["IsComm"] == "1";
            m.IsVote      = form["IsVote"] == "1";
            m.Description = Util.Utils.ImgRemoveURL(Server.UrlDecode(m.Description));
            //m.SlidePic = form["filePath"];
            if (m.ID == Guid.Empty)
            {
                result.status = NewsService.instance().Insert(m);
            }
            else
            {
                result.status = NewsService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/General/NewList/" + m.ClassID;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult FlagShipLogo(FormCollection form)
        {
            ResultBase_form  result = new ResultBase_form();
            SwfsFlagShipLogo entity = new SwfsFlagShipLogo();

            TryUpdateModel <SwfsFlagShipLogo>(entity, form);
            HttpPostedFileBase file = Request.Files["picFile"];

            rsPic.Clear();
            if (file != null && file.ContentLength > 0)
            {
                string width  = form["Width"];
                string height = form["Height"];
                string length = form["Length"];
                rsPic = _SwfsFlagShipModuleLinkService.SaveImg(Request.Files["picFile"], "width:" + width + " ,Height:" + height + ",Length:" + length + "");
                if (rsPic.Keys.Contains("error"))
                {
                    result.status = 0;
                    result.msg    = rsPic["error"];
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    entity.LogoNo = rsPic["success"];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.Form["LogoNo"]))
                {
                    entity.LogoNo = Request.Form["LogoNo"];
                }
            }
            if (entity.LogoId == 0)
            {
                result.status = _logo.Insert(entity);
            }
            else
            {
                result.status = _logo.Update(entity) ? 1 : 0;
            }
            result.msg     = result.status == 0 ? "操作失败" : "操作成功";
            result.content = entity;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            News            m      = new News();

            TryUpdateModel <News>(m, form);
            m.IsAudit     = form["IsAudit"] == "1";
            m.IsRecommend = form["IsRecommend"] == "1";
            m.IsTop       = form["IsTop"] == "1";
            m.Description = Util.Utils.ImgRemoveURL(Server.UrlDecode(m.Description));

            if (m.ID == Guid.Empty)
            {
                m.ID          = Guid.NewGuid();
                result.status = NewsService.instance().Insert(m);
            }
            else
            {
                result.status = NewsService.instance().Update(m);
            }
            if (result.status == 1)
            {
                //video_file
                string file = form["video_file"];
                Files  f    = new Files(); // new Files();
                f.ID        = m.ID;
                f.Type      = 1;
                f.FilePath  = file;
                f.Large     = f.Middle = f.Small = m.SlidePic;
                f.CompanyID = UserDateTicket.Company.ID;
                f.FileExt   = Util.Utils.GetFileExt(file);
                f.FileSize  = Util.Utils.GetFileSize(file);
                if (FilesService.instance().Single(f.ID) == null)
                {
                    FilesService.instance().Insert(f);
                }
                else
                {
                    FilesService.instance().Update(f);
                }
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Video/Index/" + m.ClassID;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            USER            m      = new USER();

            TryUpdateModel <USER>(m, form);
            if (m.ID == Guid.Empty)
            {
                result.status = UserService.instance().Insert(m);
            }
            else
            {
                result.status = UserService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/User/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult WeChart(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            wx_userweixin   m      = new wx_userweixin();

            TryUpdateModel <wx_userweixin>(m, form);
            if (m.ID == Guid.Empty)
            {
                result.status = wx_userweixinService.instance().Insert(m);
            }
            else
            {
                result.status = wx_userweixinService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Company/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult MessagesDetail(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Messages_Reply  m      = new Messages_Reply();

            TryUpdateModel <Messages_Reply>(m, form);
            m.Content = Server.UrlDecode(m.Content);
            if (m.ID == Guid.Empty)
            {
                result.status = Messages_ReplyService.instance().Insert(m);
            }
            else
            {
                result.status = Messages_ReplyService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Class/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #8
0
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            P_Categories    m      = new P_Categories();

            TryUpdateModel <P_Categories>(m, form);
            //m.Description = Util.Utils.ImgRemoveURL(Server.UrlDecode(m.Description));
            if (m.ID == Guid.Empty)
            {
                result.status = P_CategoriesService.instance().Insert(m);
            }
            else
            {
                result.status = P_CategoriesService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = form["ResultURL"];
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Index(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            WX_Config       m      = new WX_Config();

            TryUpdateModel <WX_Config>(m, form);
            m.CompanyID = UserDateTicket.Company.ID;
            if (m.ID == Guid.Empty)
            {
                result.status = WX_ConfigService.instance().Insert(m);
            }
            else
            {
                result.status = WX_ConfigService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/WeChat/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult KeyWords_Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            WX_KeyWord      m      = new WX_KeyWord();

            TryUpdateModel <WX_KeyWord>(m, form);
            m.CompanyID = UserDateTicket.Company.ID;
            m.ConfigID  = UserDateTicket.wx_config.ID;
            switch (m.Type)
            {
            case 0:    //图文消息
                m.Content = "";
                break;

            case 1:    //文字
                m.RelationID = Guid.Empty;
                break;

            case 2:    //图片
                break;

            case 3:    //语音
                break;

            case 4:     //视频
                break;

            case 5:    //API
                m.RelationID = Guid.Empty;
                break;
            }
            if (m.ID == Guid.Empty)
            {
                result.status = WX_KeyWordService.instance().Insert(m);
            }
            else
            {
                result.status = WX_KeyWordService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/WeChat/KeyWords";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Company         m      = new Company();

            TryUpdateModel <Company>(m, form);
            m.Description = Server.UrlDecode(m.Description);
            if (m.ID == Guid.Empty)
            {
                result.status = CompanyService.instance().Insert(m);
            }
            else
            {
                result.status = CompanyService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Company/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult OperationPicture(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            SWfsFlagShipOperationPicture entity = new SWfsFlagShipOperationPicture();

            TryUpdateModel <SWfsFlagShipOperationPicture>(entity, form);
            HttpPostedFileBase file = Request.Files["picFile"];

            rsPic.Clear();
            if (file != null && file.ContentLength > 0)
            {
                rsPic = _SwfsFlagShipModuleLinkService.SaveImg(Request.Files["picFile"], "width:310 ,Height:200,Length:150");
                //rsPic = _com.PostImg(file, "width:0 ,Height:0,Length:100");
                if (rsPic.Keys.Contains("error"))
                {
                    result.status = 0;
                    result.msg    = rsPic["error"];
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    entity.PictureFileNo = rsPic["success"];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.Form["LogoNo"]))
                {
                    entity.PictureFileNo = Request.Form["PictureFileNo"];
                }
            }
            if (entity.PictureManageId == 0)
            {
                result.status = _pic.Insert(entity);
            }
            else
            {
                result.status = _pic.Update(entity) ? 1 : 0;
            }
            result.msg     = result.status == 0 ? "操作失败" : "操作成功";
            result.content = entity;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult UpdateParameters(IEnumerable <_post_Product_Attr> items)
        {
            ResultBase_form result = new ResultBase_form();

            result.status = 1;
            result.msg    = "操作成功";
            try
            {
                //清除数据
                Guid pid = items.First().ProductID;
                if (Product_Att_ValService.instance().DeleteByProductID(pid) > 0 && Product_PriceService.instance().DeleteByProductID(pid) > 0)
                {
                    foreach (var item in items)
                    {
                        //添加属性值
                        Product_Att_Val pv = new Product_Att_Val();
                        pv.ID         = Guid.NewGuid();
                        pv.ProductID  = pid;
                        pv.Value      = item.Att_val;
                        pv.Att_Key_ID = item.Att_key;
                        pv.Short      = item.Short;
                        if (Product_Att_ValService.instance().Insert(pv) > 0)
                        {
                            //添加价格
                            Product_Price pp = new Product_Price();
                            pp.ID        = Guid.NewGuid();
                            pp.ProductID = pid;
                            pp.Price     = item.Price;
                            pp.Stock     = item.Stock;
                            pp.Att_Key   = item.Att_key;
                            pp.Att_Val   = pv.ID;
                            Product_PriceService.instance().Insert(pp);
                        }
                    }
                }
            }
            catch
            {
                result.status = 0;
                result.msg    = "操作失败";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Product         m      = new Product();

            TryUpdateModel <Product>(m, form);
            m.IsAudit     = form["IsAudit"] == "1";
            m.IsRecommend = form["IsRecommend"] == "1";
            m.IsTop       = form["IsTop"] == "1";
            m.Description = Util.Utils.ImgRemoveURL(Server.UrlDecode(m.Description));
            if (m.ID == Guid.Empty)
            {
                result.status = ProductService.instance().Insert(m);
            }
            else
            {
                result.status = ProductService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = form["ResultURL"];
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Create(FormCollection form)
        {
            ResultBase_form   result = new ResultBase_form();
            IList <Authority> items  = new List <Authority>();
            Role m = new Role();

            TryUpdateModel <Role>(m, form);
            foreach (var item in form["authIds"].Split('|'))
            {
                items.Add(AuthorityService.instance().GetEnumByID(new Guid(item)).FirstOrDefault());
            }
            m.Item_Authoritys = items;
            if (m.ID == Guid.Empty)
            {
                result.status = RoleService.instance().Insert(m);
            }
            else
            {
                result.status = RoleService.instance().Update(m);
            }
            result.msg       = result.status == 0 ? "操作失败" : "操作成功";
            result.ResultURL = "/Role/Index";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #16
0
        public JsonResult Product(FormCollection form)
        {
            ResultBase_form result = new ResultBase_form();
            Guid            ID     = new Guid(form["ID"]);
            Product         p      = ProductService.instance().Single(ID);

            if (!string.IsNullOrEmpty(p.itemid))
            {
                string del_msg = WSApi.vdian_item_delete(GetToken(), p.itemid);
                if (Utils.GetJsonValue(del_msg, "status_code") != "0")
                {
                    result.msg = Utils.GetJsonValue(del_msg, "status_reason");
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
            }
            product_item entity = new product_item();

            entity.item_name = form["Description"];
            entity.price     = form["Price"];
            entity.stock     = form["Stock"];
            entity.imgs      = new List <string>();
            entity.cate_ids  = new List <string>()
            {
                form["cate_ids"]
            };
            entity.skus          = new List <skus>();
            entity.merchant_code = "";
            foreach (var item in FilesService.instance().GetFilesByRelationID(ID))
            {
                string reulst_msg = WSApi.upload(GetToken(), item.FilePath);
                if (Utils.GetJsonValue(reulst_msg, "status_code") == "0")
                {
                    string imgurl = Utils.GetJsonValue(reulst_msg, "result");
                    if (imgurl.Split('?').Length > 0)
                    {
                        entity.imgs.Add(imgurl.Split('?')[0]);
                    }
                    else
                    {
                        entity.imgs.Add(imgurl);
                    }
                }
            }
            foreach (var item in Product_AttService.GetAttsByPID(ID))
            {
                entity.skus.Add(new skus()
                {
                    price             = item.price.Price.ToString(),
                    sku_merchant_code = "",
                    stock             = item.price.Stock.ToString(),
                    title             = item.key.Name + ":" + item.val.Value
                });
            }
            ;
            string json = WSApiJson.vdian_item_add(entity);
            string msg  = WSApi.vdian_item_add(GetToken(), json);

            result.status = Convert.ToInt32(Utils.GetJsonValue(msg, "status_code"));
            if (result.status == 0)
            {
                p.itemid = Utils.GetJsonValue(msg, "itemid");
                p.opt    = "1";
                ProductService.instance().Update(p);
            }
            result.msg       = result.status == 0 ? "操作成功" : "操作失败";
            result.ResultURL = "/WeShop/Product/" + p.ID;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }