public IActionResult Delete(long id)
 {
     try
     {
         string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.系统管理.系统日志.除);
         if (!IsPermission(funcId))
         {
             return(Error("您没有操作权限,请联系系统管理员!"));
         }
         long operationId = 0;
         var  entity      = LoginRecordService.GetLoginRecord(id);
         if (entity == null)
         {
             return(Error("id not exists!"));
         }
         TableOperationManager.Delete(entity, out operationId);
         bool result = LoginRecordService.DeleteLoginRecord(SystemID, CompanyID, id);
         TableOperationManager.SetState(operationId, result);
         if (result)
         {
             return(Success("成功!"));
         }
         else
         {
             return(Error("失败!"));
         }
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Example #2
0
 public override IActionResult Index()
 {
     try
     {
         string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.系统管理.系统设置.查看);
         if (!IsPermission(funcId))
         {
             return(ToPermission(funcId));
         }
         long operationId = 0;
         var  entity      = ConfigService.GetConfigPro(SystemID, CompanyID);
         TableOperationManager.Select(entity, out operationId);
         TableOperationManager.SetState(operationId, true);
         return(View(entity));
     }
     catch (Exception ex)
     {
         return(ToError(ex.Message));
     }
 }
        public JsonResult Update(string companyId)
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.公司管理.资料管理.编辑);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }
                string companyName = GetFormValue("fCompanyName");
                string nickName    = GetFormValue("fNickName");
                string tel         = GetFormValue("fTel");
                string fax         = GetFormValue("fFax");
                string phone       = GetFormValue("fPhone");
                string email       = GetFormValue("fEmail");
                string address     = GetFormValue("fAddress");
                string description = GetFormValue("fDescription");

                var entity = CompanyService.GetCompanyPro(SystemID, companyId);
                if (entity == null)
                {
                    return(Error("公司编号不存在!"));
                }
                string strNewEntity = GetNewEntityJson(entity, companyName, nickName, tel, fax, phone, email, address, description);

                long operationId = 0;
                TableOperationManager.Update(entity, strNewEntity, out operationId);
                var result = CompanyService.UpdateCompanyPro(SystemID, companyId, companyName, nickName, tel, fax, phone, email, address, description);
                TableOperationManager.SetState(operationId, result);
                if (result)
                {
                    return(Success("ok"));
                }
                else
                {
                    return(Error("fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
Example #4
0
        public JsonResult Update()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.系统管理.系统设置.编辑);
                if (!IsPermission(funcId))
                {
                    return(Error("您没有操作权限,请联系系统管理员!"));
                }
                string title                   = GetFormValue("title");
                string keyword                 = GetFormValue("keyword");
                string description             = GetFormValue("description");
                string homeUrl                 = GetFormValue("homeUrl");
                string styleSrc                = GetFormValue("styleSrc");
                string uploadRoot              = GetFormValue("uploadRoot");
                string copyright               = GetFormValue("copyright");
                string icpNumber               = GetFormValue("icpNumber");
                string statisticsCode          = GetFormValue("statisticsCode");
                string loginIpAddressWhiteList = GetFormValue("loginIpAddressWhiteList");
                string maxLoginFail            = GetFormValue("maxLoginFail");
                string isLoginIpAddress        = GetFormValue("isLoginIpAddress");
                string emailSendPattern        = GetFormValue("emailSendPattern");
                string emailHost               = GetFormValue("emailHost");
                string emailPort               = GetFormValue("emailPort");
                string emailName               = GetFormValue("emailName");
                string emailPassword           = GetFormValue("emailPassword");
                string emailAddress            = GetFormValue("emailAddress");
                bool   isLogin                 = isLoginIpAddress.Split(",")[0].ToBool();

                Sys_Config entity = new Sys_Config();
                entity.SystemID                = SystemID;
                entity.CompanyID               = CompanyID;
                entity.Title                   = title;
                entity.Keyword                 = keyword;
                entity.Description             = description;
                entity.HomeUrl                 = homeUrl;
                entity.StyleSrc                = styleSrc;
                entity.UploadRoot              = uploadRoot;
                entity.Copyright               = copyright;
                entity.IcpNumber               = icpNumber;
                entity.StatisticsCode          = statisticsCode;
                entity.LoginIpAddressWhiteList = loginIpAddressWhiteList;
                entity.MaxLoginFail            = maxLoginFail.ToInt();
                entity.IsLoginIpAddress        = isLogin;
                entity.EmailSendPattern        = emailSendPattern;
                entity.EmailHost               = emailHost;
                entity.EmailPort               = emailPort.ToInt();
                entity.EmailName               = emailName;
                entity.EmailPassword           = emailPassword;
                entity.EmailAddress            = emailAddress;
                entity.CreateDate              = DateTime.Now;

                var m = ConfigService.GetConfigPro(SystemID, CompanyID);
                if (m == null)
                {
                    return(Error("公司编号不存在!"));
                }
                long operationId = 0;
                TableOperationManager.Update(m, entity.ToJson(), out operationId);
                bool result = ConfigService.UpdateConfigPro(entity);
                TableOperationManager.SetState(operationId, result);
                if (result)
                {
                    return(Success("成功!"));
                }
                else
                {
                    return(Error("失败!"));
                }
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }