Ejemplo n.º 1
0
        private M_Design_Page GetScenceMod()
        {
            M_Design_Page seMod = null;
            int           TlpID = DataConvert.CLng(Request.QueryString["TlpID"]);
            string        Mid   = Request.QueryString["ID"] ?? "";

            if (Sid > 0)
            {
                seMod = pageBll.SelReturnModel(Sid);
            }
            else if (TlpID > 0)
            {
                seMod = pageBll.SelModelByTlp(TlpID);
            }
            else if (!string.IsNullOrEmpty(Mid))
            {
                seMod = pageBll.SelModelByGuid(Mid);
            }
            //场景不存在或处理回收站状态
            if (seMod == null || seMod.ID < 1 || seMod.Status == (int)ZLEnum.ConStatus.Recycle)
            {
                M_Design_Tlp tlpMod = tlpBll.SelModelByDef("404");
                if (tlpMod == null)
                {
                    function.WriteErrMsg("404模板不存在");
                }
                seMod = pageBll.SelModelByTlp(tlpMod.ID);
                if (seMod == null)
                {
                    function.WriteErrMsg("404场景不存在");
                }
            }
            return(seMod);
        }
Ejemplo n.º 2
0
        protected void save_btn_Click(object sender, EventArgs e)
        {
            M_UserInfo    mu     = buser.GetLogin();
            M_Design_Tlp  tlpMod = tlpBll.SelModelByDef("mbh5_fast");
            M_Design_Page seMod  = null;

            if (tlpMod == null)
            {
                function.WriteErrMsg("模板不存在");
            }
            seMod = seBll.SelModelByTlp(tlpMod.ID);
            if (seMod == null)
            {
                function.WriteErrMsg("场景模板不存在");
            }
            string[] imgs = imgs_hid.Value.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (imgs.Length < 1)
            {
                function.WriteErrMsg("未指定图片");
            }
            //-----------开始替换
            string holder = "/images/nopic.gif";

            seMod.TlpID    = 0;
            seMod.ID       = 0;
            seMod.guid     = "";
            seMod.CDate    = DateTime.Now;
            seMod.UPDate   = DateTime.Now;
            seMod.UserID   = mu.UserID;
            seMod.UserName = mu.UserName;
            for (int i = 0; seMod.comp.Contains(holder); i++)
            {
                int start = seMod.comp.IndexOf(holder);
                seMod.comp = seMod.comp.Remove(start, holder.Length);
                seMod.comp = seMod.comp.Insert(start, imgs[i % imgs.Length]);
            }
            seMod.ID = seBll.Insert(seMod);
            if (IsPC)
            {
                function.Script(this, "top.CloseDiag();top.location.href='/Design/H5/Default.aspx?id=" + seMod.guid + "';");
            }
            else
            {
                Response.Redirect("default.aspx?id=" + seMod.guid);
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            B_User.CheckIsLogged(Request.RawUrl);
            M_UserInfo   mu     = buser.GetLogin(false);
            M_Design_Tlp tlpMod = null;

            if (TlpID == -1)
            {
                tlpMod = tlpBll.SelModelByDef(0);
            }
            else
            {
                tlpBll.SelReturnModel(TlpID);
            }
            if (tlpMod == null)
            {
                function.WriteErrMsg("模板不存在");
            }
            //为其注册二级域名
            string           domain    = domainBll.GetNewDomain(mu.UserID.ToString());
            M_IDC_DomainList domainMod = new M_IDC_DomainList();

            domainMod.SType    = 2;
            domainMod.MyStatus = 1;
            domainMod.UserID   = mu.UserID.ToString();
            domainMod.DomName  = domain;
            domainMod.ID       = domainBll.Insert(domainMod);
            //else if (domainMod.UserID == mu.UserID.ToString()) { }//以前注册过,不需要做特殊处理
            //else if (domainMod.UserID != mu.UserID.ToString()) { function.WriteErrMsg("该域名已被占用"); }
            //生成站点信息(用户只能拥有一个站点)
            M_Design_SiteInfo sfMod = sfBll.SelModelByUid(mu.UserID);

            if (sfMod != null)
            {
                mu.SiteID = sfMod.ID;
                if (mu.SiteID < 1)
                {
                    DBCenter.UpdateSQL("ZL_User", "SiteID=" + mu.SiteID, "UserID=" + mu.UserID);
                }
                //function.WriteSuccessMsg("你已经创建站点了,将自动转至用户中心", "/design/user/default.aspx");
            }
            else
            {
                sfMod = new M_Design_SiteInfo();
            }
            //M_Design_SiteInfo sfMod = new M_Design_SiteInfo();
            sfMod.SiteFlag = function.GetRandomString(8).ToLower();
            sfMod.UserID   = mu.UserID.ToString();
            sfMod.UserName = mu.UserName;
            sfMod.ZStatus  = 1;
            sfMod.SiteName = mu.UserName + "的站点";
            sfMod.DomainID = domainMod.ID;
            sfMod.ID       = sfBll.Insert(sfMod);
            //拷贝站点文件
            string tlpdir  = Server.MapPath("/Design/Tlp/" + tlpMod.TlpName + "/");
            string userdir = Server.MapPath("/Site/" + sfMod.ID + "/");

            if (Directory.Exists(userdir))
            {
                Directory.CreateDirectory(userdir);
            }
            if (Directory.Exists(tlpdir))
            {
                FileSystemObject.CopyDirectory(tlpdir, userdir);
            }
            //创建用户节点,先检测是否通过其他途径创建了根节点
            M_Node nodeMod = desNodeBll.GetUserRootNode(mu);

            if (nodeMod.IsNull)
            {
                nodeMod = desNodeBll.CreateUserRootNode(mu);
            }
            nodeMod.NodeBySite = sfMod.ID;
            nodeBll.UpdateByID(nodeMod);
            //导入节点和内容数据(从公用数据区)
            string commonDir = Server.MapPath("/design/tlp/common/init/");
            //DataTable nodeDT = XmlToDT(function.VToP(commonDir + "Node.xml"));
            DataTable nodeDT = DBCenter.Sel("ZL_Node", "ParentID=797");//1站点,非根节点信息
            DataTable conDT  = XmlToDT(function.VToP(commonDir + "CommonModel.xml"));
            DataTable artDT  = XmlToDT(function.VToP(commonDir + "Article.xml"));

            for (int i = 0; i < nodeDT.Rows.Count; i++)
            {
                DataRow dr = nodeDT.Rows[i];
                dr["NodeBySite"] = sfMod.ID;
                dr["ParentID"]   = nodeMod.NodeID;
                dr["CUser"]      = sfMod.UserID;
            }
            //修改逻辑,支持来源拷贝,将站点数据拷贝后-->修改-->写入,即nodedt不再来自XML
            desHelper.ImportContentFromDT(nodeDT, conDT, artDT);
            //根据所选模板,拷贝内容
            string guid = tlpBll.CopyTlp(tlpMod.ID, sfMod);

            if (string.IsNullOrEmpty(guid))
            {
                function.WriteErrMsg("站点创建失败");
            }
            RouteHelper.RouteDT = domainBll.Sel();
            mu.SiteID           = sfMod.ID;
            DBCenter.UpdateSQL("ZL_User", "SiteID=" + mu.SiteID, "UserID=" + mu.UserID);
            if (string.IsNullOrEmpty(RUrl))
            {
                Response.Redirect("/Design/Default.aspx?ID=" + guid);
            }
            else
            {
                Response.Redirect(RUrl);
            }
        }