Beispiel #1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var groupID = TranslateUtils.ToInt(UserGroupIDDropDownList.SelectedValue);

            var groupInfo = UserGroupManager.GetGroupInfo(groupID);

            foreach (var userID in _userIdList)
            {
                var userInfo = BaiRongDataProvider.UserDao.GetUserInfo(userID);

                userInfo.GroupId = groupID;

                BaiRongDataProvider.UserDao.Update(userInfo);
            }

            Body.AddAdminLog("设置用户类别", string.Empty);

            PageUtils.CloseModalPage(Page);
        }
Beispiel #2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (_departmentId == 0)
                {
                    var departmentInfo = new DepartmentInfo();
                    departmentInfo.DepartmentName = DepartmentName.Text;
                    departmentInfo.Code           = Code.Text;
                    departmentInfo.ParentId       = TranslateUtils.ToInt(ParentID.SelectedValue);
                    departmentInfo.Summary        = Summary.Text;

                    BaiRongDataProvider.DepartmentDao.Insert(departmentInfo);
                }
                else
                {
                    var departmentInfo = DepartmentManager.GetDepartmentInfo(_departmentId);

                    departmentInfo.DepartmentName = DepartmentName.Text;
                    departmentInfo.Code           = Code.Text;
                    departmentInfo.ParentId       = TranslateUtils.ToInt(ParentID.SelectedValue);
                    departmentInfo.Summary        = Summary.Text;

                    BaiRongDataProvider.DepartmentDao.Update(departmentInfo);
                }

                Body.AddAdminLog("维护部门信息");

                SuccessMessage("部门设置成功!");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "部门设置失败!");
            }

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, _returnUrl);
            }
        }
Beispiel #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _pluginId  = Body.GetQueryString("pluginId");
            _returnUrl = Body.GetQueryString("returnUrl");

            if (Body.IsQueryExists("install"))
            {
                var version = Body.GetQueryString("version");

                string errorMessage;

                PackageUtils.DownloadPackage(_pluginId, version);

                var idWithVersion = $"{_pluginId}.{version}";
                if (!PackageUtils.UpdatePackage(idWithVersion, false, out errorMessage))
                {
                    FailMessage(errorMessage);
                    return;
                }

                PluginManager.ClearCache();
                Body.AddAdminLog("安装插件", $"插件:{_pluginId}");

                AddScript(AlertUtils.Success("插件安装成功", "插件安装成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            else if (Body.IsQueryExists("update"))
            {
                PageUtils.Redirect(PageUpdate.GetRedirectUrl());
            }

            if (Page.IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Plugins.Add, ConfigManager.Permissions.Plugins.Management);
        }
Beispiel #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var roleName = Body.GetQueryString("RoleName");
                try
                {
                    DataProvider.PermissionsInRolesDao.Delete(roleName);
                    DataProvider.RoleDao.DeleteRole(roleName);

                    Body.AddAdminLog("删除管理员角色", $"角色名称:{roleName}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Admin);

            var permissioins = PermissionsManager.GetPermissions(Body.AdminName);

            RptContents.DataSource = permissioins.IsConsoleAdministrator
                ? DataProvider.RoleDao.GetAllRoles()
                : DataProvider.RoleDao.GetAllRolesByCreatorUserName(Body.AdminName);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAdd.Attributes.Add("onclick", $"location.href = '{PageAdminRoleAdd.GetRedirectUrl()}';return false;");
        }
Beispiel #5
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                ConfigManager.SystemConfigInfo.RestrictionType = ERestrictionTypeUtils.GetEnumType(RestrictionType.SelectedValue);

                try
                {
                    BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance);

                    Body.AddAdminLog("设置访问限制选项");

                    SuccessMessage("访问限制选项修改成功!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "访问限制选项修改失败!");
                }
            }
        }
Beispiel #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var enName        = Body.GetQueryString("ENName"); //辅助表
                var enNameArchive = enName + "_Archive";           //辅助表归档

                try
                {
                    BaiRongDataProvider.TableCollectionDao.Delete(enName);        //删除辅助表
                    BaiRongDataProvider.TableCollectionDao.Delete(enNameArchive); //删除辅助表归档

                    Body.AddAdminLog("删除辅助表", $"辅助表:{enName}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            if (!IsPostBack)
            {
                BreadCrumbSys(AppManager.Sys.LeftMenu.Auxiliary, "辅助表管理", AppManager.Sys.Permission.SysAuxiliary);

                try
                {
                    dgContents.DataSource = BaiRongDataProvider.TableCollectionDao.GetDataSourceByAuxiliaryTableType();
                    dgContents.DataBind();
                }
                catch (Exception ex)
                {
                    PageUtils.RedirectToErrorPage(ex.Message);
                }
            }
        }
Beispiel #7
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (_areaId == 0)
                {
                    var areaInfo = new AreaInfo
                    {
                        AreaName = TbAreaName.Text,
                        ParentId = TranslateUtils.ToInt(DdlParentId.SelectedValue)
                    };

                    DataProvider.AreaDao.Insert(areaInfo);
                }
                else
                {
                    var areaInfo = AreaManager.GetAreaInfo(_areaId);

                    areaInfo.AreaName = TbAreaName.Text;
                    areaInfo.ParentId = TranslateUtils.ToInt(DdlParentId.SelectedValue);

                    DataProvider.AreaDao.Update(areaInfo);
                }

                Body.AddAdminLog("维护区域信息");

                SuccessMessage("区域设置成功!");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "区域设置失败!");
            }

            if (isChanged)
            {
                LayerUtils.CloseAndRedirect(Page, _returnUrl);
            }
        }
Beispiel #8
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var enName        = Body.GetQueryString("ENName"); //辅助表
                var enNameArchive = enName + "_Archive";           //辅助表归档

                try
                {
                    DataProvider.TableDao.DeleteCollectionTableInfoAndDbTable(enName);        //删除辅助表
                    DataProvider.TableDao.DeleteCollectionTableInfoAndDbTable(enNameArchive); //删除辅助表归档

                    Body.AddAdminLog("删除辅助表", $"辅助表:{enName}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Site);

            RptContents.DataSource     = DataProvider.TableDao.GetTableCollectionInfoList();
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAdd.OnClientClick = ModalAuxiliaryTableAdd.GetOpenWindowString();
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                ConfigManager.UserConfigInfo.Title     = TbTitle.Text;
                ConfigManager.UserConfigInfo.Copyright = TbCopyright.Text;
                ConfigManager.UserConfigInfo.BeianNo   = TbBeianNo.Text;

                ConfigManager.UserConfigInfo.IsEnable = TranslateUtils.ToBool(DdlIsEnable.SelectedValue);

                try
                {
                    BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance);
                    Body.AddAdminLog("修改用户中心显示设置");
                    SuccessMessage("显示设置修改成功!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "显示设置修改失败!");
                }
            }
        }
        private bool InsertOrUpdateTableStyleInfo()
        {
            var isChanged = false;

            _styleInfo.Additional.IsValidate   = TranslateUtils.ToBool(IsValidate.SelectedValue);
            _styleInfo.Additional.IsRequired   = TranslateUtils.ToBool(IsRequired.SelectedValue);
            _styleInfo.Additional.MinNum       = TranslateUtils.ToInt(MinNum.Text);
            _styleInfo.Additional.MaxNum       = TranslateUtils.ToInt(MaxNum.Text);
            _styleInfo.Additional.ValidateType = EInputValidateTypeUtils.GetEnumType(ValidateType.SelectedValue);
            _styleInfo.Additional.RegExp       = RegExp.Text.Trim('/');
            _styleInfo.Additional.ErrorMessage = ErrorMessage.Text;

            try
            {
                if (_tableStyleId == 0)//数据库中没有此项的表样式,但是有父项的表样式
                {
                    _styleInfo.RelatedIdentity = 0;
                    _styleInfo.TableStyleId    = TableStyleManager.Insert(_styleInfo, _tableStyle);
                }

                if (_styleInfo.TableStyleId > 0)
                {
                    TableStyleManager.Update(_styleInfo);
                    Body.AddAdminLog("修改表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}");
                }
                else
                {
                    TableStyleManager.Insert(_styleInfo, _tableStyle);
                    Body.AddAdminLog("新增表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}");
                }
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "设置表单验证失败:" + ex.Message);
            }
            return(isChanged);
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (_categoryId == 0)
                {
                    var categoryInfo = new GovPublicCategoryInfo(0, _classCode, PublishmentSystemId, CategoryName.Text, CategoryCode.Text, TranslateUtils.ToInt(ParentID.SelectedValue), string.Empty, 0, 0, false, 0, DateTime.Now, Summary.Text, 0);

                    DataProvider.GovPublicCategoryDao.Insert(categoryInfo);
                }
                else
                {
                    var categoryInfo = DataProvider.GovPublicCategoryDao.GetCategoryInfo(_categoryId);

                    categoryInfo.CategoryName = CategoryName.Text;
                    categoryInfo.CategoryCode = CategoryCode.Text;
                    categoryInfo.Summary      = Summary.Text;

                    DataProvider.GovPublicCategoryDao.Update(categoryInfo);
                }

                Body.AddAdminLog("维护分类信息");

                SuccessMessage("分类设置成功!");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "分类设置失败!");
            }

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, _returnUrl);
            }
        }
Beispiel #12
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var tplId = this.TbTplId.Text;
                if (_templateType == ESmsTemplateType.Code)
                {
                    if (_providerType == ESmsProviderType.AliDaYu)
                    {
                        ConfigManager.SystemConfigInfo.SmsAliDaYuCodeTplId = tplId;
                    }
                    else if (_providerType == ESmsProviderType.YunPian)
                    {
                        ConfigManager.SystemConfigInfo.SmsYunPianCodeTplId = tplId;
                    }
                }
                BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance);

                Body.AddAdminLog("设置短信模板");

                SuccessMessage("短信模板设置成功!");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "短信模板设置失败!");
            }

            if (!isChanged)
            {
                return;
            }

            PageUtils.CloseModalPageAndRedirect(Page, PageSmsTemplates.GetRedirectUrl(_providerType));
        }
Beispiel #13
0
 public override void Submit_OnClick(object sender, EventArgs e)
 {
     if (Page.IsPostBack && Page.IsValid)
     {
         PublishmentSystemInfo.TelePhone      = TelePhone.Text;
         PublishmentSystemInfo.Address        = Address.Text;
         PublishmentSystemInfo.BasicFacts     = BasicFacts.Text;
         PublishmentSystemInfo.Characteristic = Characteristic.Text;
         PublishmentSystemInfo.ImageUrl       = ImageUrl.Text;
         try
         {
             DataProvider.PublishmentSystemDao.UpdateAll(PublishmentSystemInfo);
             Body.AddAdminLog("保存基本信息属性", $"站点:{PublishmentSystemInfo.PublishmentSystemName}");
             SuccessMessage("站点基本信息保存成功!");
             // AddWaitAndRedirectScript(Sys.PagePublishmentSystem.GetRedirectUrl());
             // AddWaitAndRedirectScript($@"/siteserver/loading.aspx?RedirectType=Loading&RedirectUrl=cms/siteManagement.aspx?PublishmentSystemID={PublishmentSystemId}");
             //AddWaitAndRedirectScript($@"/siteserver/cms/PagePublishmentSystem.aspx?PublishmentSystemID={PublishmentSystemId}");
         }
         catch (Exception ex)
         {
             FailMessage(ex, "基本信息保存失败!");
         }
     }
 }
Beispiel #14
0
        private bool InsertTableStyleInfo(InputType inputType)
        {
            var isChanged = false;

            var attributeNameArray = TbAttributeNames.Text.Split('\n');

            var relatedIdentity    = _relatedIdentities[0];
            var styleInfoArrayList = new ArrayList();

            foreach (var itemString in attributeNameArray)
            {
                if (string.IsNullOrEmpty(itemString))
                {
                    continue;
                }

                var attributeName = itemString;
                var displayName   = string.Empty;

                if (StringUtils.Contains(itemString, "(") && StringUtils.Contains(itemString, ")"))
                {
                    var length = itemString.IndexOf(')') - itemString.IndexOf('(');
                    if (length > 0)
                    {
                        displayName   = itemString.Substring(itemString.IndexOf('(') + 1, length);
                        attributeName = itemString.Substring(0, itemString.IndexOf('('));
                    }
                }
                attributeName = attributeName.Trim();
                displayName   = displayName.Trim(' ', '(', ')');
                if (string.IsNullOrEmpty(displayName))
                {
                    displayName = attributeName;
                }

                if (string.IsNullOrEmpty(attributeName))
                {
                    FailMessage("操作失败,字段名不能为空!");
                    return(false);
                }

                if (TableStyleManager.IsExists(relatedIdentity, _tableName, attributeName))
                {
                    FailMessage($@"显示样式添加失败:字段名""{attributeName}""已存在");
                    return(false);
                }

                var styleInfo = new TableStyleInfo(0, relatedIdentity, _tableName, attributeName, 0, displayName, string.Empty, false, inputType, TbDefaultValue.Text, TranslateUtils.ToBool(DdlIsHorizontal.SelectedValue), string.Empty);
                styleInfo.Additional.Columns = TranslateUtils.ToInt(TbColumns.Text);
                styleInfo.Additional.Height  = TranslateUtils.ToInt(TbHeight.Text);
                styleInfo.Additional.Width   = TbWidth.Text;

                if (inputType == InputType.CheckBox || inputType == InputType.Radio || inputType == InputType.SelectMultiple || inputType == InputType.SelectOne)
                {
                    styleInfo.StyleItems = new List <TableStyleItemInfo>();

                    var rapidValues = TranslateUtils.StringCollectionToStringList(TbRapidValues.Text);
                    foreach (var rapidValue in rapidValues)
                    {
                        var itemInfo = new TableStyleItemInfo(0, styleInfo.Id, rapidValue, rapidValue, false);
                        styleInfo.StyleItems.Add(itemInfo);
                    }
                }

                styleInfoArrayList.Add(styleInfo);
            }

            try
            {
                var attributeNames = new ArrayList();
                foreach (TableStyleInfo styleInfo in styleInfoArrayList)
                {
                    attributeNames.Add(styleInfo.AttributeName);
                    TableStyleManager.Insert(styleInfo);
                }


                if (SiteId > 0)
                {
                    Body.AddSiteLog(SiteId, "批量添加表单显示样式", $"字段名: {TranslateUtils.ObjectCollectionToString(attributeNames)}");
                }
                else
                {
                    Body.AddAdminLog("批量添加表单显示样式", $"字段名: {TranslateUtils.ObjectCollectionToString(attributeNames)}");
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "显示样式添加失败:" + ex.Message);
            }

            return(isChanged);
        }
Beispiel #15
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    foreach (var userId in userIdList)
                    {
                        BaiRongDataProvider.UserDao.Delete(userId);
                    }

                    Body.AddAdminLog("删除用户", string.Empty);

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("Lock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.Lock(userIdList);

                    Body.AddAdminLog("锁定用户", string.Empty);

                    SuccessMessage("成功锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "锁定所选会员失败!");
                }
            }
            else if (Body.IsQueryExists("UnLock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.UnLock(userIdList);

                    Body.AddAdminLog("解除锁定用户", string.Empty);

                    SuccessMessage("成功解除锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "解除锁定所选会员失败!");
                }
            }

            SpContents.ControlToPaginate = RptContents;

            if (string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                SpContents.ItemsPerPage = TranslateUtils.ToInt(DdlPageNum.SelectedValue) == 0 ? 25 : TranslateUtils.ToInt(DdlPageNum.SelectedValue);

                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommandAll(true, Body.GetQueryInt("UserTypeId"));
            }
            else
            {
                SpContents.ItemsPerPage  = Body.GetQueryInt("PageNum") == 0 ? StringUtils.Constants.PageSize : Body.GetQueryInt("PageNum");
                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommandAll(Body.GetQueryString("Keyword"), Body.GetQueryInt("CreationDate"), Body.GetQueryInt("LastActivityDate"), true, Body.GetQueryInt("GroupID"), Body.GetQueryInt("LoginCount"), Body.GetQueryString("SearchType"), Body.GetQueryInt("TypeId"));
            }

            RptContents.ItemDataBound += rptContents_ItemDataBound;
            SpContents.SortField       = BaiRongDataProvider.UserDao.GetSortFieldName();
            SpContents.SortMode        = SortMode.DESC;

            _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.UserConfigInfo.LoginLockingType);

            if (IsPostBack)
            {
                return;
            }

            BreadCrumbUser(AppManager.User.LeftMenu.UserManagement, "用户管理", AppManager.User.Permission.UserManagement);

            var theListItem = new ListItem("全部", "0")
            {
                Selected = true
            };

            DdlGroup.Items.Add(theListItem);
            var groupInfoList = UserGroupManager.GetGroupInfoList();

            foreach (var userGroupInfo in groupInfoList)
            {
                var listitem = new ListItem(userGroupInfo.GroupName, userGroupInfo.GroupId.ToString());
                DdlGroup.Items.Add(listitem);
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("用户ID", "userID"));
            DdlSearchType.Items.Add(new ListItem("用户名", "userName"));
            DdlSearchType.Items.Add(new ListItem("邮箱", "email"));
            DdlSearchType.Items.Add(new ListItem("手机", "mobile"));

            //默认选择用户名
            DdlSearchType.SelectedValue = "userName";

            if (!string.IsNullOrEmpty(Body.GetQueryString("SearchType")))
            {
                ControlUtils.SelectListItems(DdlSearchType, Body.GetQueryString("SearchType"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                ControlUtils.SelectListItems(DdlGroup, Body.GetQueryString("GroupID"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("PageNum")))
            {
                ControlUtils.SelectListItems(DdlPageNum, Body.GetQueryString("PageNum"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LoginCount")))
            {
                ControlUtils.SelectListItems(DdlLoginCount, Body.GetQueryString("LoginCount"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("Keyword")))
            {
                TbKeyword.Text = Body.GetQueryString("Keyword");
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("CreationDate")))
            {
                ControlUtils.SelectListItems(DdlCreationDate, Body.GetQueryString("CreationDate"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LastActivityDate")))
            {
                ControlUtils.SelectListItems(DdlLastActivityDate, Body.GetQueryString("LastActivityDate"));
            }

            var showPopWinString = ModalAddToUserGroup.GetOpenWindowString();
            // BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

            var backgroundUrl = GetRedirectUrl();

            BtnAdd.Attributes.Add("onclick",
                                  $"location.href='{PageUserAdd.GetRedirectUrlToAdd(PageUrl)}';return false;");

            BtnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                       $"{backgroundUrl}?Lock=True", "UserIDCollection", "UserIDCollection", "请选择需要锁定的会员!", "此操作将锁定所选会员,确认吗?"));

            BtnUnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?UnLock=True", "UserIDCollection", "UserIDCollection", "请选择需要解除锁定的会员!", "此操作将解除锁定所选会员,确认吗?"));

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?Delete=True", "UserIDCollection", "UserIDCollection", "请选择需要删除的会员!", "此操作将删除所选会员,确认吗?"));

            //BtnImport.Attributes.Add("onclick", ModalUserImport.GetOpenWindowString());

            //BtnExport.Attributes.Add("onclick", ModalUserExport.GetOpenWindowString());

            SpContents.DataBind();
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var attributeNameList = TranslateUtils.StringCollectionToStringList(Request.Form["attributeName"]);
            var dataTypeList      = TranslateUtils.StringCollectionToStringList(Request.Form["dataType"]);
            var dataLengthList    = TranslateUtils.StringCollectionToStringList(Request.Form["dataLength"]);

            for (var i = 0; i < attributeNameList.Count; i++)
            {
                if (dataTypeList.Count < attributeNameList.Count)
                {
                    dataTypeList.Add(string.Empty);
                }
                if (dataLengthList.Count < attributeNameList.Count)
                {
                    dataLengthList.Add(string.Empty);
                }
            }

            var tableStyle             = EAuxiliaryTableTypeUtils.GetTableStyle(_tableType);
            var attributeNameArrayList = TableManager.GetAttributeNameList(tableStyle, _tableName, true);

            attributeNameArrayList.AddRange(TableManager.GetHiddenAttributeNameList(tableStyle));

            for (var i = 0; i < attributeNameList.Count; i++)
            {
                var attributeName = attributeNameList[i];
                var dataType      = dataTypeList[i];
                var dataLength    = dataLengthList[i];

                if (attributeNameArrayList.IndexOf(attributeName.Trim().ToLower()) != -1)
                {
                    FailMessage("字段添加失败,字段名已存在!");
                }
                else if (!SqlUtils.IsAttributeNameCompliant(attributeName))
                {
                    FailMessage("字段名不符合系统要求!");
                }
                else
                {
                    var info = new TableMetadataInfo
                    {
                        AuxiliaryTableEnName = _tableName,
                        AttributeName        = attributeName,
                        DataType             = EDataTypeUtils.GetEnumType(dataType)
                    };

                    var hashtable = new Hashtable
                    {
                        [EDataType.DateTime] = new[] { "8", "false" },
                        [EDataType.Integer]  = new[] { "4", "false" },
                        [EDataType.NChar]    = new[] { "50", "true" },
                        [EDataType.NText]    = new[] { "16", "false" },
                        [EDataType.NVarChar] = new[] { "255", "true" }
                    };

                    var strArr = (string[])hashtable[EDataTypeUtils.GetEnumType(dataType)];
                    if (strArr[1].Equals("false"))
                    {
                        dataLength = strArr[0];
                    }

                    if (string.IsNullOrEmpty(dataLength))
                    {
                        dataLength = strArr[0];
                    }

                    info.DataLength = int.Parse(dataLength);
                    if (info.DataType == EDataType.NVarChar || info.DataType == EDataType.NChar)
                    {
                        var maxLength = SqlUtils.GetMaxLengthForNVarChar();
                        if (info.DataLength <= 0 || info.DataLength > maxLength)
                        {
                            FailMessage($"字段修改失败,数据长度的值必须位于 1 和 {maxLength} 之间");
                            return;
                        }
                    }
                    info.IsSystem = false;

                    try
                    {
                        BaiRongDataProvider.TableMetadataDao.Insert(info);

                        Body.AddAdminLog("添加辅助表字段",
                                         $"辅助表:{_tableName},字段名:{info.AttributeName}");

                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, ex.Message);
                    }
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }
Beispiel #17
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("DeleteDirectory"))
            {
                var siteTemplateDir = Body.GetQueryString("SiteTemplateDir");

                try
                {
                    SiteTemplateManager.Instance.DeleteSiteTemplate(siteTemplateDir);

                    Body.AddAdminLog("删除站点模板", $"站点模板:{siteTemplateDir}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("DeleteZipFile"))
            {
                var fileName = Body.GetQueryString("FileName");

                try
                {
                    SiteTemplateManager.Instance.DeleteZipSiteTemplate(fileName);

                    Body.AddAdminLog("删除未解压站点模板", $"站点模板:{fileName}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (Page.IsPostBack)
            {
                return;
            }

            BreadCrumbSys(AppManager.Sys.LeftMenu.Plugin, "插件管理", AppManager.Sys.Permission.SysPlugin);

            var disabledList = new List <PluginPair>();
            var enabledList  = new List <PluginPair>();

            foreach (var pluginPair in PluginManager.AllPlugins)
            {
                if (pluginPair.Metadata.Disabled)
                {
                    disabledList.Add(pluginPair);
                }
                else
                {
                    enabledList.Add(pluginPair);
                }
            }

            DgEnabled.DataSource     = enabledList;
            DgEnabled.ItemDataBound += DgEnabled_ItemDataBound;
            DgEnabled.DataBind();

            if (disabledList.Count > 0)
            {
                DgDisabled.Visible        = true;
                DgDisabled.DataSource     = disabledList;
                DgDisabled.ItemDataBound += DgDisabled_ItemDataBound;
                DgDisabled.DataBind();
            }
            else
            {
                DgDisabled.Visible = false;
            }

            BtnImport.Attributes.Add("onclick", ModalUploadSiteTemplate.GetOpenWindowString());
        }
Beispiel #18
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                if (!string.IsNullOrEmpty(_theRoleName))
                {
                    try
                    {
                        var publishmentSystemPermissionsInRolesInfoList = Session[SystemPermissionsInfoListKey] as List <SystemPermissionsInfo>;
                        var generalPermissionArrayList = new ArrayList();

                        var productPermissions = Request["Permissions"];
                        if (!string.IsNullOrEmpty(productPermissions))
                        {
                            generalPermissionArrayList.AddRange(TranslateUtils.StringCollectionToStringList(productPermissions));
                        }

                        BaiRongDataProvider.PermissionsInRolesDao.UpdateRoleAndGeneralPermissions(_theRoleName, TbDescription.Text, generalPermissionArrayList);

                        DataProvider.PermissionsDao.UpdatePublishmentPermissions(_theRoleName, publishmentSystemPermissionsInRolesInfoList);

                        PermissionsManager.ClearAllCache();

                        Body.AddAdminLog("修改管理员角色", $"角色名称:{_theRoleName}");
                        SuccessMessage("角色修改成功!");
                        AddWaitAndRedirectScript(PageRole.GetRedirectUrl());
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "角色修改失败!");
                    }
                }
                else
                {
                    if (BaiRongDataProvider.RoleDao.IsRoleExists(TbRoleName.Text))
                    {
                        FailMessage("角色添加失败,角色标识已存在!");
                    }
                    else
                    {
                        var publishmentSystemPermissionsInRolesInfoList = Session[SystemPermissionsInfoListKey] as List <SystemPermissionsInfo>;
                        var generalPermissionList = new List <string>();

                        var permissions = Request["Permissions"];
                        if (!string.IsNullOrEmpty(permissions))
                        {
                            generalPermissionList.AddRange(TranslateUtils.StringCollectionToStringList(permissions));
                        }

                        try
                        {
                            DataProvider.PermissionsDao.InsertRoleAndPermissions(TbRoleName.Text, Body.AdministratorName, TbDescription.Text, generalPermissionList, publishmentSystemPermissionsInRolesInfoList);

                            PermissionsManager.ClearAllCache();

                            Body.AddAdminLog("新增管理员角色",
                                             $"角色名称:{TbRoleName.Text}");

                            SuccessMessage("角色添加成功!");
                            AddWaitAndRedirectScript(PageRole.GetRedirectUrl());
                        }
                        catch (Exception ex)
                        {
                            FailMessage(ex, $"角色添加失败,{ex.Message}");
                        }
                    }
                }
            }
        }
Beispiel #19
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("delete"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.Delete(pluginId);
                Body.AddAdminLog("删除插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件删除成功", "插件删除成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            if (Body.IsQueryExists("enable"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, false);
                Body.AddAdminLog("启用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件启用成功", "插件启用成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            else if (Body.IsQueryExists("disable"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, true);
                Body.AddAdminLog("禁用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件禁用成功", "插件禁用成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }

            if (Page.IsPostBack)
            {
                return;
            }

            PageType = Body.GetQueryInt("type", 1);

            VerifyAdministratorPermissions(ConfigManager.Permissions.Plugins.Management);

            var listEnabled  = new List <PluginInfo>();
            var listDisabled = new List <PluginInfo>();
            var listError    = new List <PluginInfo>();

            foreach (var pluginInfo in PluginManager.AllPluginInfoList)
            {
                if (pluginInfo.Plugin == null)
                {
                    CountError++;
                    listError.Add(pluginInfo);
                }
                else
                {
                    if (pluginInfo.IsDisabled)
                    {
                        CountDisabled++;
                        listDisabled.Add(pluginInfo);
                    }
                    else
                    {
                        CountEnabled++;
                        listEnabled.Add(pluginInfo);
                    }
                }
            }

            RptEnabled.DataSource     = listEnabled;
            RptEnabled.ItemDataBound += RptRunnable_ItemDataBound;
            RptEnabled.DataBind();

            RptDisabled.DataSource     = listDisabled;
            RptDisabled.ItemDataBound += RptRunnable_ItemDataBound;
            RptDisabled.DataBind();

            RptError.DataSource     = listError;
            RptError.ItemDataBound += RptError_ItemDataBound;
            RptError.DataBind();
        }
Beispiel #20
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissioins = PermissionsManager.GetPermissions(Body.AdministratorName);

            _departmentId = Body.GetQueryInt("departmentID");
            var areaId = Body.GetQueryInt("areaID");

            if (_departmentId > 0)
            {
                _departmentInfo = DepartmentManager.GetDepartmentInfo(_departmentId);
            }

            if (Body.IsQueryExists("Delete"))
            {
                var userNameCollection = Body.GetQueryString("UserNameCollection");
                try
                {
                    var userNameArrayList = TranslateUtils.StringCollectionToStringList(userNameCollection);
                    foreach (var userName in userNameArrayList)
                    {
                        BaiRongDataProvider.AdministratorDao.Delete(userName);
                    }

                    Body.AddAdminLog("删除管理员", $"管理员:{userNameCollection}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("Lock"))
            {
                var userNameCollection = Body.GetQueryString("UserNameCollection");
                try
                {
                    var userNameList = TranslateUtils.StringCollectionToStringList(userNameCollection);
                    BaiRongDataProvider.AdministratorDao.Lock(userNameList);

                    Body.AddAdminLog("锁定管理员", $"管理员:{userNameCollection}");

                    SuccessMessage("成功锁定所选管理员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "锁定所选管理员失败!");
                }
            }
            else if (Body.IsQueryExists("UnLock"))
            {
                var userNameCollection = Body.GetQueryString("UserNameCollection");
                try
                {
                    var userNameList = TranslateUtils.StringCollectionToStringList(userNameCollection);
                    BaiRongDataProvider.AdministratorDao.UnLock(userNameList);

                    Body.AddAdminLog("解除锁定管理员", $"管理员:{userNameCollection}");

                    SuccessMessage("成功解除锁定所选管理员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "解除锁定所选管理员失败!");
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            if (string.IsNullOrEmpty(Body.GetQueryString("PageNum")))
            {
                spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue) == 0 ? StringUtils.Constants.PageSize : TranslateUtils.ToInt(PageNum.SelectedValue);

                spContents.SelectCommand = BaiRongDataProvider.AdministratorDao.GetSelectCommandSite(permissioins.IsConsoleAdministrator, Body.AdministratorName, _departmentId, Body.AdministratorInfo.PublishmentSystemId);
                spContents.SortField     = BaiRongDataProvider.AdministratorDao.GetSortFieldName();
                spContents.SortMode      = SortMode.ASC;
            }
            else
            {
                spContents.ItemsPerPage  = Body.GetQueryInt("PageNum") == 0 ? StringUtils.Constants.PageSize : Body.GetQueryInt("PageNum");
                spContents.SelectCommand = BaiRongDataProvider.AdministratorDao.GetSelectCommand(Body.GetQueryString("Keyword"), Body.GetQueryString("RoleName"), Body.GetQueryInt("LastActivityDate"), permissioins.IsConsoleAdministrator, Body.AdministratorName, _departmentId, Body.GetQueryInt("AreaID"));
                spContents.SortField     = Body.GetQueryString("Order");
                spContents.SortMode      = StringUtils.EqualsIgnoreCase(spContents.SortField, "UserName") ? SortMode.ASC : SortMode.DESC;
            }

            rptContents.ItemDataBound += rptContents_ItemDataBound;

            _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.SystemConfigInfo.LoginLockingType);

            if (IsPostBack)
            {
                return;
            }

            BreadCrumbAdmin(AppManager.Admin.LeftMenu.AdminManagement, "管理员管理", AppManager.Admin.Permission.AdminManagement);

            var theListItem = new ListItem("全部", string.Empty)
            {
                Selected = true
            };

            var allRoles = permissioins.IsConsoleAdministrator ? BaiRongDataProvider.RoleDao.GetAllRoles() : BaiRongDataProvider.RoleDao.GetAllRolesByCreatorUserName(Body.AdministratorName);

            var allPredefinedRoles = EPredefinedRoleUtils.GetAllPredefinedRoleName();


            ddlAreaID.Items.Add(new ListItem("<全部区域>", "0"));
            var areaIdList = AreaManager.GetAreaIdList();
            var count      = areaIdList.Count;

            _isLastNodeArrayOfArea = new bool[count];
            foreach (var theAreaId in areaIdList)
            {
                var areaInfo = AreaManager.GetAreaInfo(theAreaId);
                var listitem = new ListItem(GetArea(areaInfo.AreaId, areaInfo.AreaName, areaInfo.ParentsCount, areaInfo.IsLastNode), theAreaId.ToString());
                if (areaId == theAreaId)
                {
                    listitem.Selected = true;
                }
                ddlAreaID.Items.Add(listitem);
            }

            if (Body.IsQueryExists("PageNum"))
            {
                ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum"));
                Keyword.Text = Body.GetQueryString("Keyword");
                ControlUtils.SelectListItems(ddlAreaID, Body.GetQueryString("AreaID"));
                ControlUtils.SelectListItems(LastActivityDate, Body.GetQueryString("LastActivityDate"));
                ControlUtils.SelectListItems(Order, Body.GetQueryString("Order"));
            }

            var urlAdd = PageAdministratorAdd.GetRedirectUrlToAdd(_departmentId);

            AddButton.Attributes.Add("onclick", $@"location.href='{urlAdd}';return false;");

            var urlAdministrator = GetRedirectUrl(_departmentId);

            Lock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "&Lock=True", "UserNameCollection", "UserNameCollection", "请选择需要锁定的管理员!", "此操作将锁定所选管理员,确认吗?"));

            UnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "&UnLock=True", "UserNameCollection", "UserNameCollection", "请选择需要解除锁定的管理员!", "此操作将解除锁定所选管理员,确认吗?"));

            Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "&Delete=True", "UserNameCollection", "UserNameCollection", "请选择需要删除的管理员!", "此操作将删除所选管理员,确认吗?"));

            spContents.DataBind();
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            if (Body.IsQueryExists("TableMetadataID"))
            {
                var tableMetadataId = Body.GetQueryInt("TableMetadataID");

                var info = DataProvider.TableMetadataDao.GetTableMetadataInfo(tableMetadataId);
                info.TableName     = _tableName;
                info.AttributeName = TbAttributeName.Text;
                info.DataType      = DataTypeUtils.GetEnumType(DdlDataType.SelectedValue);

                if (info.DataType == DataType.VarChar)
                {
                    info.DataLength = TranslateUtils.ToInt(TbDataLength.Text);
                    var maxLength = SqlUtils.GetMaxLengthForNVarChar();
                    if (info.DataLength <= 0 || info.DataLength > maxLength)
                    {
                        FailMessage($"字段修改失败,数据长度的值必须位于 1 和 {maxLength} 之间");
                        return;
                    }
                }

                try
                {
                    DataProvider.TableMetadataDao.Update(info);

                    Body.AddAdminLog("修改辅助表字段",
                                     $"辅助表:{_tableName},字段名:{info.AttributeName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, ex.Message);
                }
            }
            else
            {
                var attributeNameList = TableMetadataManager.GetAttributeNameList(_tableName, true);

                var attributeNameLowercase = TbAttributeName.Text.Trim().ToLower();
                if (attributeNameList.Contains(attributeNameLowercase) || ContentAttribute.AllAttributesLowercase.Contains(attributeNameLowercase))
                {
                    FailMessage("字段添加失败,字段名已存在!");
                }
                else if (!SqlUtils.IsAttributeNameCompliant(TbAttributeName.Text))
                {
                    FailMessage("字段名不符合系统要求!");
                }
                else
                {
                    var info = new TableMetadataInfo
                    {
                        TableName     = _tableName,
                        AttributeName = TbAttributeName.Text,
                        DataType      = DataTypeUtils.GetEnumType(DdlDataType.SelectedValue)
                    };

                    if (info.DataType == DataType.VarChar)
                    {
                        info.DataLength = TranslateUtils.ToInt(TbDataLength.Text);
                        var maxLength = SqlUtils.GetMaxLengthForNVarChar();
                        if (info.DataLength <= 0 || info.DataLength > maxLength)
                        {
                            FailMessage($"字段修改失败,数据长度的值必须位于 1 和 {maxLength} 之间");
                            return;
                        }
                    }
                    info.IsSystem = false;

                    try
                    {
                        DataProvider.TableMetadataDao.Insert(info);

                        Body.AddAdminLog("添加辅助表字段",
                                         $"辅助表:{_tableName},字段名:{info.AttributeName}");

                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, ex.Message);
                    }
                }
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
Beispiel #22
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var    systemPermissionlist = new List <SystemPermissionsInfo>();
                int    publishmentSystemId  = PublishmentSystemId;
                string description          = TbDescription.Text;
                string displayRoleName      = TbRoleName.Text;
                string insertRoleName       = publishmentSystemId + "_" + displayRoleName;
                for (int i = 0; i < rptContents.Items.Count; i++)
                {
                    string nodeId = ((HiddenField)rptContents.Items[i].FindControl("hidName")).Value;
                    //int publishmentSystemId = int.Parse(((HiddenField)rptContents.Items[i].FindControl("hidPublishmentSystemId")).Value);
                    string       channelPermissions = string.Empty;
                    CheckBoxList cblActionType      = (CheckBoxList)rptContents.Items[i].FindControl("cblActionType");
                    for (int n = 0; n < cblActionType.Items.Count; n++)
                    {
                        if (cblActionType.Items[n].Selected == true)
                        {
                            channelPermissions = channelPermissions + cblActionType.Items[n].Value + ",";
                        }
                    }
                    channelPermissions = channelPermissions.TrimEnd(',');
                    if (!string.IsNullOrEmpty(channelPermissions))
                    {
                        systemPermissionlist.Add(new SystemPermissionsInfo(insertRoleName, publishmentSystemId, nodeId, channelPermissions, string.Empty));
                    }
                }
                for (int i = 0; i < rptWebSite.Items.Count; i++)
                {
                    string webPermission = ((HiddenField)rptWebSite.Items[i].FindControl("hidPermission")).Value;
                    //int publishmentSystemId = int.Parse(((HiddenField)rptContents.Items[i].FindControl("hidPublishmentSystemId")).Value);
                    string       webSitePermissions = string.Empty;
                    CheckBoxList cblActionType      = (CheckBoxList)rptWebSite.Items[i].FindControl("cblWebSiteType");
                    for (int n = 0; n < cblActionType.Items.Count; n++)
                    {
                        if (cblActionType.Items[n].Selected == true)
                        {
                            webSitePermissions = webSitePermissions + cblActionType.Items[n].Value + ",";
                        }
                    }
                    webSitePermissions = webSitePermissions.TrimEnd(',');
                    if (!string.IsNullOrEmpty(webSitePermissions))
                    {
                        systemPermissionlist.Add(new SystemPermissionsInfo(insertRoleName, publishmentSystemId, string.Empty, string.Empty, webSitePermissions));
                    }
                }
                try
                {
                    DataProvider.PermissionsDao.InsertRoleAndPermissionsParty(systemPermissionlist);//更新权限角色表
                    PermissionsManager.ClearAllCache();
                    SuccessMessage("角色添加成功!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"角色添加失败,{ex.Message}");
                }

                BaiRongDataProvider.RoleDao.InsertRole(insertRoleName, Body.AdministratorName, description, publishmentSystemId);
                Body.AddAdminLog("添加角色成功", $"角色名称:{displayRoleName}");
            }
            SuccessMessage("角色添加成功!");
            AddWaitAndRedirectScript($@"/siteserver/cms/PageRoleAdd.aspx?PublishmentSystemID={PublishmentSystemId}");
        }
Beispiel #23
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    foreach (var userId in userIdList)
                    {
                        BaiRongDataProvider.UserDao.Delete(userId);
                    }

                    Body.AddAdminLog("删除用户", string.Empty);

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("Check"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.Check(userIdList);

                    SuccessCheckMessage();
                }
                catch (Exception ex)
                {
                    FailCheckMessage(ex);
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = 25;
            spContents.SelectCommand     = BaiRongDataProvider.UserDao.GetSelectCommand(false);
            rptContents.ItemDataBound   += rptContents_ItemDataBound;
            spContents.SortField         = BaiRongDataProvider.UserDao.GetSortFieldName();
            spContents.SortMode          = SortMode.DESC;

            if (!IsPostBack)
            {
                BreadCrumbUser(AppManager.User.LeftMenu.UserManagement, "审核新用户", AppManager.User.Permission.UserManagement);

                spContents.DataBind();

                Check.Attributes.Add("onclick",
                                     PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         PageUtils.GetUserUrl(nameof(PageUserCheck), new NameValueCollection
                {
                    { "Check", "True" }
                }), "UserIDCollection", "UserIDCollection", "请选择需要审核的会员!", "此操作将审核通过所选会员,确认吗?"));

                Delete.Attributes.Add("onclick",
                                      PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                          PageUtils.GetUserUrl(nameof(PageUserCheck), new NameValueCollection
                {
                    { "Delete", "True" }
                }), "UserIDCollection", "UserIDCollection", "请选择需要删除的会员!", "此操作将删除所选会员,确认吗?"));
            }
        }
Beispiel #24
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("DeleteDirectory"))
            {
                var siteTemplateDir = Body.GetQueryString("SiteTemplateDir");

                try
                {
                    SiteTemplateManager.Instance.DeleteSiteTemplate(siteTemplateDir);

                    Body.AddAdminLog("删除站点模板", $"站点模板:{siteTemplateDir}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("DeleteZipFile"))
            {
                var fileName = Body.GetQueryString("FileName");

                try
                {
                    SiteTemplateManager.Instance.DeleteZipSiteTemplate(fileName);

                    Body.AddAdminLog("删除未解压站点模板", $"站点模板:{fileName}");

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (Page.IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Site);

            _sortedlist = SiteTemplateManager.Instance.GetSiteTemplateSortedList();
            var directoryList = new List <DirectoryInfo>();

            foreach (string directoryName in _sortedlist.Keys)
            {
                var directoryPath = PathUtility.GetSiteTemplatesPath(directoryName);
                var dirInfo       = new DirectoryInfo(directoryPath);
                directoryList.Add(dirInfo);
            }

            RptDirectories.DataSource     = directoryList;
            RptDirectories.ItemDataBound += RptDirectories_ItemDataBound;
            RptDirectories.DataBind();

            var fileNames = SiteTemplateManager.Instance.GetZipSiteTemplateList();
            var fileList  = new List <FileInfo>();

            foreach (var fileName in fileNames)
            {
                if (!DirectoryUtils.IsDirectoryExists(PathUtility.GetSiteTemplatesPath(PathUtils.GetFileNameWithoutExtension(fileName))))
                {
                    var filePath = PathUtility.GetSiteTemplatesPath(fileName);
                    var fileInfo = new FileInfo(filePath);
                    fileList.Add(fileInfo);
                }
            }
            if (fileList.Count > 0)
            {
                RptZipFiles.Visible        = true;
                RptZipFiles.DataSource     = fileList;
                RptZipFiles.ItemDataBound += RptZipFiles_ItemDataBound;
                RptZipFiles.DataBind();
            }
            else
            {
                RptZipFiles.Visible = false;
            }

            BtnImport.Attributes.Add("onclick", ModalImportZip.GetOpenWindowString(ModalImportZip.TypeSiteTemplate));
        }
Beispiel #25
0
        public void BtnNext_Click(object sender, EventArgs e)
        {
            string errorMessage;

            if (CurrentWizardPanel == WizardPanel.Welcome)
            {
                if (SiteTemplateManager.Instance.IsSiteTemplateDirectoryExists(TbSiteTemplateDir.Text))
                {
                    LtlErrorMessage.Text = "站点模板保存失败,站点模板已存在!";
                    SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                }
                else
                {
                    SetActivePlaceHolder(WizardPanel.SaveFiles, PhSaveFiles);
                }
            }
            else if (CurrentWizardPanel == WizardPanel.SaveFiles)
            {
                if (SaveFiles(out errorMessage))
                {
                    Body.AddAdminLog("保存站点模板", $"站点:{PublishmentSystemInfo.PublishmentSystemName}");

                    SetActivePlaceHolder(WizardPanel.SaveSiteContents, PhSaveSiteContents);
                }
                else
                {
                    LtlErrorMessage.Text = errorMessage;
                    SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                }
            }
            else if (CurrentWizardPanel == WizardPanel.SaveSiteContents)
            {
                if (SaveSiteContents(out errorMessage))
                {
                    SetActivePlaceHolder(WizardPanel.SaveSiteStyles, PhSaveSiteStyles);
                }
                else
                {
                    LtlErrorMessage.Text = errorMessage;
                    SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                }
            }
            else if (CurrentWizardPanel == WizardPanel.SaveSiteStyles)
            {
                if (SaveSiteStyles(out errorMessage))
                {
                    SetActivePlaceHolder(WizardPanel.UploadImageFile, PhUploadImageFile);
                }
                else
                {
                    LtlErrorMessage.Text = errorMessage;
                    SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                }
            }
            else if (CurrentWizardPanel == WizardPanel.UploadImageFile)
            {
                string samplePicPath;
                if (UploadImageFile(out errorMessage, out samplePicPath))
                {
                    try
                    {
                        var siteTemplateInfo = new SiteTemplateInfo
                        {
                            SiteTemplateName      = TbSiteTemplateName.Text,
                            PublishmentSystemType =
                                EPublishmentSystemTypeUtils.GetValue(PublishmentSystemInfo.PublishmentSystemType),
                            PicFileName = samplePicPath,
                            WebSiteUrl  = TbWebSiteUrl.Text,
                            Description = TbDescription.Text
                        };

                        var siteTemplatePath = PathUtility.GetSiteTemplatesPath(TbSiteTemplateDir.Text);
                        var xmlPath          = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath,
                                                                                       DirectoryUtils.SiteTemplates.FileMetadata);
                        Serializer.SaveAsXML(siteTemplateInfo, xmlPath);

                        SetActivePlaceHolder(WizardPanel.Done, PhDone);
                    }
                    catch (Exception ex)
                    {
                        LtlErrorMessage.Text = ex.Message;
                        SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                    }
                }
                else
                {
                    LtlErrorMessage.Text = errorMessage;
                    SetActivePlaceHolder(WizardPanel.OperatingError, PhOperatingError);
                }
            }
        }
Beispiel #26
0
        private bool InsertTableStyleInfo(EInputType inputType)
        {
            var isChanged = false;

            var attributeNameArray = AttributeNames.Text.Split('\n');

            var relatedIdentity    = 0;
            var styleInfoArrayList = new ArrayList();

            foreach (var itemString in attributeNameArray)
            {
                if (!string.IsNullOrEmpty(itemString))
                {
                    var attributeName = itemString;
                    var displayName   = string.Empty;

                    if (StringUtils.Contains(itemString, "(") && StringUtils.Contains(itemString, ")"))
                    {
                        var length = itemString.IndexOf(')') - itemString.IndexOf('(');
                        if (length > 0)
                        {
                            displayName   = itemString.Substring(itemString.IndexOf('(') + 1, length);
                            attributeName = itemString.Substring(0, itemString.IndexOf('('));
                        }
                    }
                    attributeName = attributeName.Trim();
                    displayName   = displayName.Trim(' ', '(', ')');
                    if (string.IsNullOrEmpty(displayName))
                    {
                        displayName = attributeName;
                    }

                    if (TableStyleManager.IsExists(relatedIdentity, _tableName, attributeName))
                    {
                        FailMessage($@"显示样式添加失败:字段名""{attributeName}""已存在");
                        return(false);
                    }

                    var styleInfo = new TableStyleInfo(0, relatedIdentity, _tableName, attributeName, 0, displayName, string.Empty, TranslateUtils.ToBool(IsVisible.SelectedValue), false, TranslateUtils.ToBool(IsSingleLine.SelectedValue), EInputTypeUtils.GetValue(inputType), DefaultValue.Text, TranslateUtils.ToBool(IsHorizontal.SelectedValue), string.Empty);
                    styleInfo.Additional.Columns = TranslateUtils.ToInt(Columns.Text);
                    styleInfo.Additional.Height  = TranslateUtils.ToInt(Height.Text);
                    styleInfo.Additional.Width   = Width.Text;

                    if (inputType == EInputType.CheckBox || inputType == EInputType.Radio || inputType == EInputType.SelectMultiple || inputType == EInputType.SelectOne)
                    {
                        styleInfo.StyleItems = new List <TableStyleItemInfo>();

                        var isHasSelected = false;
                        foreach (RepeaterItem item in MyRepeater.Items)
                        {
                            var ItemTitle  = (TextBox)item.FindControl("ItemTitle");
                            var ItemValue  = (TextBox)item.FindControl("ItemValue");
                            var IsSelected = (CheckBox)item.FindControl("IsSelected");

                            if ((inputType != EInputType.SelectMultiple && inputType != EInputType.CheckBox) && isHasSelected && IsSelected.Checked)
                            {
                                FailMessage("操作失败,只能有一个初始化时选定项!");
                                return(false);
                            }
                            if (IsSelected.Checked)
                            {
                                isHasSelected = true;
                            }

                            var itemInfo = new TableStyleItemInfo(0, 0, ItemTitle.Text, ItemValue.Text, IsSelected.Checked);
                            styleInfo.StyleItems.Add(itemInfo);
                        }
                    }

                    styleInfoArrayList.Add(styleInfo);
                }
            }

            try
            {
                var attributeNames = new ArrayList();
                foreach (TableStyleInfo styleInfo in styleInfoArrayList)
                {
                    attributeNames.Add(styleInfo.AttributeName);
                    TableStyleManager.Insert(styleInfo, _tableStyle);
                }
                Body.AddAdminLog("批量添加表单显示样式", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段名: {TranslateUtils.ObjectCollectionToString(attributeNames)}");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "显示样式添加失败:" + ex.Message);
            }

            return(isChanged);
        }
Beispiel #27
0
        private int Validate_SiteInfo(out string errorMessage)
        {
            try
            {
                var isHq         = TranslateUtils.ToBool(RblIsRoot.SelectedValue); // 是否主站
                var parentSiteId = 0;
                var siteDir      = string.Empty;

                if (isHq == false)
                {
                    if (DirectoryUtils.IsSystemDirectory(TbSiteDir.Text))
                    {
                        errorMessage = "文件夹名称不能为系统文件夹名称!";
                        return(0);
                    }

                    parentSiteId = TranslateUtils.ToInt(DdlParentId.SelectedValue);
                    siteDir      = TbSiteDir.Text;

                    var list = DataProvider.SiteDao.GetLowerSiteDirList(parentSiteId);
                    if (list.IndexOf(siteDir.ToLower()) != -1)
                    {
                        errorMessage = "已存在相同的发布路径!";
                        return(0);
                    }

                    if (!DirectoryUtils.IsDirectoryNameCompliant(siteDir))
                    {
                        errorMessage = "文件夹名称不符合系统要求!";
                        return(0);
                    }
                }

                var nodeInfo = new ChannelInfo();

                nodeInfo.ChannelName          = nodeInfo.IndexName = "首页";
                nodeInfo.ParentId             = 0;
                nodeInfo.ContentModelPluginId = string.Empty;

                var psInfo = new SiteInfo
                {
                    SiteName  = PageUtils.FilterXss(TbSiteName.Text),
                    SiteDir   = siteDir,
                    TableName = DdlTableName.SelectedValue,
                    ParentId  = parentSiteId,
                    IsRoot    = isHq
                };

                psInfo.Additional.IsCheckContentLevel = TranslateUtils.ToBool(RblIsCheckContentUseLevel.SelectedValue);

                if (psInfo.Additional.IsCheckContentLevel)
                {
                    psInfo.Additional.CheckContentLevel = TranslateUtils.ToInt(DdlCheckContentLevel.SelectedValue);
                }
                psInfo.Additional.Charset = DdlCharset.SelectedValue;

                var theSiteId = DataProvider.ChannelDao.InsertSiteInfo(nodeInfo, psInfo, Body.AdminName);

                var permissions = PermissionsManager.GetPermissions(Body.AdminName);
                if (permissions.IsSystemAdministrator && !permissions.IsConsoleAdministrator)
                {
                    var siteIdList = ProductPermissionsManager.Current.SiteIdList ?? new List <int>();
                    siteIdList.Add(theSiteId);
                    DataProvider.AdministratorDao.UpdateSiteIdCollection(Body.AdminName, TranslateUtils.ObjectCollectionToString(siteIdList));
                }

                Body.AddAdminLog("创建新站点", $"站点名称:{PageUtils.FilterXss(TbSiteName.Text)}");

                errorMessage = string.Empty;
                return(theSiteId);
            }
            catch (Exception e)
            {
                errorMessage = e.Message;
                return(0);
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            if (HeadquartersExists.Visible)
            {
                Page.Response.Clear();
                Page.Response.Write("<script language=\"javascript\">" + PageUtils.HidePopWin + "</script>");
                Page.Response.End();
            }
            else
            {
                try
                {
                    if (_isHeadquarters)
                    {
                        var list = DataProvider.NodeDao.GetLowerSystemDirList(PublishmentSystemInfo.ParentPublishmentSystemId);
                        if (list.IndexOf(PublishmentSystemDir.Text.Trim().ToLower()) != -1)
                        {
                            PublishmentSystemDirValidator.IsValid      = false;
                            PublishmentSystemDirValidator.ErrorMessage = "已存在相同的发布路径";
                        }
                        else
                        {
                            if (!DirectoryUtils.IsDirectoryNameCompliant(PublishmentSystemDir.Text))
                            {
                                PublishmentSystemDirValidator.IsValid      = false;
                                PublishmentSystemDirValidator.ErrorMessage = "文件夹名称不符合要求";
                            }
                            else
                            {
                                var filesToSite = new ArrayList();
                                foreach (ListItem item in FilesToSite.Items)
                                {
                                    if (item.Selected)
                                    {
                                        filesToSite.Add(item.Value);
                                    }
                                }
                                DirectoryUtility.ChangeToSubSite(PublishmentSystemInfo, PublishmentSystemDir.Text, filesToSite);
                                isChanged = true;
                            }
                        }
                    }
                    else
                    {
                        DirectoryUtility.ChangeToHeadquarters(PublishmentSystemInfo, TranslateUtils.ToBool(IsMoveFiles.SelectedValue));

                        isChanged = true;
                    }
                }
                catch (Exception ex)
                {
                    PageUtils.RedirectToErrorPage($"修改失败:{ex.Message}");
                    return;
                }
            }

            if (isChanged)
            {
                Body.AddAdminLog(_isHeadquarters ? "转移到子目录" : "转移到根目录",
                                 $"站点:{PublishmentSystemInfo.PublishmentSystemName}");
                PageUtils.CloseModalPage(Page);
            }
        }
Beispiel #29
0
        private int Validate_PublishmentSystemInfo(out string errorMessage)
        {
            try
            {
                var isHq = TranslateUtils.ToBool(IsHeadquarters.SelectedValue); // 是否主站
                var parentPublishmentSystemId = 0;
                var publishmentSystemDir      = string.Empty;

                if (isHq == false)
                {
                    if (DirectoryUtils.IsSystemDirectory(PublishmentSystemDir.Text))
                    {
                        errorMessage = "文件夹名称不能为系统文件夹名称!";
                        return(0);
                    }

                    parentPublishmentSystemId = TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue);
                    publishmentSystemDir      = PublishmentSystemDir.Text;

                    var list = DataProvider.NodeDao.GetLowerSystemDirList(parentPublishmentSystemId);
                    if (list.IndexOf(publishmentSystemDir.ToLower()) != -1)
                    {
                        errorMessage = "已存在相同的发布路径!";
                        return(0);
                    }

                    if (!DirectoryUtils.IsDirectoryNameCompliant(publishmentSystemDir))
                    {
                        errorMessage = "文件夹名称不符合系统要求!";
                        return(0);
                    }
                }

                var nodeInfo = new NodeInfo();

                nodeInfo.NodeName       = nodeInfo.NodeIndexName = "首页";
                nodeInfo.NodeType       = ENodeType.BackgroundPublishNode;
                nodeInfo.ContentModelId = EContentModelTypeUtils.GetValue(EContentModelTypeUtils.GetEnumTypeByPublishmentSystemType(_publishmentSystemType));

                var publishmentSystemUrl = PageUtils.Combine(WebConfigUtils.ApplicationPath, publishmentSystemDir);

                var psInfo = BaseTable.GetDefaultPublishmentSystemInfo(PageUtils.FilterXss(PublishmentSystemName.Text), _publishmentSystemType, AuxiliaryTableForContent.SelectedValue, AuxiliaryTableForGovPublic.SelectedValue, AuxiliaryTableForGovInteract.SelectedValue, AuxiliaryTableForVote.SelectedValue, AuxiliaryTableForJob.SelectedValue, publishmentSystemDir, publishmentSystemUrl, parentPublishmentSystemId);

                if (psInfo.ParentPublishmentSystemId > 0)
                {
                    var parentPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(psInfo.ParentPublishmentSystemId);
                    psInfo.PublishmentSystemUrl = PageUtils.Combine(parentPublishmentSystemInfo.PublishmentSystemUrl, psInfo.PublishmentSystemDir);
                }

                psInfo.IsHeadquarters = isHq;

                psInfo.Additional.Charset     = Charset.SelectedValue;
                psInfo.IsCheckContentUseLevel = TranslateUtils.ToBool(IsCheckContentUseLevel.SelectedValue);
                if (psInfo.IsCheckContentUseLevel)
                {
                    psInfo.CheckContentLevel = TranslateUtils.ToInt(CheckContentLevel.SelectedValue);
                }

                var thePublishmentSystemId = DataProvider.NodeDao.InsertPublishmentSystemInfo(nodeInfo, psInfo, Body.AdministratorName);

                if (_permissions.IsSystemAdministrator && !_permissions.IsConsoleAdministrator)
                {
                    var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList ?? new List <int>();
                    publishmentSystemIdList.Add(thePublishmentSystemId);
                    BaiRongDataProvider.AdministratorDao.UpdatePublishmentSystemIdCollection(Body.AdministratorName, TranslateUtils.ObjectCollectionToString(publishmentSystemIdList));
                }

                Body.AddAdminLog($"新建{EPublishmentSystemTypeUtils.GetText(_publishmentSystemType)}站点", $"站点名称:{PageUtils.FilterXss(PublishmentSystemName.Text)}");

                //if (isHQ == EBoolean.False)
                //{
                //    string configFilePath = PathUtility.MapPath(psInfo, "@/web.config");
                //    if (FileUtils.IsFileExists(configFilePath))
                //    {
                //        FileUtility.UpdateWebConfig(configFilePath, psInfo.Additional.Charset);
                //    }
                //    else
                //    {
                //        FileUtility.CreateWebConfig(configFilePath, psInfo.Additional.Charset);
                //    }
                //}
                errorMessage = string.Empty;
                return(thePublishmentSystemId);
            }
            catch (Exception e)
            {
                errorMessage = e.Message;
                return(0);
            }
        }
Beispiel #30
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                if (string.IsNullOrEmpty(userName))
                {
                    var adminInfo = new AdministratorInfo
                    {
                        UserName        = tbUserName.Text.Trim(),
                        Password        = tbPassword.Text,
                        CreatorUserName = Body.AdministratorName,
                        DisplayName     = tbDisplayName.Text,
                        Email           = tbEmail.Text,
                        Mobile          = tbMobile.Text,
                        DepartmentId    = TranslateUtils.ToInt(ddlDepartmentID.SelectedValue),
                        AreaId          = TranslateUtils.ToInt(ddlAreaID.SelectedValue)
                    };

                    if (!string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByEmail(tbEmail.Text)))
                    {
                        FailMessage("管理员添加失败,邮箱地址已存在");
                        return;
                    }

                    if (!string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByMobile(tbMobile.Text)))
                    {
                        FailMessage("管理员添加失败,手机号码已存在");
                        return;
                    }

                    string errorMessage;
                    if (!AdminManager.CreateAdministrator(adminInfo, out errorMessage))
                    {
                        FailMessage($"管理员添加失败:{errorMessage}");
                        return;
                    }

                    Body.AddAdminLog("添加管理员", $"管理员:{tbUserName.Text.Trim()}");
                    SuccessMessage("管理员添加成功!");
                    AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl(TranslateUtils.ToInt(ddlDepartmentID.SelectedValue)));
                }
                else
                {
                    var adminInfo = BaiRongDataProvider.AdministratorDao.GetByUserName(userName);

                    if (adminInfo.Email != tbEmail.Text && !string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByEmail(tbEmail.Text)))
                    {
                        FailMessage("管理员设置失败,邮箱地址已存在");
                        return;
                    }

                    if (adminInfo.Mobile != tbMobile.Text && !string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByMobile(adminInfo.Mobile)))
                    {
                        FailMessage("管理员设置失败,手机号码已存在");
                        return;
                    }

                    adminInfo.DisplayName  = tbDisplayName.Text;
                    adminInfo.Email        = tbEmail.Text;
                    adminInfo.Mobile       = tbMobile.Text;
                    adminInfo.DepartmentId = TranslateUtils.ToInt(ddlDepartmentID.SelectedValue);
                    adminInfo.AreaId       = TranslateUtils.ToInt(ddlAreaID.SelectedValue);

                    BaiRongDataProvider.AdministratorDao.Update(adminInfo);

                    Body.AddAdminLog("修改管理员属性", $"管理员:{tbUserName.Text.Trim()}");
                    SuccessMessage("管理员设置成功!");
                    AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl(TranslateUtils.ToInt(ddlDepartmentID.SelectedValue)));
                }
            }
        }