//[SupportFilter]
        public ActionResult Delete(FormCollection collection)
        {
            string returnValue = string.Empty;

            List <int> lists = collection["query"].GetString().ToIntList();

            int[] deleteId = lists.ToArray();

            if (deleteId != null && deleteId.Length > 0)
            {
                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "D", FUNC_CODE = "010701", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strDelete
                };

                if (deleteId.Length == 1)
                {
                    int roleId = deleteId[0];
                    var role   = SMROLETBService.LoadEntities(r => r.ROLE_ID == roleId).FirstOrDefault();

                    if (SMROLETBService.Delete(role))
                    {
                        OperLog.REMARK = "角色Id:" + deleteId[0] + Suggestion.DeleteSucceed;
                        SMLOGService.AddEntity(OperLog);//写入日志

                        return(Json("OK"));
                    }
                    else
                    {
                        OperLog.REMARK = "角色Id:" + deleteId[0] + Suggestion.DeleteFail;
                    }
                    SMLOGService.AddEntity(OperLog);//写入日志
                }
            }
            return(Json(returnValue));
        }
Пример #2
0
        //[SupportFilter]
        public ActionResult Delete(IFormCollection collection)
        {
            string returnValue = string.Empty;

            int[] deleteId = collection["query"].GetString().ToIntList().ToArray <int>();
            if (deleteId != null && deleteId.Length > 0)
            {
                SMLOG _SMLOG = new SMLOG {
                    OPERATION_TYPE = "D", FUNC_CODE = "010000", USER_ID = Convert.ToInt32(GetCurrentAccount().USER_ID), CLASSNAME = this.GetType().ToString() + ": Delete"
                };
                int        userId    = deleteId[0];
                var        userInfo  = SMUSERTBService.LoadEntities(x => x.USER_ID == userId).FirstOrDefault();
                List <int> roleIds   = userInfo.SMROLETB.Select(x => x.ROLE_ID).ToList();
                var        userRoles = SMROLETBService.LoadEntities(x => roleIds.Contains(x.ROLE_ID)).ToList();
                foreach (var v in userRoles)
                {
                    userInfo.SMROLETB.Remove(v);
                }

                if (SMUSERTBService.DeleteEntity(userInfo))
                {
                    _SMLOG.REMARK = "用户:" + GetCurrentAccount().USER_NAME + Suggestion.DeleteSucceed;
                    SMLOGService.AddEntity(_SMLOG);//删除成功,写入日志
                    return(Json("OK"));
                }
                else
                {
                    _SMLOG.REMARK = "用户:" + GetCurrentAccount().USER_NAME + Suggestion.DeleteFail;
                    SMLOGService.AddEntity(_SMLOG);//删除失败,写入日志
                }
                returnValue = _SMLOG.REMARK;
            }

            return(Json(returnValue));
        }
Пример #3
0
        //[SupportFilter]
        public ActionResult Edit(int id, SMUSERTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                entity.UPDATE_USER = GetCurrentAccount().USER_ID;
                string returnValue = string.Empty;
                SMLOG  _SMLOG      = new SMLOG {
                    OPERATION_TYPE = "U", FUNC_CODE = "010702", USER_ID = Convert.ToInt32(GetCurrentAccount().USER_ID), CLASSNAME = this.GetType().ToString() + ": Edit"
                };
                List <int> oldRoleIds = entity.SysRoleIdOld.GetIdSort();
                List <int> roleIds    = entity.SysRoleId.GetIdSort();

                if (SMUSERTBService.UpdateUserInfo(oldRoleIds, entity, roleIds))
                {
                    _SMLOG.REMARK = "用户:" + entity.USER_NAME + Suggestion.UpdateSucceed;
                    SMLOGService.AddEntity(_SMLOG);         //写入日志
                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    _SMLOG.REMARK = "用户:" + entity.USER_NAME + Suggestion.UpdateFail + "原因:" + returnValue;
                    SMLOGService.AddEntity(_SMLOG);                    //写入日志
                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        public ActionResult Create(SMFUNCTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string returnValue = string.Empty;
                SMLOG  OperLog     = new SMLOG {
                    OPERATION_TYPE = "N", FUNC_CODE = "900011", USER_ID = Convert.ToInt32(GetCurrentAccount().USER_ID), CLASSNAME = ClassName + ": Create"
                };
                var result = SMFUNCTBService.AddEntity(entity);

                if (result != null)
                {
                    OperLog.REMARK = "操作的信息:(ID:" + entity.FUNC_ID + "名称:" + entity.FUNC_NAME + ")" + Suggestion.InsertSucceed;
                    SMLOGService.AddEntity(OperLog);//写入日志

                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    OperLog.REMARK = "操作的信息:" + entity.FUNC_ID + Suggestion.InsertFail + returnValue;
                    SMLOGService.AddEntity(OperLog);                   //写入日志

                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        public ActionResult Create(SMFIELD entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string currentPerson = GetCurrentAccount().UID;
                entity.CREATETIME   = DateTime.Now;
                entity.CREATEPERSON = currentPerson;

                string returnValue = string.Empty;

                SMLOG _SMLOG = new SMLOG {
                    OPERATION_TYPE = "N", FUNC_CODE = "010021", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strCreate
                };

                if (SMFIELDService.AddEntity(entity) != null)
                {
                    _SMLOG.REMARK = "数据字典:" + entity.MYTEXTS + Suggestion.InsertSucceed;
                    SMLOGService.AddEntity(_SMLOG);//写入日志

                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    _SMLOG.REMARK = "数据字典的信息:" + returnValue + Suggestion.InsertFail;
                    SMLOGService.AddEntity(_SMLOG);                    //写入日志

                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        public ActionResult Edit(SMFIELD entity)
        {
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                string currentPerson = GetCurrentAccount().UID;
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = currentPerson;

                string returnValue = string.Empty;
                SMLOG  _SMLOG      = new SMLOG {
                    OPERATION_TYPE = "U", FUNC_CODE = "010022", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strEdit
                };

                if (SMFIELDService.EditEntity(entity))
                {
                    _SMLOG.REMARK = "数据字典:" + entity.MYTEXTS + Suggestion.UpdateSucceed;
                    SMLOGService.AddEntity(_SMLOG);         //写入日志

                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    _SMLOG.REMARK = "数据字典:" + entity.MYTEXTS + Suggestion.UpdateFail + returnValue;

                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        //[SupportFilter]
        public ActionResult Edit(int id, SMROLETB entity)
        {
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                entity.UPDATE_USER = UserId;
                string returnValue = string.Empty;

                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "U", FUNC_CODE = "010701", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strEdit
                };

                if (SMROLETBService.Edit(entity))
                {
                    OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.UpdateSucceed;
                    SMLOGService.AddEntity(OperLog);        //写入日志

                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.UpdateFail + returnValue;

                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        //[SupportFilter]
        public ActionResult Save(FormCollection collection)
        {
            string returnValue = string.Empty;

            string[] ids    = collection["ids"].GetString().Split(',');
            int      id     = collection["id"].GetInt();
            int      userId = UserId;

            SMLOG OperLog = new SMLOG {
                OPERATION_TYPE = "U", FUNC_CODE = "900009", USER_ID = userId, CLASSNAME = this.GetType().ToString() + ": Save"
            };

            try
            {
                if (SMROLETBService.SaveCollection(ids, id))
                {
                    OperLog.REMARK = "信息的Id为" + string.Join(",", ids) + Suggestion.InsertSucceed;
                    SMLOGService.AddEntity(OperLog);

                    return(Json("OK"));
                }
                else
                {
                    OperLog.REMARK = "信息的Id为" + string.Join(",", ids) + Suggestion.InsertFail;
                    SMLOGService.AddEntity(OperLog);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(Json(returnValue));
        }
        //[SupportFilter]
        public ActionResult Create(SMROLETB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                entity.CREATION_TIME = DateTime.Now;
                entity.CREATION_USER = UserId;

                string returnValue = string.Empty;
                SMLOG  OperLog     = new SMLOG {
                    OPERATION_TYPE = "N", FUNC_CODE = "010701", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strCreate
                };
                var result = SMROLETBService.Create(entity);

                if (result != null)
                {
                    OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.InsertSucceed;
                    SMLOGService.AddEntity(OperLog);//写入日志

                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.InsertFail;
                    SMLOGService.AddEntity(OperLog);                   //写入日志

                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        public ActionResult Edit(string id, SMFUNCTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string returnValue = string.Empty;
                SMLOG  OperLog     = new SMLOG {
                    OPERATION_TYPE = "U", FUNC_CODE = "900012", USER_ID = Convert.ToInt32(GetCurrentAccount().USER_ID), CLASSNAME = ClassName + ": Edit"
                };

                if (SMFUNCTBService.EditEntity(entity))
                {
                    OperLog.REMARK = "操作信息的Id:" + id + Suggestion.UpdateSucceed;
                    SMLOGService.AddEntity(OperLog);        //写入日志

                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    OperLog.REMARK = "操作信息的Id:" + id + Suggestion.UpdateFail;
                    SMLOGService.AddEntity(OperLog);                   //写入日志

                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        //[SupportFilter]
        public ActionResult Create(SMMENUTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                entity.CREATETIME   = DateTime.Now;
                entity.CREATEPERSON = GetCurrentAccount().USER_NAME;

                string returnValue = string.Empty;

                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "N", FUNC_CODE = "900001", USER_ID = UserId, CLASSNAME = ClassName + strCreate
                };
                var result = SMMENUTBService.Create(entity);

                if (result != null)
                {
                    OperLog.REMARK = "菜单:" + entity.NAME + Suggestion.InsertSucceed;

                    SMLOGService.AddEntity(OperLog);//写入日志
                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    OperLog.REMARK = "菜单:" + entity.NAME + Suggestion.InsertFail;
                    SMLOGService.AddEntity(OperLog);                   //写入日志

                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
        //[SupportFilter]
        public ActionResult Edit(string id, SMMENUTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = GetCurrentAccount().USER_NAME;

                string returnValue = string.Empty;

                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "U", FUNC_CODE = "900002", USER_ID = UserId, CLASSNAME = ClassName + strEdit
                };

                if (SMMENUTBService.Edit(entity))
                {
                    OperLog.REMARK = "菜单:" + entity.NAME + Suggestion.UpdateSucceed;
                    SMLOGService.AddEntity(OperLog);        //写入日志

                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    OperLog.REMARK = "菜单:" + entity.NAME + Suggestion.UpdateFail;
                    SMLOGService.AddEntity(OperLog);                   //写入日志

                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
Пример #13
0
        /// <summary>
        /// 查看详细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        //[SupportFilter]
        public ActionResult Details(int id)
        {
            SMLOG logInfo = SMLOGService.LoadEntities(x => x.LOG_ID == id).FirstOrDefault();

            //return Json(logInfo, JsonRequestBehavior.AllowGet);
            return(Json(logInfo));
        }
        //[SupportFilter]
        public ActionResult Delete(FormCollection collection)
        {
            string     returnValue = string.Empty;
            List <int> lists       = collection["query"].GetString().ToIntList();

            int[] deleteIds = lists.ToArray();

            if (deleteIds != null && deleteIds.Length > 0)
            {
                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "D", FUNC_CODE = "900003", USER_ID = UserId, CLASSNAME = ClassName + strDelete
                };

                if (deleteIds.Length == 1)
                {
                    int menuId = deleteIds[0];
                    var entity = SMMENUTBService.LoadEntities(m => m.ID == menuId).FirstOrDefault();
                    if (SMMENUTBService.Delete(entity))
                    {
                        OperLog.REMARK = "菜单Id:" + deleteIds[0] + Suggestion.DeleteSucceed;
                        SMLOGService.AddEntity(OperLog);//写入日志

                        return(Json("OK"));
                    }
                    else
                    {
                        OperLog.REMARK = "菜单Id:" + deleteIds[0] + Suggestion.DeleteSucceed;
                    }
                    SMLOGService.AddEntity(OperLog);//写入日志
                }

                #region 批量删除

                //if (_menuService.DeleteCollection(ref validationErrors, deleteIds))
                //{
                //    OperLog.REMARK = "菜单信息的Id:" + string.Join(",", deleteIds) + Suggestion.DeleteSucceed;
                //    SMLOGService.AddEntity(OperLog);//写入日志

                //    return Json("OK");
                //}
                //else
                //{
                //    if (validationErrors != null && validationErrors.Count > 0)
                //    {
                //        validationErrors.All(a =>
                //        {
                //            returnValue += a.ErrorMessage;
                //            return true;
                //        });
                //    }
                //    OperLog.REMARK = "菜单信息的Id:" + string.Join(",", deleteIds) + Suggestion.DeleteFail + " " + returnValue;
                //    SMLOGService.AddEntity(OperLog);//写入日志
                //}
                #endregion
            }
            return(Json(returnValue));
        }
        public ActionResult Delete(IFormCollection collection)
        {
            string returnValue = string.Empty;

            int[] deleteId = collection["query"].GetString().ToIntList().ToArray <int>();
            if (deleteId != null && deleteId.Length > 0)
            {
                SMLOG OperLog = new SMLOG {
                    OPERATION_TYPE = "D", FUNC_CODE = "900013", USER_ID = Convert.ToInt32(GetCurrentAccount().USER_ID), CLASSNAME = ClassName + ": Delete"
                };

                if (deleteId.Length == 1)
                {
                    int funcId = deleteId[0];
                    var entity = SMFUNCTBService.LoadEntities(f => f.FUNC_ID == funcId).FirstOrDefault();
                    if (SMFUNCTBService.DeleteEntity(entity))
                    {
                        OperLog.REMARK = "信息的Id为" + deleteId[0] + Suggestion.DeleteSucceed;

                        return(Json("OK"));
                    }
                    else
                    {
                        OperLog.REMARK = "信息的Id为" + deleteId[0] + Suggestion.DeleteSucceed;
                    }
                    SMLOGService.AddEntity(OperLog);//写入日志
                }

                #region 批量删除

                //if (OperLog.DeleteCollection(ref validationErrors, deleteId))
                //{
                //    OperLog.REMARK = "操作信息的Id:" + string.Join(",", deleteId) + Suggestion.DeleteSucceed;
                //    LogClassService.WriteServiceLog(OperLog);//写入日志

                //    return Json("OK");
                //}
                //else
                //{
                //    if (validationErrors != null && validationErrors.Count > 0)
                //    {
                //        validationErrors.All(a =>
                //        {
                //            returnValue += a.ErrorMessage;
                //            return true;
                //        });
                //    }
                //    OperLog.REMARK = "操作信息的Id:" + string.Join(",", deleteId) + Suggestion.DeleteFail + " " + returnValue;
                //    LogClassService.WriteServiceLog(OperLog);//写入日志
                //}

                #endregion
            }
            return(Json(returnValue));
        }
        public ActionResult Delete(FormCollection collection)
        {
            string returnValue = string.Empty;

            string[] deleteId = collection["query"].GetString().Split(',');
            if (deleteId != null && deleteId.Length > 0)
            {
                SMLOG _SMLOG = new SMLOG {
                    OPERATION_TYPE = "D", FUNC_CODE = "010023", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strDelete
                };

                if (deleteId.Length == 1)
                {
                    int delId  = int.Parse(deleteId[0]);
                    var entity = SMFIELDService.LoadEntities(x => x.ID == delId).FirstOrDefault();
                    if (SMFIELDService.DeleteEntity(entity))
                    {
                        _SMLOG.REMARK = "数据字典信息的Id为" + deleteId[0] + Suggestion.DeleteSucceed;
                        SMLOGService.AddEntity(_SMLOG);//写入日志

                        return(Json("OK"));
                    }
                    else
                    {
                        _SMLOG.REMARK = "数据字典信息的Id为" + deleteId[0] + Suggestion.DeleteSucceed;
                    }
                    SMLOGService.AddEntity(_SMLOG);//写入日志
                }

                #region 批量删除

                //if (SMFIELDService.DeleteCollection(ref validationErrors, deleteId))
                //{
                //    LogClassModels.WriteServiceLog(Suggestion.DeleteSucceed + ",信息的Id为" + string.Join(",", deleteId), "消息"
                //        );//删除成功,写入日志
                //    return Json("OK");
                //}
                //else
                //{
                //    if (validationErrors != null && validationErrors.Count > 0)
                //    {
                //        validationErrors.All(a =>
                //        {
                //            returnValue += a.ErrorMessage;
                //            return true;
                //        });
                //    }
                //    LogClassModels.WriteServiceLog(Suggestion.DeleteFail + ",信息的Id为" + string.Join(",", deleteId) + "," + returnValue, "消息"
                //        );//删除失败,写入日志
                //}
                #endregion
            }
            return(Json(returnValue));
        }
Пример #17
0
        //[SupportFilter]
        public ActionResult Create(SMUSERTB entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                entity.CREATION_TIME = DateTime.Now;
                entity.CREATION_USER = GetCurrentAccount().USER_ID;
                entity.U_PASSWORD    = Encrypt.DecodeText(entity.U_PASSWORD);//加密

                string returnValue = string.Empty;

                if (SMUSERTBService.LoadEntities(x => x.U_ID == entity.U_ID).FirstOrDefault() != null)
                {
                    returnValue = "登录名已存在!";
                    return(Json(Suggestion.InsertFail + returnValue));
                }

                SMLOG _SMLOG = new SMLOG {
                    OPERATION_TYPE = "N", FUNC_CODE = "010702", USER_ID = GetCurrentAccount().USER_ID, CLASSNAME = this.GetType().ToString() + ": Create"
                };
                List <int> roleIds = entity.SysRoleId.GetIdSort();
                entity.SMROLETB = SMROLETBService.LoadEntities(x => roleIds.Contains(x.ROLE_ID)).ToList();
                var result = SMUSERTBService.AddEntity(entity);

                if (result != null)
                {
                    _SMLOG.REMARK = "用户:" + entity.USER_NAME + Suggestion.InsertSucceed;
                    SMLOGService.AddEntity(_SMLOG);//写入日志
                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    _SMLOG.REMARK = "用户:" + entity.USER_NAME + Suggestion.InsertFail + "原因:" + returnValue;
                    SMLOGService.AddEntity(_SMLOG);//写入日志
                    //提示插入失败
                    return(Json(Suggestion.InsertFail + returnValue));
                }
            }
            return(Json(Suggestion.InsertFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }