コード例 #1
0
 public ActionResult Index(Page <LogModel> model)
 {
     if (model.CurrentPage <= 0)
     {
         model.CurrentPage = 1;
     }
     StringBuilder where = new StringBuilder("where 1=1");
     if (model.Item != null)
     {
         if (model.Item.UserID != null)
         {
             where.AppendFormat(" and UserID = {0} ", model.Item.UserID.Value);
         }
         if (!string.IsNullOrEmpty(model.Item.TableName))
         {
             where.AppendFormat(" and TableName like '%{0}%' ", model.Item.TableName.Trim());
         }
         if (!string.IsNullOrEmpty(model.Item.LogType))
         {
             where.AppendFormat(" and LogType like '%{0}%' ", model.Item.LogType.Trim());
         }
         if (!string.IsNullOrEmpty(model.Item.SQLInfo))
         {
             where.AppendFormat(" and SQLInfo like '%{0}%' ", model.Item.SQLInfo.Trim());
         }
         if (model.Item.DelFlag != null)
         {
             where.AppendFormat(" and DelFlag = {0} ", model.Item.DelFlag.Value);
         }
     }
     model = LogModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);
     LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(LogModel));
     return(View(model));
 }
コード例 #2
0
        public ActionResult Index(Page <CacheModel> model)
        {
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }

            StringBuilder where = new StringBuilder("select c.*,u.ChName as Ssssname  from  Cache c left join XUser u on c.CacheValue = u.Id  where  c.DelFlag=0  ");
            if (model.Item != null)
            {
                if (!string.IsNullOrEmpty(model.Item.CacheKey))
                {
                    where.AppendFormat(" and CacheKey like '%{0}%' ", model.Item.CacheKey.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.Ssssname))
                {
                    where.AppendFormat(" and  u.ChName like '%{0}%' ", model.Item.Ssssname.Trim());
                }
            }
            where.AppendFormat(" order by c.createtime desc ");
            var page = CacheModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(CacheModel));

            return(View(page));
        }
コード例 #3
0
        public ActionResult Index(Page <GlobalSqlModel> model)
        {
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }
            StringBuilder where = new StringBuilder("where 1=1 and ISNULL(DelFlag,0) = 0 ");
            if (model.Item != null)
            {
                if (!string.IsNullOrEmpty(model.Item.SQLKey))
                {
                    where.AppendFormat(" and SQLKey like '%{0}%' ", model.Item.SQLKey.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.SQLContent))
                {
                    where.AppendFormat(" and SQLContent like '%{0}%' ", model.Item.SQLContent.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.SqlConnection))
                {
                    where.AppendFormat(" and SqlConnection like '%{0}%' ", model.Item.SqlConnection.Trim());
                }
                if (model.Item.DelFlag != null)
                {
                    where.AppendFormat(" and DelFlag = {0} ", model.Item.DelFlag.Value);
                }
            }
            where.Append(" order by CreateTime desc ");
            var page = GlobalSqlModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GlobalSqlModel));
            return(View(page));
        }
コード例 #4
0
 public ActionResult  SystemLogEdit(SystemLogModel model)
 {
     if (string.IsNullOrEmpty(model.ID))
     {
         ViewData[EditFlag] = true;
         model.InsTime      = System.DateTime.Now;
         if (model.Insert() != null)
         {
             LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemLogModel));
             return(JsonSuccess(""));
         }
         return(JsonError(""));
     }
     else
     {
         ViewData[EditFlag] = true;
         model.InsTime      = System.DateTime.Now;
         if (model.Update() > 0)
         {
             LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemLogModel));
             return(JsonSuccess(""));
         }
         return(JsonError(""));
     }
 }
コード例 #5
0
        public ActionResult Delete(string id)
        {
            SystemParamModel.Delete(" where ParamID in (" + id + ")");
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemParamModel));

            return(JsonSuccess(DeleteSuccess));
        }
コード例 #6
0
        public ActionResult  SystemParamEdit(SystemParamModel model)
        {
            if (model.OrderNo != null && model.ParamName != null && model.ParamValue != null)
            {
                if (string.IsNullOrEmpty(model.ParamID))
                {
                    ViewData[EditFlag] = true;

                    if (model.Insert() != null)
                    {
                        LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemParamModel));
                        return(JsonSuccess("保存成功"));
                    }
                    return(JsonError("保存失败"));
                }
                else
                {
                    ViewData[EditFlag] = true;
                    if (model.Update() > 0)
                    {
                        LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemParamModel));
                        return(JsonSuccess("保存成功"));
                    }
                    return(JsonError("保存失败"));
                }
            }
            else
            {
                return(JsonError("请填写完整信息"));
            }
        }
コード例 #7
0
        public ActionResult Delete(string id)
        {
            ConfigModel.Delete(" where ID in ('@0')", id);
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(ConfigModel));

            return(JsonSuccess(DeleteSuccess));
        }
コード例 #8
0
        public ActionResult DeleteForWhere(string Where)
        {
            ConfigModel.Delete(Where);
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(ConfigModel));

            return(JsonSuccess(DeleteSuccess));
        }
コード例 #9
0
        public ActionResult  FileIndex(Page <FileModel> model)
        {
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }
            StringBuilder where = new StringBuilder("where 1=1 ");
            if (model.Item != null)
            {
                if (model.Item.ID != null)
                {
                    where.AppendFormat(" and ID = {0} ", model.Item.ID);
                }
                if (!string.IsNullOrEmpty(model.Item.PathName))
                {
                    where.AppendFormat(" and PathName like '%{0}%' ", model.Item.PathName.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.ShowName))
                {
                    where.AppendFormat(" and ShowName like '%{0}%' ", model.Item.ShowName.Trim());
                }
            }
            var page = FileModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(FileModel));
            return(View(page));
        }
コード例 #10
0
        public ActionResult Edit(string id)
        {
            ViewData[EditFlag] = true;
            RoleModel model = RoleModel.SingleOrDefault(id);

            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Role");
            return(View(model));
        }
コード例 #11
0
 public ActionResult Add(GroupModel model)
 {
     ViewData[EditFlag] = true;
     if (model.Insert() != null)
     {
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GroupModel));
         return(JsonSuccess(SaveSuccess, "/Admin/Group/Index?Item.ProductId=" + model.ProductId));
     }
     return(Error());
 }
コード例 #12
0
 public ActionResult Edit(GlobalSqlModel model)
 {
     ViewData[EditFlag] = true;
     if (model.Update() > 0)
     {
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GlobalSqlModel));
         return(JsonSuccess(""));
     }
     return(JsonError(""));
 }
コード例 #13
0
 public ActionResult DemoAdd(DemoModel model)
 {
     ViewData[EditFlag] = true;
     if (model.Insert() != null)
     {
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(DemoModel));
         return(JsonSuccessJump());
     }
     return(JsonErrorJump());
 }
コード例 #14
0
 public ActionResult Add(ProductModel model)
 {
     ViewData[EditFlag] = true;
     if (model.Insert() != null)
     {
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(ProductModel));
         return(JsonSuccess(""));
     }
     return(Error());
 }
コード例 #15
0
        public ActionResult Delete(NodeModel model)
        {
            if (NodeDAL.DeleteSubNodes(model))
            {
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Node");
                return(JsonSuccess(DeleteSuccess, "/Admin/Node/Index"));
            }

            return(Error(DeleteError));
        }
コード例 #16
0
 public ActionResult Edit(LogModel model)
 {
     ViewData[EditFlag] = true;
     if (model.Update() > 0)
     {
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(LogModel));
         return(Success());
     }
     return(Error());
 }
コード例 #17
0
        public ActionResult Delete(string id)
        {
            string[] tmp = id.Split(',');
            foreach (string item in tmp)
            {
                LogModel.Delete("where ID=@0", item);
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(LogModel));
            }

            return(Success());
        }
コード例 #18
0
        public ActionResult Delete(string id)
        {
            string[] tmp = id.Split(',');
            foreach (string item in tmp)
            {
                GlobalSqlModel.Update("set DelFlag = 1 where ID=@0", item);
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GlobalSqlModel));
            }

            return(JsonSuccess(""));
        }
コード例 #19
0
 public ActionResult  ConfigIndex(Page <ConfigModel> model)
 {
     try
     {
         if (model.CurrentPage <= 0)
         {
             model.CurrentPage = 1;
         }
         StringBuilder where = new StringBuilder("where 1=1 ");
         if (model.Item != null)
         {
             if (model.Item.ID != null)
             {
                 where.AppendFormat(" and ID = {0} ", model.Item.ID);
             }
             if (!string.IsNullOrEmpty(model.Item.ConfigKey))
             {
                 where.AppendFormat(" and ConfigKey like '%{0}%' ", model.Item.ConfigKey.Trim());
             }
             if (!string.IsNullOrEmpty(model.Item.ConfigData))
             {
                 where.AppendFormat(" and ConfigData like '%{0}%' ", model.Item.ConfigData.Trim());
             }
             if (!string.IsNullOrEmpty(model.Item.ConfigType))
             {
                 where.AppendFormat(" and ConfigType like '%{0}%' ", model.Item.ConfigType.Trim());
             }
             if (model.Item.DelFlag != null)
             {
                 where.AppendFormat(" and DelFlag = {0} ", model.Item.DelFlag);
             }
         }
         where.Append(" order by CreateTime desc, ConfigKey asc");
         var page = ConfigModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);
         page.Item = model.Item;
         LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(ConfigModel));
         return(View(page));
     }
     catch (System.Exception e)
     {
         //===============================================================================
         FileStream fss = new FileStream("E:\\Web\\CRM\\gb.txt", FileMode.Create);                  //
                                                                                                    //获得字节数组                                                                  //
         byte[] datas = System.Text.Encoding.Default.GetBytes(e.Message);
         //开始写入
         fss.Write(datas, 0, datas.Length);
         //清空缓冲区、关闭流
         fss.Flush();
         fss.Close();
         //    //================================================================================
         throw;
     }
 }
