Ejemplo n.º 1
0
        public void SearchData()
        {
            string id = Request["id"].ToString();

            if (!CurrentMaster.IsMain)
            {
                //获取用户查看类型
                string className = GetRequestQueryString("className");//页面类名
                if (!String.IsNullOrEmpty(className))
                {
                    if (!String.IsNullOrEmpty(CurrentMaster.RoleIdList))
                    {
                        CurrentMaster.LookPower = new BllSysMaster().GetLookPower(className, CurrentMaster.RoleIdList, CurrentMaster.Company.Attribute);
                    }
                }

                if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建)
                {
                    _where = "CreaterId='" + CurrentMaster.Id + "'";//自己查看自己的
                }
            }

            DataSet ds = new BllSysCategory().SearchData(id, _where);
            List <jsonSysCategory> list = new FunTreeCommon().GetTreeBySysCategory(ds);

            WriteJsonToPage(JsonHelper.ToJson(list));
        }
Ejemplo n.º 2
0
        public void SaveData(ModSysCategory t)
        {
            BllSysCategory bll  = new BllSysCategory();
            ModJsonResult  json = new ModJsonResult();

            t.Status           = (int)StatusEnum.正常;
            t.Path             = "";
            t.IsSystem         = false;
            t.CreaterId        = CurrentMaster.Id;
            t.CreaterName      = CurrentMaster.UserName;
            t.ParentCategoryId = Request["parentId"].ToString();
            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                var Category = bll.LoadData(t.Id);
                int result   = bll.UpdateDate(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = "修改失败,请稍后再操作!";
                }
            }
            else
            {
                t.PicUrl    = t.PicUrl == null ? "/Resource/ShopCategory/default.png" : t.PicUrl;
                t.Id        = Guid.NewGuid().ToString();
                t.CompanyId = CurrentMaster.Cid;

                if (!string.IsNullOrEmpty(t.ParentCategoryId))
                {
                    var Category = bll.LoadData(t.ParentCategoryId);
                    if (Category != null)
                    {
                        t.Depth = Category.Depth + 1;
                    }
                    else
                    {
                        t.Depth = 0;
                    }
                }
                int result = bll.InsertDate(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
            }

            WriteJsonToPage(json.ToString());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 启用状态
        /// </summary>
        public void EnableUse()
        {
            var msg = new ModJsonResult();

            string key    = Request["id"];
            int    result = new BllSysCategory().UpdateIsStatus(1, key);

            if (result > 0)
            {
                msg.success = true;
            }
            else
            {
                msg.success = false;
                msg.msg     = "操作失败";
            }

            WriteJsonToPage(msg.ToString());
        }
Ejemplo n.º 4
0
        public void SearchDataEdit()
        {
            string ParentCategoryId    = Request["ParentCategoryId"] == null ? "0" : Request["ParentCategoryId"];
            List <ModSysCategory> list = new BllSysCategory().QueryToAll().Where(p => p.ParentCategoryId == ParentCategoryId && p.Status == (int)StatusEnum.正常).ToList();
            //增加一个默认节点(全部)
            var debugger = (Request["debugger"] != null ? false : true);

            if (debugger)
            {
                if (list.Count > 0)
                {
                    ModSysCategory model = new ModSysCategory();
                    model.Id               = "";
                    model.Name             = "全部";
                    model.ParentCategoryId = "0";
                    list.Insert(0, model);
                }
            }
            WriteJsonToPage(JsonHelper.ToJson(list));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 删除
        /// </summary>
        public void DeleteData(string id)
        {
            var msg = new ModJsonResult();

            try
            {
                int result = new BllSysCategory().DeleteDate(id);
                if (result > 0)
                {
                    msg.success = true;
                }
                else
                {
                    msg.success = false;
                    msg.msg     = "操作失败";
                }
            }
            catch (Exception ex)
            {
                msg.msg = "操作失败:" + ex.Message;
            }
            WriteJsonToPage(msg.ToString());
        }
Ejemplo n.º 6
0
        public void Comboboxtree()
        {
            try
            {
                string key = Request["key"].ToString();//编辑的Id
                if (!string.IsNullOrEmpty(key))
                {
                    _where += " and Id!='" + key + "'";
                }
                if (!CurrentMaster.IsMain)
                {
                    //获取用户查看类型
                    string className = GetRequestQueryString("className");//页面类名
                    if (!String.IsNullOrEmpty(className))
                    {
                        if (!String.IsNullOrEmpty(CurrentMaster.RoleIdList))
                        {
                            CurrentMaster.LookPower = new BllSysMaster().GetLookPower(className, CurrentMaster.RoleIdList, CurrentMaster.Company.Attribute);
                        }
                    }

                    if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建)
                    {
                        _where += " and CreaterId='" + CurrentMaster.Id + "'";//自己查看自己的
                    }
                }

                DataSet ds = new BllSysCategory().GetTreeList(_where);

                Output = JsonHelper.ToJson(new FunTreeCommon().CategoryTreeNodes(ds));
            }
            catch
            {
                Output = "{{'msg':'','success':false}}";
            }
            WriteJsonToPage(Output);
        }