Beispiel #1
0
        /// <summary>
        /// 显示、隐藏 导购分类
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isshow"></param>
        /// <returns></returns>
        public JsonResult SetEnableGuideProductCgty(int id, bool isshow)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <GuideProductCatgService>().SetEnable(id, isshow);

            return(Json(GetResult(state)));
        }
Beispiel #2
0
        /// <summary>
        /// 签名验证
        /// </summary>
        /// <param name="actionContext"></param>
        public override void OnActionExecuting(ActionExecutingContext actionContext)
        {
            try
            {
                base.OnActionExecuting(actionContext);
                //加密字符串参数
                string ticket = actionContext.HttpContext.Request.Query["ticket"];
                //业务类型
                string bizType = actionContext.HttpContext.Request.Query["bizType"];
                //业务ID
                string bizId = actionContext.HttpContext.Request.Query["bizId"];

                if (!string.IsNullOrEmpty(ticket) && !string.IsNullOrEmpty(bizType) && !string.IsNullOrEmpty(bizId))
                {
                    string val = bizType + "#" + bizId + ConfigManage.AppSettings <string>("AppSettings:EncryptKey");
                    if (!ticket.ToUpper().Equals(StringHelper.ConvertTo32BitSHA1(val).ToUpper()))
                    {
                        //actionContext.Response = APIResponse.toJson(StateCode.State_9000);
                        return;
                    }
                }
                else
                {
                    //actionContext.Response = APIResponse.toJson(StateCode.State_9001);
                    return;
                }
            }
            catch (Exception ex)
            {
                ServiceIoc.Get <APILogsService>().Save("AppCheckUp==>" + ex.ToString());
            }

            return;
        }
        /// <summary>
        /// 配送方式 翻页/查询
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public ContentResult GetDeliveryModes(int pageSize, int pageIndex, string keyword)
        {
            //查询对象
            Criteria ct = new Criteria();

            //查询表达式
            MutilExpression me = new MutilExpression();

            ct.SetFromTables("v_dist_deliverymode")
            .SetPageSize(pageSize)
            .SetStartPage(pageIndex)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //物流公司名称
            if (!string.IsNullOrEmpty(keyword))
            {
                me.Add(new SingleExpression("name", LogicOper.LIKE, keyword));
            }

            if (me.Expressions.Count > 0)
            {
                ct.SetWhereExpression(me);
            }

            DataTable dt = ServiceIoc.Get <DeliveryModeService>().Fill(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, dt));
        }
Beispiel #4
0
        /// <summary>
        /// 保存扩展属性
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public JsonResult SaveExtAttrName(SysUser user, ExtAttrName extAttrName, string attrvals)
        {
            //属性值集合
            string[] arr_val = null;
            if (attrvals != null && attrvals.IndexOf(",") != -1)
            {
                attrvals = attrvals.Replace(",", ",");
            }

            arr_val = StringHelper.StringToArray(attrvals);

            if (extAttrName.id == 0)
            {
                extAttrName.created_user_id = user.id;
                extAttrName.created_date    = DateTime.Now;
            }
            else
            {
                extAttrName.updated_user_id = user.id;
                extAttrName.updated_date    = DateTime.Now;
            }

            //保存
            StateCode state = ServiceIoc.Get <ExtAttrNameService>().Save(extAttrName, arr_val);

            return(Json(GetResult(state)));
        }
Beispiel #5
0
        /// <summary>
        /// 资讯页面
        /// </summary>
        /// <returns></returns>
        public IActionResult InformtForm()
        {
            //缺省图片路劲
            ViewBag.defurl = ResXmlConfig.Instance.DefaultImgSrc(ViewBag.Res, ImgType.Informt);
            ViewBag.imgurl = ViewBag.defurl;

            List <InformtCatg> cgtys = ServiceIoc.Get <InformtCatgService>().GetListByParentId(0);

            cgtys.Insert(0, new InformtCatg()
            {
                name = "根目录", id = 0
            });
            ViewBag.Parents = cgtys;

            ViewBag.Ticket        = StringHelper.GetEncryption(ImgType.Informt + "#" + bid);
            ViewBag.DetailsTicket = StringHelper.GetEncryption(ImgType.InformtDetails + "#" + bid);

            Informt informt = ServiceIoc.Get <InformtService>().GetById(bid);

            if (informt != null)
            {
                //正面图
                Img img = ServiceIoc.Get <ImgService>().GetImg(ImgType.Informt, informt.id);
                if (img != null)
                {
                    ViewBag.imgurl = string.IsNullOrEmpty(img.getImgUrl()) ? ViewBag.imgurl : img.getImgUrl();
                }
                ViewBag.informt = JsonConvert.SerializeObject(informt);
            }
            return(View());
        }
