Пример #1
0
        /// <summary>
        /// 设置或者删除K_SysModuleNode记录
        /// </summary>
        /// <param name="tranType">操作参数:DEL=删除,PUB=发布,TOP=置顶,NEW=置新,HOT=热,COMMEND=推荐</param>
        /// <param name="setValue">设置值</param>
        /// <param name="IDList">ID集合,多个用“,”分隔</param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string ModuleNodeSet(string tranType, string setValue, string IDList)
        {
            string re = dal.ModuleNodeSet(tranType, setValue, IDList);

            //更新缓存
            AppCache.Remove("ModeNodeAndModuleCache");
            GetModeNodeFromCache();

            AppCache.Remove("PublishNodeCache");
            AppCache.Remove("SiteMenuNodeCache");
            Publish_GetNodeFromCache();

            return(re);
        }
Пример #2
0
        /// <summary>
        /// 增、改K_SysModuleNode表

        /// </summary>
        /// <param name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param name="AutModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string trantype, KingTop.Model.SysManage.ModuleNode ModuleNodeModel)
        {
            string re = dal.Save(trantype, ModuleNodeModel);

            //更新缓存
            AppCache.Remove("ModeNodeAndModuleCache");
            GetModeNodeFromCache();

            AppCache.Remove("PublishNodeCache");
            AppCache.Remove("SiteMenuNodeCache");
            Publish_GetNodeFromCache();

            return(re);
        }
Пример #3
0
        public string MenuUnite(string fromMenu, string toMenu)
        {
            string re = dal.MenuUnite(fromMenu, toMenu);

            //更新缓存
            AppCache.Remove("ModeNodeAndModuleCache");
            GetModeNodeFromCache();

            AppCache.Remove("PublishNodeCache");
            AppCache.Remove("SiteMenuNodeCache");
            Publish_GetNodeFromCache();

            return(re);
        }
Пример #4
0
        public DataTable SetCategoryCache()
        {
            DataTable dt = null;

            AppCache.Remove("CATEGORYCACHE");
            string sSql = string.Format("select * from K_Category where IsDel=0");

            dt = InfoHelper.ExecuteSQL(sSql);
            if (dt != null && dt.Rows.Count > 0)
            {
                AppCache.Add("CATEGORYCACHE", dt);
            }
            return(dt);
        }
Пример #5
0
        public static void Remove(string key, bool async = true)
        {
            AppCache.Remove(key);

            if (async)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(1);
                    RedisCache.Remove(key);
                });
            }
            else
            {
                RedisCache.Remove(key);
            }
        }
Пример #6
0
        protected void SaveRightDate(string strNodeID)
        {
            //得到操作列表
            KingTop.BLL.SysManage.ActionPermit bllActionPer = new ActionPermit();
            DataTable dt2 = bllActionPer.GetList("MODULE", Utils.getOneParams(ddlModel.SelectedValue));

            if (AppCache.IsExist("ModuleActionCache"))
            {
                AppCache.Remove("ModuleActionCache");
            }

            //if (AppCache.IsExist("ModeNodeAndModuleCache"))
            //{
            //    AppCache.Remove("ModeNodeAndModuleCache");
            //}

            if (AppCache.IsExist("UserGroupPermitCache"))
            {
                AppCache.Remove("UserGroupPermitCache");
            }

            for (int i = 0; i < grvRight.Rows.Count; i++)
            {
                ArrayList arrRightSet = new ArrayList();
                foreach (DataRow dr in dt2.Rows)
                {
                    string   ckbid = "ckb" + dr["ID"].ToString();
                    CheckBox ckb   = (CheckBox)grvRight.Rows[i].FindControl(ckbid);
                    if (ckb.Checked && ckb.Enabled == true)
                    {
                        arrRightSet.Add(dr["ID"].ToString());
                    }
                }
                //更新权限
                if (arrRightSet.Count > 0)
                {
                    ColumnRightTool coluRightTool    = new ColumnRightTool();
                    string          strUserGroupCode = grvRight.Rows[i].Cells[0].Text;
                    coluRightTool.SaveData(strUserGroupCode, arrRightSet, strNodeID);
                }
            }
        }
Пример #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            strTemplateID = this.hiddenTemplateID.Value;
            string        returnMsg       = string.Empty;
            string        strSiteID       = string.Empty;
            string        strUserGropCode = string.Empty;
            string        siteDir         = txtDir.Text.ToString().ToLower().Trim();
            StringBuilder sbsql           = new StringBuilder();

            #region 保存站点信息
            //得到站点设置
            if (Directory.Exists(Server.MapPath("/" + siteDir)) || siteDir == "main")
            {
                Utils.RunJavaScript(this, "alert({msg:'保存站点失败:文件夹名称已存在,请重新填写文件夹名称!',title:'提示信息'})");
                return;
            }
            if (chkIsDomain.Checked && txtSiteURL.Text.Trim() == "")
            {
                Utils.RunJavaScript(this, "alert({msg:'保存站点失败:网站域名必须填写!',title:'提示信息'})");
                return;
            }

            try
            {
                //在根目录下建立站点文件夹
                Directory.CreateDirectory(Server.MapPath("/" + siteDir));
            }
            catch (Exception ex)
            {
                Utils.RunJavaScript(this, "alert({msg:'保存站点失败:" + ex.Message.Replace("'", "\'").Replace("\r\n", "<br>").Replace("\r", "<br>") + "',title:'提示信息'})");
                return;
            }

            mode.SiteName   = Utils.HtmlDecode(txtSiteName.Text.ToString());
            mode.Directory  = Utils.HtmlDecode(siteDir);
            mode.IsMainSite = rdoMain.Checked ? true : false;

            StringBuilder sb = new StringBuilder();
            sb.Append("TemlateID=").Append(strTemplateID);//模板ID
            //if (ddlSiteCode.SelectedValue != "0")
            //{
            //    sb.Append("&CharSet=").Append(ddlSiteCode.SelectedValue);//站点编码
            //}
            if (chkIsImportNode.Checked)
            {
                sb.Append("&IsImprotNode=").Append("True");//是否导入节点信息
            }
            else
            {
                sb.Append("&IsImprotNode=").Append("False");
            }
            //if (chkImportFormStyle.Checked)
            //{
            //    sb.Append("&IsImportFormStyle=").Append("True");//是否导入表单样式
            //}
            //else
            //{
            sb.Append("&IsImportFormStyle=").Append("False");
            //}
            if (chkIsDomain.Checked)
            {
                mode.SiteUrl = Utils.HtmlDecode(txtSiteURL.Text.ToString());
                sb.Append("&IsDomain=").Append("True");
            }
            else
            {
                mode.SiteUrl = "";
                sb.Append("&IsDomain=").Append("False");
            }
            mode.SettingsXML = sb.ToString();

            if (!SetSiteXML(siteDir))
            {
                return;
            }

            //保存站点设置
            strSiteID = bll.Save("NEW", mode);
            if (strSiteID.IndexOf("Error") != -1)
            {
                Utils.RunJavaScript(this, "alert({msg:'保存站点失败:" + strSiteID.Replace("'", "\'").Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("Error:", "") + "',title:'提示信息'})");
                DeleteDir(Server.MapPath("/" + siteDir));
                return;
            }
            //判断SiteID是否有值
            UpdateSiteId(siteDir, strSiteID);
            int intSiteid = Utils.ParseInt(strSiteID, 0);
            #endregion

            #region 新增一个用户组(strSiteID+"站点管理员"),该用户组属于站点管理员角色

            KingTop.BLL.SysManage.UserGroup   UserGropBll  = new UserGroup();
            KingTop.Model.SysManage.UserGroup UserGropMode = new KingTop.Model.SysManage.UserGroup();
            UserGropMode.UserGroupCode  = Guid.NewGuid();
            UserGropMode.UserGroupName  = strSiteID + "站点管理员";
            UserGropMode.SiteID         = intSiteid;
            UserGropMode.IsParent       = true;
            UserGropMode.NumCode        = UserGropBll.GetList("GETMAXPNUMCODE", Utils.getOneParams("0")).Tables[0].Rows[0]["MaxCode"].ToString();
            UserGropMode.ParentNumCode  = "0";
            UserGropMode.UserGroupOrder = 0;
            UserGropMode.InputDate      = System.DateTime.Now;
            try
            {
                UserGropBll.Save("new", UserGropMode);
            }
            catch { }
            strUserGropCode = UserGropMode.UserGroupCode.ToString();
            #endregion

            #region 导入栏目节点设置  导入用户组权限
            //根据strTemplateID得到该模板下所有栏目

            KingTop.BLL.SysManage.WebSiteTemplateNode   bllTmpNode  = new WebSiteTemplateNode();
            KingTop.Model.SysManage.WebSiteTemplateNode modeTmpNode = new KingTop.Model.SysManage.WebSiteTemplateNode();
            KingTop.BLL.SysManage.ModuleNode            bllModeNode = new ModuleNode();
            KingTop.Model.SysManage.ModuleNode          modeNode    = new KingTop.Model.SysManage.ModuleNode();
            DataTable dtTmpNode = bllTmpNode.GetList("WEBSITE", Utils.getOneParams(strTemplateID));
            if (dtTmpNode.Rows.Count > 0)
            {
                //当前ModelNode的最大NodeCode
                string strMaxNodeCode = string.Empty;
                //MaxNodeCode和100的差量

                int       intSubNodeCode = 0;
                DataTable dtNodeCode     = bllModeNode.GetList("MAXCODE", Utils.getOneParams("0"));
                if (dtNodeCode != null && dtNodeCode.Rows.Count == 1)
                {
                    strMaxNodeCode = dtNodeCode.Rows[0]["NodeCode"].ToString();
                }

                try
                {
                    intSubNodeCode = Convert.ToInt32(strMaxNodeCode) - 100 + 1;
                }
                catch { throw new Exception("获取当前最大节点数失败!"); }
                foreach (DataRow dr in dtTmpNode.Rows)
                {
                    modeNode.WebSiteID           = intSiteid;
                    modeNode.NodeID              = Guid.NewGuid();
                    modeNode.NodeCode            = dr["NodeCode"].ToString();
                    modeNode.NodeName            = dr["NodeName"].ToString();
                    modeNode.NodeType            = dr["NodeType"].ToString();
                    modeNode.LinkURL             = dr["LinkURL"].ToString();
                    modeNode.ParentNode          = dr["ParentNode"].ToString();
                    modeNode.IsValid             = Utils.ParseBool(dr["IsValid"].ToString());
                    modeNode.ModuleID            = new Guid(dr["ModuleID"].ToString());
                    modeNode.NodelOrder          = dr["NodelOrder"].ToString();
                    modeNode.NodelDesc           = dr["NodelDesc"].ToString();
                    modeNode.NodelEngDesc        = dr["NodelEngDesc"].ToString();
                    modeNode.IsSystem            = Utils.ParseBool(dr["IsSystem"].ToString());
                    modeNode.IsWeb               = Utils.ParseBool(dr["IsWeb"].ToString());
                    modeNode.ReviewFlowID        = dr["ReviewFlowID"].ToString();
                    modeNode.IsContainWebContent = Utils.ParseBool(dr["IsContainWebContent"].ToString());
                    modeNode.IsLeftDisplay       = Utils.ParseBool(dr["IsLeftDisplay"].ToString());

                    //NodeCode唯一
                    if (modeNode.NodeCode.Length > 3)
                    {
                        modeNode.NodeCode = (Utils.ParseInt(modeNode.NodeCode.Substring(0, 3), 0) + intSubNodeCode).ToString() + modeNode.NodeCode.Substring(3, modeNode.NodeCode.Length - 3);
                    }
                    else
                    {
                        modeNode.NodeCode = (Utils.ParseInt(modeNode.NodeCode.Substring(0, 3), 0) + intSubNodeCode).ToString();
                    }
                    if (modeNode.ParentNode != "0")
                    {
                        if (modeNode.ParentNode.Length > 3)
                        {
                            modeNode.ParentNode = (Utils.ParseInt(modeNode.ParentNode.Substring(0, 3), 0) + intSubNodeCode).ToString() + modeNode.ParentNode.Substring(3, modeNode.ParentNode.Length - 3);
                        }
                        else
                        {
                            modeNode.ParentNode = (Utils.ParseInt(modeNode.ParentNode.Substring(0, 3), 0) + intSubNodeCode).ToString();
                        }
                    }

                    //插入ModeNode表sql
                    sbsql.Append(GetInsertModeNodeSql(modeNode));
                    //得到插入用户组权限表的sql(根据modeNode.NodeID)
                    sbsql.Append(GetInsertUserGroupPermitSql(strUserGropCode, dr["ID"].ToString(), modeNode.NodeID.ToString()));
                }
            }
            //执行生成的sql
            try
            {
                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, sbsql.ToString());
            }
            catch (System.Exception exp)
            {
                throw new Exception(exp.Message);
            }
            #endregion

            #region 最后把生成的站点赋给当前账户

            //admin拥有所有站点的所有权限,不用新增数据
            if (GetLoginAccountId().ToString() != "0")
            {
                KingTop.BLL.SysManage.AccountSite   AccountSiteBll   = new AccountSite();
                KingTop.Model.SysManage.AccountSite AccountSiteModel = new KingTop.Model.SysManage.AccountSite();
                AccountSiteModel.UserID  = Utils.ParseInt(base.GetLoginAccountId().ToString(), 0);
                AccountSiteModel.SiteID  = intSiteid;
                AccountSiteModel.IsValid = true;
                try
                {
                    AccountSiteBll.Save("new", AccountSiteModel);
                }
                catch (System.Exception exp)
                {
                    throw new Exception(exp.Message);
                }
            }
            #endregion

            #region 最后把用户填的账户插入账户表并把生成的用户组赋给该账户(这里直接给当前登陆账户赋该网站管理员用户组)
            //admin拥有所有站点的所有权限,不用新增数据
            if (GetLoginAccountId().ToString() != "0")
            {
                KingTop.BLL.SysManage.UserRole   UserRoleBll   = new UserRole();
                KingTop.Model.SysManage.UserRole UserRoleModel = new KingTop.Model.SysManage.UserRole();
                UserRoleModel.UserGroupCode = new Guid(strUserGropCode);
                UserRoleModel.UserId        = base.GetLoginAccountId();
                try
                {
                    UserRoleBll.Save("new", UserRoleModel);
                }
                catch (System.Exception exp)
                {
                    throw new Exception(exp.Message);
                }
            }


            //更新栏目缓存

            AppCache.Remove("ModeNodeAndModuleCache");
            ModuleNode objmodulenode = new ModuleNode();
            objmodulenode.GetModeNodeFromCache();

            AppCache.Remove("PublishNodeCache");
            objmodulenode.Publish_GetNodeFromCache();
            #region 创建一个系统默认的方案

            //创建默认方案
            bllProject.CreateDefaultProject(mode.Directory, NodeCode, modeNode.WebSiteID);
            #endregion

            #endregion

            #region 导入栏目
            string[] parSite = ddlSiteTemplate.SelectedValue.Split('|');
            returnMsg = InsertSiteMenu(parSite[0], intSiteid.ToString(), siteDir, parSite[1]);
            #endregion

            #region  制文件
            bool IsMenu = false;
            if (string.IsNullOrEmpty(returnMsg))
            {
                IsMenu    = true;
                returnMsg = CopySiteFile(Server.MapPath("/" + parSite[1]), Server.MapPath("/" + siteDir), parSite[1], siteDir);
            }
            else
            {
                returnMsg += "<br>" + CopySiteFile(Server.MapPath("/" + parSite[1]), Server.MapPath("/" + siteDir), parSite[1], siteDir);
            }
            #endregion

            if (chkIsImportNode.Checked && IsMenu)
            {
                Response.Redirect("NewWebSetMenuEdit.aspx?NodeCode=" + NodeCode + "&parentNodeCode=" + RootNodeCode);
            }
            else
            {
                Utils.RunJavaScript(this, "alert({msg:'" + returnMsg + "',title:'提示信息'});NewSiteName='" + mode.SiteName.Replace("'", "\\'") + "';NewSiteID=" + modeNode.WebSiteID);
            }
        }
Пример #8
0
    private void On_Upload(HttpPostedFile file)
    {
        if (file != null && file.ContentLength > 0)
        {
            #region 变量

            strParam    = Request.QueryString["InitParam"];
            initArr     = Utils.strSplit(strParam, "_tp_");
            SiteDir     = GetUrlParam("SiteDir", initArr);
            SaveFileKey = GetUrlParam("CacheKey", initArr);

            string   ImgSet    = GetUrlParam("ImgSet", initArr);
            string[] arrImgSet = ImgSet.Split(',');
            thumbWidth  = Utils.ParseInt(arrImgSet[0], 0);
            thumbHeight = Utils.ParseInt(arrImgSet[1], 0);
            IsWater     = Utils.ParseInt(arrImgSet[2], 0);
            string UPType = GetUrlParam("UpType", initArr);
            if (string.IsNullOrEmpty(UPType))
            {
                UPType = "image";
            }

            string saveType = GetUrlParam("SaveType", initArr);         // 保存文件名类型,1=用上传文件名保存,否则用系统时间重命名保存

            string noExt = SystemConst.NOT_ALLOWED_UPLOAD_TYPE;         // 不允许上传类型

            string fileName = string.Empty;                             // 文件名

            string saveName = DateTime.Now.ToString("yyyyMMddHHmmss");  // 上传文件名

            string fileExt = string.Empty;                              // 上传文件扩展名

            fileName = Path.GetFileName(file.FileName);
            fileExt  = Path.GetExtension(fileName).ToLower(); //上传文件扩展名
            #endregion
            if (noExt.IndexOf(fileExt) != -1)
            {
                System.Web.HttpContext.Current.Response.Write("改文件类型不允许上传!");
                System.Web.HttpContext.Current.Response.End();
            }

            SavePath = string.IsNullOrEmpty(SiteDir) == true ? uploadobj.ImageSavePath + "/" + UPType + "s" : uploadobj.ImageSavePath + "/" + SiteDir + "/" + UPType + "s";
            URL      = GetUploadUrl(uploadobj.ImageUrl, UPType + "s", SavePath);
            string reFilePath = URL;         // 返回文件路径,如果保存路径填写的是
            if (SavePath.IndexOf(":") == -1) //判断输入的是虚拟路径
            {
                SavePath = Server.MapPath(GetVirtualPath + SavePath);
            }



            SavePath = SavePath + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/";
            if (!Directory.Exists(SavePath))
            {
                Directory.CreateDirectory(SavePath);
            }

            if (saveType == "1")  //使用原文件名进行保存到服务器
            {
                int fileNameLength = fileName.LastIndexOf(".");
                saveName = fileName.Substring(0, fileNameLength);
            }

            fileName = SavePath + saveName + fileExt;
            URL      = DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + saveName + fileExt;
            if (File.Exists(fileName) && saveType == "1")
            {
                File.Delete(fileName);
            }

            try
            {
                file.SaveAs(fileName);                 //保存至服务器

                if (thumbWidth > 0 || thumbHeight > 0) //判断是否上传的是否需生成缩略图
                {
                    string thumbMode = "HW";
                    if (thumbWidth > 0 && thumbHeight == 0)
                    {
                        thumbMode = "W";
                    }
                    else if (thumbWidth == 0 && thumbHeight > 0)
                    {
                        thumbMode = "H";
                    }
                    KingTop.WEB.SysAdmin.UploadBase.MakeThumbnail(fileName, fileName + ".gif", thumbWidth, thumbHeight, thumbMode);     // 生成缩略图方法
                }

                if (IsWater == 1)  //如果上传图片,则判断是否需要打水印
                {
                    KingTop.WEB.SysAdmin.UploadBase.ImageWater(uploadobj, fileName);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            //缓存返回值
            string returnStr;
            if (AppCache.IsExist(SaveFileKey))
            {
                returnStr = AppCache.Get(SaveFileKey) + "," + URL;
                AppCache.Remove(SaveFileKey);
            }
            else
            {
                returnStr = URL;
            }

            AppCache.AddCache(SaveFileKey, returnStr, 1200);
        }
    }
Пример #9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsHaveRightByOperCode("Edit"))
            {
                string siteLoginXml = Server.MapPath("/sysadmin/Configuraion/SiteInfoManage.config");
                if (isMainDomain)
                {
                    if (this.RadTrue.Checked)
                    {
                        if (this.txtManageCode.Text.Trim() == "")
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点参数设置失败,后台管理认证码必须填写!',title:'提示信息'})");
                            return;
                        }
                        if (!Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/IsEnableManageCode", "", "1"))
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点参数设置失败,配置文件“" + siteLoginXml + "”位置不对或者没有修改权限!',title:'提示信息'})");
                            return;
                        }
                        Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/ManageCode", "", this.txtManageCode.Text);
                    }
                    else
                    {
                        Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/IsEnableManageCode", "", "0");
                    }
                    Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/ManageDir", "", this.txtManageDir.Text);
                    AppCache.Remove("CacheManageDir");
                    AppCache.AddCache("CacheManageDir", this.txtManageDir.Text, 144000);
                }
                string thisDwManage = Server.HtmlEncode(txtSiteDWMange.Text.Trim());
                if (string.IsNullOrEmpty(thisDwManage))
                {
                    thisDwManage = "360hqb";
                }
                thisDwManage = thisDwManage.Replace(",", "");

                //修改DW校验码
                string siteDwManage     = Utils.XmlRead(siteLoginXml, "SiteInfoManage/SiteDWMange", "");
                string siteDwManageList = string.Empty;
                bool   isEditDwManage   = false;
                if (!string.IsNullOrEmpty(siteDwManage))
                {
                    string[] arr1 = siteDwManage.Split('|');
                    for (int i = 0; i < arr1.Length; i++)
                    {
                        string[] arr2 = arr1[i].Split(',');
                        if (SiteID == Utils.ParseInt(arr2[0], 0))
                        {
                            string tmpDwManage = arr2[0] + "," + arr2[1] + "," + thisDwManage;

                            if (string.IsNullOrEmpty(siteDwManageList))
                            {
                                siteDwManageList = tmpDwManage;
                            }
                            else
                            {
                                siteDwManageList += "|" + tmpDwManage;
                            }
                            isEditDwManage = true;
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(siteDwManageList))
                            {
                                siteDwManageList = arr1[i];
                            }
                            else
                            {
                                siteDwManageList += "|" + arr1[i];
                            }
                        }
                    }
                }

                if (string.IsNullOrEmpty(siteDwManage) || isEditDwManage == false)
                {
                    string siteInfoXml = Server.MapPath("/" + SiteDir + "/config/SiteInfo.config");

                    if (!string.IsNullOrEmpty(siteDwManage))
                    {
                        siteDwManageList += "|" + SiteID + "," + Utils.XmlRead(siteInfoXml, "SiteInfoConfig/SiteName", "") + "," + thisDwManage;
                    }
                    else
                    {
                        siteDwManageList = SiteID + "," + Utils.XmlRead(siteInfoXml, "SiteInfoConfig/SiteName", "") + "," + thisDwManage;
                    }
                }
                Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/SiteDWMange", "", siteDwManageList);

                string siteOldDir = hidSiteDir.Value.ToLower().Trim();
                string siteNewDir = "";
                M_SiteParamConfig.SiteRootURL = this.txtSiteRootURL.Text;
                M_SiteParamConfig.SiteDir     = siteNewDir;
                //M_SiteParamConfig.SiteTempletDir = this.txtSiteTempletDir.Text;
                M_SiteParamConfig.SiteDomain = this.txtSiteDomain.Text;
                //M_SiteParamConfig.DisUserName = this.txtDisUserName.Text;
                M_SiteParamConfig.EditControl   = this.ddlEditControl.SelectedValue;
                M_SiteParamConfig.LogType       = this.ddlLogType.SelectedValue;
                M_SiteParamConfig.CreateFileExt = Request.Form["selCreateFileExt"];
                SiteParam.ConfigInfo            = M_SiteParamConfig;
                string publishType = Request.Form["radPublishType"];
                M_SiteParamConfig.PublishType = publishType;

                if (isMainDomain)  //如果是主站,则可以修改文件生成目录(为空或者main)
                {
                    if (radMainSiteDir1.Checked)
                    {
                        siteNewDir = "main";
                    }
                    if (siteOldDir != siteNewDir)  //修改了生成目录
                    {
                        try
                        {
                            if (siteNewDir == "main")                                                          //生成在main目录中
                            {
                                if (!Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main")))         //判断是否有main目录
                                {
                                    Directory.CreateDirectory(Server.MapPath("~/" + GetVirtualPath + "main")); //创建main目录
                                }
                                else if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/config")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/config"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "config"), Server.MapPath("~/" + GetVirtualPath + "main/config"));  //将配置文件移动到main目录

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/Plus")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/Plus"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "Plus"), Server.MapPath("~/" + GetVirtualPath + "main/Plus"));

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "IncludeFile"), Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"));

                                PhyFilePath = HttpContext.Current.Server.MapPath("~/" + GetVirtualPath + "main/config/SiteParam.config");

                                //File.Copy(Server.MapPath("~/" + GetVirtualPath + "web.config"), Server.MapPath("~/" + GetVirtualPath + "main/web.config"), true);  //拷贝web.config到main目录
                            }
                            else if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/config")))  //生成在根目录中,判断有没有有main/config/目录
                            {
                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "config")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "config"), true);
                                }

                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/config"), Server.MapPath("~/" + GetVirtualPath + "config"));  //移动main中的配置文件到根目录

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "Plus")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "Plus"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/Plus"), Server.MapPath("~/" + GetVirtualPath + "Plus"));

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "IncludeFile")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "IncludeFile"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"), Server.MapPath("~/" + GetVirtualPath + "IncludeFile"));

                                PhyFilePath = HttpContext.Current.Server.MapPath("~/" + GetVirtualPath + "config/SiteParam.config");
                            }

                            //更新数据库中的Directory值
                            KingTop.BLL.SysManage.SysWebSite siteBll = new SysWebSite();
                            siteBll.SysWebSiteSet("EDITDIR", SiteID.ToString(), siteNewDir);
                            Session["SiteDir"] = siteNewDir;
                        }
                        catch
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点信息设置失败!',status: '2', title: '提示信息', time: 10000, width: 400})");
                            return;
                        }
                    }
                }
                bool b = SiteParam.SaveConfig(PhyFilePath);
                KingTop.WEB.BasePage.PublishType = publishType;

                //Utils.XmlUpdate(PhyFilePath, "SiteParamConfig/PublishType", "", publishType);
                if (!b)
                {
                    Utils.RunJavaScript(this, "alert({msg:'站点信息设置失败," + PhyFilePath.Replace("\\", "\\\\") + "文件没有修改权限!',status: '2', title: '提示信息', time: 10000, width: 400})");
                    return;
                }
                WriteLog("站点参数设置成功!", "", 2);
                Utils.RunJavaScript(this, "alert({msg:'站点参数设置成功!',title:'提示信息'})");
            }
            else
            {
                Utils.RunJavaScript(this, "alert({msg:'你没有修改站点参数设置的权限,请联系站点管理员!',title:'提示信息'})");
            }
        }
Пример #10
0
 public void Remove(string key)
 {
     AppCache.Remove(key);
 }
Пример #11
0
 public static void Remove(string key)
 {
     RedisCache.Remove(key);
     AppCache.Remove(key);
 }