Beispiel #1
0
        public void GetTreeByMaster()
        {
            string Attribute = Request["Attribute"];//1:老师 2:学生

            if (Attribute == "1")
            {
                string where = " CId='" + CurrentMaster.Company.Id + "'";
                string name = (Request["name"] == null ? "" : Request["name"]); //查询过滤条件
                if (name != "")
                {
                    where += " and Nickname like '%" + name + "%'";
                }

                DataTable mytab = new BllSysUser().GetTreeList(where).Tables[0]; //获取所有树
                GetTreeNode(mytab);
                Output = Output.Replace("check", "checked");
                WriteJsonToPage(Output);
            }
            else
            {
                //查询班级
                string where = " Type=1 and Status=" + (int)StatusEnum.正常;
                DataTable mytab     = new BllSysGroup().GetTreeList(where).Tables[0];    //获取所有树
                string    userwhere = " CId='" + CurrentMaster.Company.Id + "'";
                DataTable usermytab = new BllSysUser().GetTreeList(userwhere).Tables[0]; //获取所有树
                GetClassNode(mytab, usermytab);
                Output = Output.Replace("check", "checked");
                WriteJsonToPage(Output);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除
        /// </summary>
        public void DeleteData(string id)
        {
            var msg = new ModJsonResult();

            try
            {
                //判断类型是否还在使用
                var mode = new BllAdActive().Exists(" ActionFormId='" + id + "'");
                if (mode == true)
                {
                    msg.success = false;
                    msg.msg     = "此类别正在使用,暂不能删除.";
                }
                else
                {
                    int result = new BllSysGroup().DeleteStatus(id);
                    if (result > 0)
                    {
                        msg.success = true;
                        LogInsert(OperationTypeEnum.操作, "公告类别", CurrentMaster.UserName + "删除类别成功.");
                    }
                    else
                    {
                        msg.success = false;
                        msg.msg     = "删除失败.";
                    }
                }
            }
            catch (Exception ex)
            {
                msg.msg = "操作失败:" + ex.Message;
            }
            WriteJsonToPage(msg.ToString());
        }
        public void GetTreeByMaster()
        {
            string Attribute     = Request["Attribute"];                                 //1:业务员 2:学生
            string selectUserkey = (Request["select"] == null ? "" : Request["select"]); //选中的人员编号

            if (Attribute == "6")
            {
                string where = " Cid='" + CurrentMaster.Company.Id + "' and IsSystem!=1 and Attribute=" + Attribute;
                string name = (Request["MasterName"] == null ? "" : Request["MasterName"]); //查询过滤条件
                if (name != "")
                {
                    where += " and UserName like '%" + name + "%'";
                }

                DataTable mytab = new BllSysMaster().GetTreeList(where).Tables[0]; //获取所有树
                GetTreeNode(mytab, selectUserkey);
                Output = Output.Replace("check", "checked");
                WriteJsonToPage(Output);
            }
            else
            {
                //查询班级
                string where = " Type=1 and Status=" + (int)StatusEnum.正常;
                DataTable mytab     = new BllSysGroup().GetTreeList(where).Tables[0];      //获取所有树
                string    userwhere = " Cid='" + CurrentMaster.Company.Id + "' and IsSystem!=1 and Attribute=" + Attribute;
                DataTable usermytab = new BllSysMaster().GetTreeList(userwhere).Tables[0]; //获取所有树
                GetClassNode(mytab, usermytab, selectUserkey);
                Output = Output.Replace("check", "checked");
                WriteJsonToPage(Output);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 保存选择
        /// </summary>
        public void SaveSelect()
        {
            var msg = new ModJsonResult();

            try
            {
                string checkid = Request["checkid"].ToString();                                                      //获取选中的Id
                string CId     = Request["CId"].ToString().Trim() == ""?CurrentMaster.Cid:Request["CId"].ToString(); //公司编号

                StringBuilder sb = new StringBuilder();
                sb.Append("delete from Sys_Group where ParentId !='0';");
                sb.AppendLine();
                sb.Append("insert into Sys_Group(Id,Name,ParentId,CompanyId,CreaterId) select newId() as Id,Name,Id  as ParentId,'" + CId + "' as CompanyId,'" + CurrentMaster.Id + "' as CreaterId from Sys_Dirc where Id in(" + checkid + ")");
                int result = new BllSysGroup().ExecuteNonQueryByText(sb.ToString());
                if (result > 0)
                {
                    msg.success = true;
                }
                else
                {
                    msg.success = false;
                    msg.msg     = "操作失败.";
                }
                LogInsert(OperationTypeEnum.操作, "设备分类引用操作", "删除操作成功.");
            }
            catch (Exception ex)
            {
                LogInsert(OperationTypeEnum.异常, "设备分类引用操作", "删除操作异常消息:" + ex.Message.ToString());
            }
            WriteJsonToPage(msg.ToString());
        }
Beispiel #5
0
        /// <summary>
        /// 删除
        /// </summary>
        public void DeleteData(string id)
        {
            var msg = new ModJsonResult();

            try
            {
                //判断类型是否还在使用
                var mode = new BllSysAppointed().Exists(" Gid='" + id + "'");
                if (mode == true)
                {
                    msg.success = false;
                    msg.msg     = "此类别正在使用,暂不能删除.";
                }
                else
                {
                    int result = new BllSysGroup().DeleteStatus(id);
                    if (result > 0)
                    {
                        msg.success = true;
                    }
                    else
                    {
                        msg.success = false;
                        msg.msg     = "删除失败.";
                    }

                    LogInsert(OperationTypeEnum.操作, "类型删除操作", "删除操作成功.");
                }
            }
            catch (Exception ex)
            {
                LogInsert(OperationTypeEnum.异常, "类型删除操作", "删除操作异常消息:" + ex.Message.ToString());
            }
            WriteJsonToPage(msg.ToString());
        }
Beispiel #6
0
        public void GetSysGroup()
        {
            string CompanyId = Request["CompanyId"].ToString().Trim();//

            if (string.IsNullOrEmpty(CompanyId) || CompanyId == "0")
            {
                CompanyId = CurrentMaster.Cid;
            }
            List <ModSysGroup> list = new BllSysGroup().QueryToAll().Where(p => p.CompanyId == CompanyId && p.Status == (int)StatusEnum.正常).ToList();

            WriteJsonToPage(JsonHelper.ToJson(list));
        }
Beispiel #7
0
        public void GetTreeByClass()
        {
            string where = " Type=1 and Status=" + (int)StatusEnum.正常;
            string name = (Request["name"] == null ? "" : Request["name"]); //查询过滤条件

            if (name != "")
            {
                where += " and Name like '%" + name + "%'";
            }

            DataTable mytab = new BllSysGroup().GetTreeList(where).Tables[0]; //获取所有树

            GetTreeNode(mytab);
            Output = Output.Replace("check", "checked");
            WriteJsonToPage(Output);
        }
Beispiel #8
0
        /// <summary>
        /// 证书类型
        /// </summary>
        public void SearchDataBook()
        {
            var search = base.GetSearch();

            search.AddCondition("Type=3");//证书类型
            if (!CurrentMaster.IsMain)
            {
                if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建)
                {
                    search.AddCondition("CreaterId='" + CurrentMaster.Id + "'");
                }
            }
            var jsonResult = new BllSysGroup().SearchData(search);

            WriteJsonToPage(jsonResult);
        }
        /// <summary>
        /// 公告类别
        /// </summary>
        public void Adversise()
        {
            var search = base.GetSearch();

            search.AddCondition("Type=1");//公告类别
            if (!CurrentMaster.IsMain)
            {
                if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建)
                {
                    search.AddCondition("CreaterId='" + CurrentMaster.Id + "'");
                }
            }

            var jsonResult = new BllSysGroup().SearchData(search);

            LogInsert(OperationTypeEnum.访问, "公告类别", CurrentMaster.UserName + "访问页面正常.");

            WriteJsonToPage(jsonResult);
        }
        /// <summary>
        /// DisableUse
        /// </summary>
        public void DisableUse()
        {
            var msg = new ModJsonResult();

            string key    = Request["id"];
            int    result = new BllSysGroup().UpdateStatus(0, key);

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

            WriteJsonToPage(msg.ToString());
        }
Beispiel #11
0
        public void GetGroup(int Type)
        {
            List <ModSysGroup> jsonlist = new BllSysGroup().QueryToAll().Where(p => p.Type == Type).ToList();

            List <JsonFunTree> list = new List <JsonFunTree>();

            for (int i = 0; i < jsonlist.Count; i++)
            {
                JsonFunTree model = new JsonFunTree();
                model.id       = jsonlist[i].Id;
                model.parentId = "0";
                model.text     = jsonlist[i].Name;
                model.Depth    = 0;
                model.expanded = false;
                model.leaf     = true;
                model.leaf     = true;
                list.Add(model);
            }
            WriteJsonToPage(JsonHelper.ToJson(list));
        }
Beispiel #12
0
        /// <summary>
        /// 设备类型
        /// </summary>
        public void SearchDataQuestions()
        {
            var search = base.GetSearch();

            try
            {
                search.AddCondition("Type=0");//分类
                if (!CurrentMaster.IsMain)
                {
                    if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建)
                    {
                        search.AddCondition("CreaterId='" + CurrentMaster.Id + "'");
                    }
                }
                string CompanyId = CurrentMaster.Cid;//
                if (!string.IsNullOrEmpty(Request["Id"]))
                {
                    string key = Request["Id"].ToString().Trim();
                    if (key != "-1")//查询全部数据
                    {
                        CompanyId = key;
                        search.AddCondition("CompanyId='" + CompanyId + "'");
                    }
                }
                else
                {
                    search.AddCondition("CompanyId='" + CompanyId + "'");
                }
                LogInsert(OperationTypeEnum.访问, "设备类型模块", "访问页面成功.");
            }
            catch (Exception ex)
            {
                LogInsert(OperationTypeEnum.异常, "设备类型模块", "查询列表错误消息:" + ex.Message.ToString());
            }
            var jsonResult = new BllSysGroup().SearchData(search);

            WriteJsonToPage(jsonResult);
        }
Beispiel #13
0
        public void SaveData(ModSysGroup t)
        {
            BllSysGroup   bll  = new BllSysGroup();
            ModJsonResult json = new ModJsonResult();
            string        type = (Request["Type"] == null?"":Request["Type"].ToString());

            switch (type)
            {
            case "ProductType":
                t.Type = 2;
                break;

            case "BookType":
                t.Type = 3;
                break;

            case "QuestionsType":
                t.Type = 0;
                break;

            case "ClassManage":    //公告类型
                t.Type = 1;
                break;
            }
            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                var model = bll.LoadData(t.Id);
                model.Name     = t.Name;
                model.ParentId = "0";//如果引用字典库的类别,修改后变成自己类别
                //判断名称是否存在
                int  count = 0;
                bool flag  = bll.Exists("Sys_Group", " and CompanyId='" + t.CompanyId + "'  and Name='" + t.Name + "' and Type=" + t.Type + " and Id<>'" + t.Id + "' and Status!=" + (int)StatusEnum.除, out count);
                if (flag)
                {
                    json.success = false;
                    json.msg     = " 保存失败,该名称已经存在!";
                }
                else
                {
                    int result = bll.Update(model);
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = "修改失败,请稍后再操作!";
                    }
                }
            }
            else
            {
                string CompanyId = Request["CompanyId"].ToString().Trim();//
                if (string.IsNullOrEmpty(CompanyId))
                {
                    CompanyId = CurrentMaster.Cid;
                }
                //判断名称是否存在
                int  count = 0;
                bool flag  = bll.Exists("Sys_Group", " and CompanyId='" + CompanyId + "' and Name='" + t.Name + "' and Type=" + t.Type + " and Status!=" + (int)StatusEnum.除, out count);
                if (flag)
                {
                    json.success = false;
                    json.msg     = " 保存失败,该名称已经存在!";
                }
                else
                {
                    t.Id         = Guid.NewGuid().ToString();
                    t.Status     = (int)StatusEnum.正常;
                    t.CreaterId  = CurrentMaster.Id;
                    t.CreateTime = DateTime.Now;
                    t.CompanyId  = CompanyId;
                    t.OrderNum   = 0;
                    t.ParentId   = "0";

                    int result = bll.Insert(t);
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = " 保存失败,请稍后再操作!";
                    }
                    new BllSysMaster().ClearCache();
                }
            }


            WriteJsonToPage(json.ToString());
        }
        public void SaveData(ModSysGroup t)
        {
            BllSysGroup   bll  = new BllSysGroup();
            ModJsonResult json = new ModJsonResult();

            if (CurrentMaster != null)
            {
                if (CurrentMaster.Id == Request["LoginUserId"].ToString())
                {
                    if (!string.IsNullOrEmpty(Request["modify"])) //修改
                    {
                        var model = bll.LoadData(t.Id);
                        model.Name = t.Name;
                        //判断名称是否存在
                        int  count = 0;
                        bool flag  = bll.Exists("Sys_Group", " and Name='" + t.Name + "' and Type=" + t.Type + " and Id<>'" + t.Id + "' and Status!=" + (int)StatusEnum.除, out count);
                        if (flag)
                        {
                            json.success = false;
                            json.msg     = " 保存失败,该名称已经存在!";
                        }
                        else
                        {
                            model.OrderNum = t.OrderNum;
                            model.Code     = t.Code;
                            int result = bll.Update(model);
                            if (result <= 0)
                            {
                                json.success = false;
                                json.msg     = "修改失败,请稍后再操作!";
                            }
                        }
                    }
                    else
                    {
                        //判断名称是否存在
                        int  count = 0;
                        bool flag  = bll.Exists("Sys_Group", " and Name='" + t.Name + "' and Type=" + t.Type + " and Status!=" + (int)StatusEnum.除, out count);
                        if (flag)
                        {
                            json.success = false;
                            json.msg     = " 保存失败,该名称已经存在!";
                        }
                        else
                        {
                            t.Id         = Guid.NewGuid().ToString();
                            t.Status     = (int)StatusEnum.正常;
                            t.CreaterId  = CurrentMaster.Id;
                            t.CreateTime = DateTime.Now;
                            t.CompanyId  = CurrentMaster.Company.Id;
                            t.ParentId   = "0";

                            int result = bll.Insert(t);
                            if (result <= 0)
                            {
                                json.success = false;
                                json.msg     = " 保存失败,请稍后再操作!";
                            }

                            new BllSysMaster().ClearCache();
                        }
                    }
                    LogInsert(OperationTypeEnum.操作, "公告类别", CurrentMaster.UserName + "新增或修改类别成功.");
                }
                else
                {
                    json.success = false;
                    json.msg     = "用户信息已失效,请刷新或登陆.";
                }
            }
            else
            {
                json.success = false;
                json.msg     = "用户信息已过期,请重新登陆.";
            }
            WriteJsonToPage(json.ToString());
        }