Beispiel #6
0
        /// <summary>
        /// 部门表单页
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IActionResult DepartmentForm(SysUser user, Department entity)
        {
            if (Request.IsAjaxRequest())
            {
                StateCode code = ServiceIoc.Get <DepartmentService>().Save(user.id, entity);
                return(Json(GetResult(code)));
            }
            else
            {
                List <Company> menuList = ServiceIoc.Get <CompanyService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new Company()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                List <Department> departments = ServiceIoc.Get <DepartmentService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                departments.Insert(0, new Department()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Departments = departments;

                entity = ServiceIoc.Get <DepartmentService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Beispiel #7
0
        /// <summary>
        /// 获取默认 无关键词 匹配回复
        /// </summary>
        /// <param name="wxRequest"></param>
        /// <param name="account"></param>
        /// <param name="globalConfig"></param>
        /// <returns></returns>
        public string GetWXResponseDefaultMsg(WXReqBaseMsg wxRequest, WeChatAccountTmp account)
        {
            //获取账号默认回复设置
            DefaultSet defaultSet = ServiceIoc.Get <DefaultSetService>().GetDefaultSet();

            //默认无匹配回复
            if (defaultSet != null && !string.IsNullOrEmpty(defaultSet.d_reply_value) && defaultSet.d_reply_value.IndexOf("#") != -1 && defaultSet.d_reply_isopen)
            {
                //关注回复类型
                string d_type = defaultSet.d_reply_value.Split('#')[1];

                //关注回复业务ID
                int d_bizid = int.Parse(defaultSet.d_reply_value.Split('#')[0].ToString());

                //文本回复
                if (KeyWordBizType.TextReply.Equals(d_type))
                {
                    return(ServiceIoc.Get <TextReplyService>().GetWXResponseMsg(wxRequest, account, d_bizid));
                }
                else if (KeyWordBizType.ImgTextReply.Equals(d_type))
                {
                    return(ServiceIoc.Get <ImgTextReplyService>().GetWXResponseMsg(wxRequest, account, d_bizid));
                }
            }

            return(string.Empty);
        }
Beispiel #8
0
        /// <summary>
        /// 订单明细
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ActionResult ProductOrderForm(SysUser user)
        {
            //订单
            ProductOrder order = ServiceIoc.Get <ProductOrderService>().GetById(bid);

            //订单发货地址
            OrderDelivery delivery = ServiceIoc.Get <OrderDeliveryService>().GetByOrderId(bid);

            ViewBag.delivery = delivery;

            //订单详情
            List <ProductOrderDetail> order_details = ServiceIoc.Get <ProductOrderDetailService>().GetListByOrderId(bid);

            if (order == null || order_details == null)
            {
                throw new Exception("订单数据异常");
            }

            //物流公司
            ViewBag.companys = ServiceIoc.Get <LogisticsCompanyService>().GetAll();

            //判断是否为跳转过来的链接
            ViewBag.isUrlReferrer = Request.Headers["Referer"].FirstOrDefault() == null ? false : true;

            ViewBag.order         = order;
            ViewBag.order_details = order_details;

            return(View());
        }
        /// <summary>
        /// 微信菜单设置
        /// </summary>
        /// <returns></returns>
        public IActionResult WeChatMenuForm()
        {
            List <DefineMenuGroup> Menus = ServiceIoc.Get <DefineMenuGroupService>().GetAll();

            ViewBag.Menus = JsonConvert.SerializeObject(Menus);
            return(View());
        }
Beispiel #10
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="posx"></param>
        /// <param name="loginpk"></param>
        /// <param name="verifyvode"></param>
        /// <returns></returns>
        public JsonResult LoginIn([FromBody] dynamic data)
        {
            //图形验证码
            //if (!LoginUser.VerificationCode.ToString().Equals(vcode))  return Json(GetResult(StateCode.State_104), JsonRequestBehavior.AllowGet);

            //当前私钥
            string private_key = HttpContext.Session.GetString("privateKey").Replace("\r\n", "");

            //解密登录信息
            string posx = AlgorithmHelper.Decrypt(private_key, data.posx.ToString());

            //用户密码
            string username = posx.Split("\\")[0];
            string password = posx.Split("\\")[1];

            //登录
            SysUser user = ServiceIoc.Get <SysUserService>().Login(username, password, HttpContext.GetClientIp());

            if (user.login_code == StateCode.State_200)
            {
                //登录操作
                LoginUser.Instance.LoginIn(user, this.HttpContext);
                return(Json(GetResult(user.login_code)));
            }

            return(Json(GetResult(user.login_code)));
        }
Beispiel #11
0
        /// <summary>
        /// 关闭订单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public JsonResult CloseOrder(long id)
        {
            StateCode state = StateCode.State_200;

            try
            {
                ProductOrder order = ServiceIoc.Get <ProductOrderService>().GetById(id);

                if (order == null)
                {
                    state = StateCode.State_1;
                }
                else
                {
                    order.status       = OrderStatus.Close;
                    order.updated_date = DateTime.Now;
                    ServiceIoc.Get <ProductOrderService>().Update(order);
                }
            }
            catch
            {
                state = StateCode.State_500;
            }
            return(Json(GetResult(state)));
        }
Beispiel #12
0
        /// <summary>
        /// 商品管理
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public IActionResult ProductManage(SysUser user)
        {
            //所属分类
            List <ProductCatg> productCatgs = ServiceIoc.Get <ProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));

            productCatgs.Insert(0, new ProductCatg()
            {
                name = "——商品分类——", id = 0
            });
            ViewBag.productCatgs = productCatgs;

            //导购分类
            List <GuideProductCatg> guideProductCatgs = ServiceIoc.Get <GuideProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));

            guideProductCatgs.Insert(0, new GuideProductCatg()
            {
                name = "——导购分类——", id = 0
            });
            ViewBag.guideProductCatgs = guideProductCatgs;

            //品牌
            List <ProductBrand> brands = ServiceIoc.Get <ProductBrandService>().GetAll();

            brands.Insert(0, new ProductBrand()
            {
                name = "——所属品牌——", id = 0
            });
            ViewBag.Brands = brands;

            return(View());
        }