コード例 #20
0
        public ActionResult  SystemLogIndex(Page <SystemLogModel> model, string orderby = "")
        {
            ViewBag.orderby = orderby;
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }
            StringBuilder where = new StringBuilder("where 1=1 ");
            if (model.Item != null)
            {
                if (model.Item.ID != null)
                {
                    where.AppendFormat(" and ID = {0} ", model.Item.ID);
                }
                if (model.Item.UserID != null)
                {
                    where.AppendFormat(" and UserID = {0} ", model.Item.UserID);
                }
                if (model.Item.Type != null)
                {
                    where.AppendFormat(" and Type = {0} ", model.Item.Type);
                }
                if (!string.IsNullOrEmpty(model.Item.LogInfo))
                {
                    where.AppendFormat(" and LogInfo like '%{0}%' ", model.Item.LogInfo.Trim());
                }
                if (model.Item.InsTime != null)
                {
                    where.AppendFormat(" and CONVERT(varchar(100),InsTime,23) = '{0}' ", model.Item.InsTime.Value.ToString("yyyy-MM-dd"));
                }
                if (!string.IsNullOrEmpty(model.Item.IP))
                {
                    where.AppendFormat(" and IP like '%{0}%' ", model.Item.IP.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.Parameters))
                {
                    where.AppendFormat(" and Parameters like '%{0}%' ", model.Item.Parameters.Trim());
                }
            }
            if (string.IsNullOrEmpty(orderby))
            {
                where.Append(" order  by ID desc");
            }
            else
            {
                where.Append(" order  by  " + orderby + "");
            }
            var page = SystemLogModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(SystemLogModel));
            return(View(page));
        }
コード例 #21
0
        public ActionResult DemoIndex(Page <DemoModel> model)
        {
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }
            StringBuilder where = new StringBuilder("where 1=1");
            if (model.Item != null)
            {
                if (!string.IsNullOrEmpty(model.Item.Name))
                {
                    where.AppendFormat(" and Name like '%{0}%' ", model.Item.Name.Trim());
                }
                if (model.Item.DemoRedioButton != null)
                {
                    where.AppendFormat(" and DemoRedioButton = {0} ", model.Item.DemoRedioButton.Value);
                }
                if (!string.IsNullOrEmpty(model.Item.DemoCheckBox))
                {
                    where.AppendFormat(" and DemoCheckBox like '%{0}%' ", model.Item.DemoCheckBox.Trim());
                }
                if (model.Item.DemoSelected != null)
                {
                    where.AppendFormat(" and DemoSelected = {0} ", model.Item.DemoSelected.Value);
                }
                if (!string.IsNullOrEmpty(model.Item.DemoTextArea))
                {
                    where.AppendFormat(" and DemoTextArea like '%{0}%' ", model.Item.DemoTextArea.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.DemoText))
                {
                    where.AppendFormat(" and DemoText like '%{0}%' ", model.Item.DemoText.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.Phone))
                {
                    where.AppendFormat(" and Phone like '%{0}%' ", model.Item.Phone.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.IDCard))
                {
                    where.AppendFormat(" and IDCard like '%{0}%' ", model.Item.IDCard.Trim());
                }
                if (model.Item.DelFlag != null)
                {
                    where.AppendFormat(" and DelFlag = {0} ", model.Item.DelFlag.Value);
                }
            }
            var page = DemoModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(DemoModel));
            return(View(page));
        }
コード例 #22
0
        public ActionResult Add(string nodeIds, string roleId)
        {
            List <string> sqlParams = new List <string>();

            if (accessDal.Add(Request["nodeIds"].Split(','), roleId, ref sqlParams))
            {
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Access", sqlParams.ToArray());

                return(JsonSuccess(SaveSuccess, ""));
            }

            return(Error(SaveError));
        }
コード例 #23
0
        public ActionResult Edit(CacheModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Update() > 0)
                {
                    LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Cache");
                    return(Success());
                }
            }

            TempData[Info] = SaveError;
            return(Error());
        }
コード例 #24
0
        public ActionResult Add(GlobalSqlModel model)
        {
            GlobalSqlModel gmodel = GlobalSqlModel.FirstOrDefault(" where SqlKey= @0", model.SQLKey);

            if (gmodel != null)
            {
                return(JsonError("SqlKey已存在!"));
            }
            ViewData[EditFlag] = true;
            if (model.Insert() != null)
            {
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GlobalSqlModel));
                return(JsonSuccess(""));
            }
            return(JsonError(""));
        }
コード例 #25
0
        public ActionResult Delete(string id)
        {
            var first = new RoleModel {
                ID = ""
            };

            string[] tmp = id.Split(',');
            foreach (string item in tmp)
            {
                if (string.IsNullOrEmpty(first.ID))
                {
                    first = RoleModel.FirstOrDefault("where Id= @0", item);
                }
                RoleModel.Delete("where ID=@0", item);
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(RoleModel));
            }
            return(JsonSuccess(DeleteSuccess, "/Admin/Group/Index?Item.ProductId=" + first.ProductId));
        }
コード例 #26
0
        public ActionResult  UserLoginLogIndex(Page <UserLoginLogModel> model)
        {
            if (model.CurrentPage <= 0)
            {
                model.CurrentPage = 1;
            }
            StringBuilder where = new StringBuilder("where 1=1 ");
            if (model.Item != null)
            {
                if (model.Item.ID != null)
                {
                    where.AppendFormat(" and ID = {0} ", model.Item.ID);
                }
                if (model.Item.UserID != null)
                {
                    where.AppendFormat(" and UserID = {0} ", model.Item.UserID);
                }
                if (model.Item.LoginTime != null)
                {
                    where.AppendFormat(" and LoginTime = {0} ", model.Item.LoginTime);
                }
                if (!string.IsNullOrEmpty(model.Item.LoginIp))
                {
                    where.AppendFormat(" and LoginIp like '%{0}%' ", model.Item.LoginIp.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.DeviceID))
                {
                    where.AppendFormat(" and DeviceID like '%{0}%' ", model.Item.DeviceID.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.DeviceOS))
                {
                    where.AppendFormat(" and DeviceOS like '%{0}%' ", model.Item.DeviceOS.Trim());
                }
                if (!string.IsNullOrEmpty(model.Item.AppVersion))
                {
                    where.AppendFormat(" and AppVersion like '%{0}%' ", model.Item.AppVersion.Trim());
                }
            }
            var page = UserLoginLogModel.Page(model.CurrentPage, MTConfig.ItemsPerPage, where.ToString(), model.Item);

            page.Item = model.Item;
            LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(UserLoginLogModel));
            return(View(page));
        }
コード例 #27
0
        public ActionResult Add(NodeModel model)
        {
            model.Pid = model.ID;

            if (ModelState.IsValid)
            {
                if (model.Insert() != null)
                {
                    if (model.NodeLevel == 1)
                    {
                        model.Area = model.ID;
                        model.Update();
                    }
                    LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Node");
                    return(JsonSuccess(SaveSuccess, "/Admin/Node/Index"));
                }
            }

            return(Error(SaveError));
        }
コード例 #28
0
        public ActionResult UserInfoEdit(UserInfoModel model)
        {
            if (string.IsNullOrEmpty(model.UserID))
            {
                ViewData[EditFlag] = true;

                if (model.Insert() != null)
                {
                    return(JsonSuccess(""));
                }
                return(JsonError(""));
            }
            ViewData[EditFlag] = true;
            if (model.Update() > 0)
            {
                LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(UserInfoModel));
                return(JsonSuccess(""));
            }
            return(JsonError(""));
        }
コード例 #29
0
        public ActionResult Add(RoleModel model)
        {
            model.ID         = "0";
            model.DelFlag    = 0;
            model.CreateMan  = Common.MTConfig.CurrentUserID.ToInt();
            model.CreateTime = DateTime.Now;
            model.ModifyMan  = Common.MTConfig.CurrentUserID.ToInt();
            model.ModifyTime = DateTime.Now;

            if (ModelState.IsValid)
            {
                if (model.Insert() != null)
                {
                    LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Role");
                    return(JsonSuccess(SaveSuccess, "/Admin/Role/Index"));
                }
            }

            return(Error(SaveError));
        }
コード例 #30
0
        public ActionResult Edit(RoleModel model)
        {
            if (ModelState.IsValid)
            {
                var item = RoleModel.Single(model.ID);

                model.DelFlag    = item.DelFlag;
                model.CreateMan  = item.CreateMan;
                model.CreateTime = model.CreateTime;
                model.ModifyTime = DateTime.Now;
                model.ModifyMan  = MTConfig.CurrentUserID.ToInt();


                if (model.Update() > 0)
                {
                    LogDAL.AppendSQLLog(MTConfig.CurrentUserID, "Role");
                    return(JsonSuccess(SaveSuccess, "/Admin/Role/Index"));
                }
            }

            return(Error(SaveError));
        }