Beispiel #13
0
        /// <summary>
        /// 品牌信息页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="imgmsg"></param>
        /// <returns></returns>
        public IActionResult BrandForm(SysUser user, ProductBrand entity, string imgmsg)
        {
            if (NHttpContext.Current.Request.IsAjaxRequest())
            {
                //获取状态
                StateCode state = ServiceIoc.Get <ProductBrandService>().Save(user.id, entity, imgmsg);
                return(Json(GetResult(state)));
            }
            else
            {
                ViewBag.Ticket = StringHelper.GetEncryption(ImgType.Product_Brand + "#" + bid);
                ViewBag.defurl = ResXmlConfig.Instance.DefaultImgSrc(AppGlobal.Res, ImgType.Product_Brand);
                ViewBag.imgurl = ViewBag.imgurl;

                entity = ServiceIoc.Get <ProductBrandService>().GetById(bid);
                if (entity != null)
                {
                    Img img = ServiceIoc.Get <ImgService>().GetImg(ImgType.Product_Brand, entity.id);
                    if (img != null)
                    {
                        ViewBag.imgurl = string.IsNullOrEmpty(img.getImgUrl()) ? ViewBag.defimgurl : img.getImgUrl();
                    }
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
Beispiel #14
0
        /// <summary>
        /// 删除导购分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult DeletePdtGuideCatg()
        {
            //获取状态
            StateCode state = ServiceIoc.Get <GuideProductCatgService>().Delete(bid);

            return(Json(GetResult(state)));
        }
        /// <summary>
        /// 获取系统参数配置
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="status"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public JsonResult GetConfigParams(int pageSize, int pageIndex, int status, string keyword)
        {
            //查询对象
            Criteria ct = new Criteria();

            //查询表达式
            MutilExpression me = new MutilExpression();

            ct.SetPageSize(pageSize)
            .SetStartPage(pageIndex)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //查询关键词
            if (!string.IsNullOrEmpty(keyword))
            {
                me.Add(new SingleExpression("key", LogicOper.LIKE, keyword));
            }

            //栏目类型
            if (status != -1)
            {
                me.Add(new SingleExpression("is_enable", LogicOper.EQ, status == 1));
            }

            //条件
            if (me.Expressions.Count > 0)
            {
                ct.SetWhereExpression(me);
            }

            List <ConfigParam> list = ServiceIoc.Get <ConfigParamService>().GetList(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, list));
        }
        /// <summary>
        /// 删除微信菜单
        /// </summary>
        /// <returns></returns>
        public JsonResult DelWeChatMenu()
        {
            try
            {
                string        data;
                WeChatAccount wxAccount = ServiceIoc.Get <WeChatAccountService>().Get();
                AccessToken   token     = WeChatBaseHelper.GetAccessToken(wxAccount.appid, wxAccount.app_secret);
                if (token.access_token == null)
                {
                    return(Json(GetResult(StateCode.State_152)));
                }
                data = WeChatBaseHelper.DeleteWXMenu(token.access_token);
                var errcode = JsonConvert.DeserializeObject <WXErrCode>(data);
                if (errcode.errcode > 0)
                {
                    return(Json(GetResult(StateCode.State_152, token.errcode)));
                }

                //errcode 等于0时候成功
                return(Json(GetResult(StateCode.State_200)));
            }
            catch
            {
                return(Json(GetResult(StateCode.State_500)));
            }
        }
        /// <summary>
        /// 初始化菜单页面
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ActionResult SysMenuForm(SysUser user, SysModelMenu entity = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <SysModelMenuService>().Save(user.id, entity);

                //初始化
                AppGlobal.Instance.Initial();

                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                List <SysModelMenu> menuList = ServiceIoc.Get <SysModelMenuService>().GetChildrenTag(0, 0, System.Web.HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new SysModelMenu()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                entity = ServiceIoc.Get <SysModelMenuService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
        /// <summary>
        /// 获取LBS地理位置
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public ContentResult GetLBSReplys(int pageSize, int currentPage, int type, string keyword)
        {
            //查询对象
            Criteria ct = new Criteria();

            //查询表达式
            MutilExpression me = new MutilExpression();

            ct.SetFromTables("tb_rpy_lbs")
            .SetPageSize(pageSize)
            .SetStartPage(currentPage)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //商品类型
            if (type == 0)
            {
                me.Add(new SingleExpression("name", LogicOper.LIKE, keyword));
            }
            else
            {
                me.Add(new SingleExpression("lbsaddress", LogicOper.LIKE, keyword));
            }

            if (me.Expressions.Count > 0)
            {
                ct.SetWhereExpression(me);
            }

            DataTable dt = ServiceIoc.Get <ImgTextReplyService>().Fill(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, dt));
        }
Beispiel #19
0
        /// <summary>
        /// 初始化菜单页面
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public IActionResult CompanyForm(SysUser user, Company entity = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <CompanyService>().Save(user.id, entity);

                //初始化
                AppGlobal.Instance.Initial();

                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                List <Company> menuList = ServiceIoc.Get <CompanyService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
                menuList.Insert(0, new Company()
                {
                    name = "根目录", id = 0
                });
                ViewBag.Parents = menuList;

                entity = ServiceIoc.Get <CompanyService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public JsonResult ResetPsw(SysUser user)
        {
            string    psw   = ConfigManage.AppSettings <string>("AppSettings:DefaultPassWord");
            StateCode state = ServiceIoc.Get <SysUserService>().ResetPsw(bid, psw);

            return(Json(GetResult(StateCode.State_200)));
        }
Beispiel #21
0
        /// <summary>
        /// 保存OSS图片信息方法
        /// </summary>
        /// <param name="bizType"></param>
        /// <param name="ossDomain"></param>
        /// <param name="fileName"></param>
        /// <param name="originName"></param>
        /// <param name="filelength"></param>
        /// <returns></returns>
        public static string[] SaveImgOss(string bizType, string ossDomain, string fileName, string originName, int filelength)
        {
            Img img = new Img();

            //业务类型
            img.biz_type = bizType;
            //业务ID
            img.biz_id = 0;
            //资源服务器域名
            img.domain_name = ossDomain;
            //扩展名称
            img.extend_name = Path.GetExtension(originName);
            //文件名称
            img.file_name = fileName.Split('.')[0];
            //原文件名
            img.original = originName;
            //文件访问物理路径
            img.file_path = "";
            //服务器路径
            img.visit_path = "";
            //文件大小
            img.file_size = ((float)filelength / 1000) + "kb";
            //上传时间
            img.upload_time = DateTime.Now;

            return(ServiceIoc.Get <ImgService>().Save(img));
        }
        /// <summary>
        /// 修改个人信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="imgmsg"></param>
        /// <returns></returns>
        public ActionResult UpdateUserForm(SysUser user, Employee entity = null, string imgmsg = null)
        {
            if (Request.IsAjaxRequest())
            {
                //保存菜单
                StateCode code = ServiceIoc.Get <EmployeeService>().Save(user.id, entity, imgmsg);
                //返回数据
                return(Json(GetResult(code)));
            }
            else
            {
                //缺省图片路径
                ViewBag.defurl = ResXmlConfig.Instance.DefaultImgSrc(AppGlobal.Res, ImgType.Sys_User);
                //用户图片路径
                ViewBag.imgurl = ViewBag.defurl;
                //当前用户加密ID
                ViewBag.Ticket = StringHelper.GetEncryption(ImgType.Sys_User + "#" + bid);

                //当前用户信息
                entity = ServiceIoc.Get <EmployeeService>().GetByUserId(LoginUser.Instance.User.id);
                if (entity != null)
                {
                    //当前用户实体
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                    Img img = ServiceIoc.Get <ImgService>().GetImg(ImgType.Sys_User, entity.id);
                    if (img != null)
                    {
                        ViewBag.imgurl = string.IsNullOrEmpty(img.getImgUrl()) ? ViewBag.defurl : img.getImgUrl();
                    }
                }
            }

            return(View());
        }
Beispiel #23
0
        /// <summary>
        /// 保存商品规格
        /// </summary>
        /// <param name="user"></param>
        /// <param name="specName"></param>
        /// <param name="specValues"></param>
        /// <returns></returns>
        public JsonResult SaveSpecName(SysUser user, SpecName specName, string specValues)
        {
            //属性值集合
            string[] arr_val = null;
            if (specValues != null && specValues.IndexOf(",") != -1)
            {
                specValues = specValues.Replace(",", ",");
            }
            arr_val = StringHelper.StringToArray(specValues);

            if (specName.id == 0)
            {
                specName.created_user_id = user.id;
                specName.created_date    = DateTime.Now;
            }
            else
            {
                specName.updated_user_id = user.id;
                specName.updated_date    = DateTime.Now;
            }

            //保存
            StateCode state = ServiceIoc.Get <SpecNameService>().Save(specName, arr_val);

            return(Json(GetResult(state)));
        }
        /// <summary>
        /// 角色页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name="pIds"></param>
        /// <returns></returns>
        public ActionResult SysRoleForm(SysUser user, SysRole entity = null, string pIds = "")
        {
            if (Request.IsAjaxRequest())
            {
                StateCode state = ServiceIoc.Get <SysRoleService>().Save(user.id, entity, pIds);
                //返回数据
                return(Json(GetResult(state)));
            }
            else
            {
                entity = ServiceIoc.Get <SysRoleService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                    List <SysRolePermission> rolePermissions = ServiceIoc.Get <SysRolePermissionService>().GetPermissionsByRoleId(bid);
                    ViewBag.pids = string.Join(",", rolePermissions.Select(p => p.permission_id.ToString()).ToArray());
                }
            }

            //系统所有权限
            List <SysPermission> permissions = ServiceIoc.Get <SysPermissionService>().GetList("order by order_index desc", "");

            ViewBag.permissions = permissions.Where(p => p.parent_id == 0).ToList();

            ViewBag.childrens = permissions.Where(p => p.parent_id != 0).ToList();

            return(View());
        }
Beispiel #25
0
        /// <summary>
        /// 获取资讯类别分页
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="name"></param>
        /// <param name="createdDate"></param>
        /// <returns></returns>
        public JsonResult GetInformtCatgs(int pageSize, int currentPage, string name)
        {
            //创建查询对象
            Criteria ct = new Criteria();

            ct.SetPageSize(pageSize)
            .SetStartPage(currentPage)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //查询表达式
            MutilExpression me = new MutilExpression();

            if (!string.IsNullOrEmpty(name))
            {
                me.Add(new SingleExpression("name", LogicOper.LIKE, name));
            }

            if (me.Expressions.Count > 0)
            {
                //设置查询条件
                ct.SetWhereExpression(me);
            }

            List <InformtCatg> data = ServiceIoc.Get <InformtCatgService>().GetList(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, data));
        }
        /// <summary>
        /// 设置角色是否可用
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public JsonResult SetEnableSysRole(bool status)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <SysRoleService>().SetEnable(bid, status);

            return(Json(GetResult(state)));
        }
        /// <summary>
        /// 运费模板 翻页/查询
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public JsonResult GetFreightTemplates(int pageSize, int pageIndex, string name)
        {
            //查询对象
            Criteria ct = new Criteria();

            //查询表达式
            MutilExpression me = new MutilExpression();

            ct.SetPageSize(pageSize)
            .SetStartPage(pageIndex)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //物流公司名称
            if (!string.IsNullOrEmpty(name))
            {
                me.Add(new SingleExpression("name", LogicOper.LIKE, name));
            }

            if (me.Expressions.Count > 0)
            {
                ct.SetWhereExpression(me);
            }

            List <FreightTemplate> data = ServiceIoc.Get <FreightTemplateService>().GetList(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, data));
        }
        /// <summary>
        /// 权限页面
        /// </summary>
        /// <param name="user"></param>
        /// <param name="entity"></param>
        /// <param name=""></param>
        /// <returns></returns>
        public ActionResult SysPermissionForm(SysUser user, SysPermission entity = null)
        {
            //所属分类数据
            List <SysPermission> modulePermissions = new List <SysPermission>();

            modulePermissions.Add(new SysPermission()
            {
                name = "根", id = 0
            });
            modulePermissions.AddRange(GetModuleSysPermission());
            ViewBag.module = modulePermissions;

            if (Request.IsAjaxRequest())
            {
                StateCode state = ServiceIoc.Get <SysPermissionService>().Save(user.id, entity);
                AppGlobal.Instance.Initial();
                return(Json(GetResult(state)));
            }
            else
            {
                entity = ServiceIoc.Get <SysPermissionService>().GetById(bid);
                if (entity != null)
                {
                    ViewBag.entity = JsonConvert.SerializeObject(entity);
                }
            }

            return(View());
        }
        /// <summary>
        /// 物流公司 翻页/查询
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public JsonResult GetLogisticsCompanys(int pageSize, int pageIndex, string keyword)
        {
            //查询对象
            Criteria ct = new Criteria();

            //查询表达式
            MutilExpression me = new MutilExpression();

            ct.SetPageSize(pageSize)
            .SetStartPage(pageIndex)
            .SetFields(new string[] { "*" })
            .AddOrderBy(new OrderBy("id", "desc"));

            //物流公司名称
            if (!string.IsNullOrEmpty(keyword))
            {
                me.Add(new SingleExpression("Name", LogicOper.LIKE, keyword));
            }

            if (me.Expressions.Count > 0)
            {
                ct.SetWhereExpression(me);
            }

            List <LogisticsCompany> companys = ServiceIoc.Get <LogisticsCompanyService>().GetList(ct);

            return(PageResult(StateCode.State_200, ct.TotalRow, companys));
        }
Beispiel #30
0
 /// <summary>
 /// 前端导购分类
 /// </summary>
 /// <returns></returns>
 public IActionResult GuidePdtCatgForm(SysUser user, GuideProductCatg entity = null, string imgmsg = null)
 {
     if (NHttpContext.Current.Request.IsAjaxRequest())
     {
         //获取状态
         StateCode state = ServiceIoc.Get <GuideProductCatgService>().Save(user.id, entity, imgmsg);
         return(Json(GetResult(state)));
     }
     else
     {
         //所属分类
         List <GuideProductCatg> Parents = ServiceIoc.Get <GuideProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
         Parents.Insert(0, new GuideProductCatg()
         {
             name = "根", id = 0
         });
         ViewBag.Parents = Parents;
         //当前商品分类
         entity = ServiceIoc.Get <GuideProductCatgService>().GetById(bid);
         if (entity != null)
         {
             ViewBag.entity = JsonConvert.SerializeObject(entity);
         }
     }
     return(View());
 }