Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SiteRequestInfo siteRequestInfo = DistributorHelper.GetSiteRequestInfo(int.Parse(hidRequestId.Value));

            if (siteRequestInfo == null)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                int siteQty = 0;

                bool isValid = false, expired = false;

                SiteSettings siteSettings = new SiteSettings(siteRequestInfo.FirstSiteUrl, new int?(siteRequestInfo.UserId));

                siteSettings.RecordCode = siteRequestInfo.FirstRecordCode;

                siteSettings.SiteUrl2 = siteRequestInfo.SecondSiteUrl;

                siteSettings.RecordCode2 = siteRequestInfo.SecondRecordCode;

                siteSettings.Disabled = false;

                siteSettings.CreateDate = new DateTime?(DateTime.Now);

                siteSettings.RequestDate = new DateTime?(siteRequestInfo.RequestTime);

                siteSettings.LogoUrl = "/utility/pics/agentlogo.jpg";

                siteSettings.IsShowOnlineGift = false;

                LicenseChecker.Check(out isValid, out expired, out siteQty);

                if (!DistributorHelper.AddSiteSettings(siteSettings, siteRequestInfo.RequestId, siteQty))
                {
                    ShowMsg("开通分销商站点失败,可能是您能够开启的数量已经达到了授权的上限或是授权已过有效期!", false);
                }
                else
                {
                    IList <ManageThemeInfo> list = LoadThemes();

                    string path = Page.Request.MapPath(Globals.ApplicationPath + "/Storage/sites/") + siteSettings.UserId.ToString();

                    string str2 = Page.Request.MapPath(Globals.ApplicationPath + "/Templates/sites/") + siteSettings.UserId.ToString() + @"\" + list[0].ThemeName;

                    string srcPath = Page.Request.MapPath(Globals.ApplicationPath + "/Templates/library/") + list[0].ThemeName;

                    if (!Directory.Exists(path))
                    {
                        try
                        {
                            Directory.CreateDirectory(path);
                            Directory.CreateDirectory(path + "/article");
                            Directory.CreateDirectory(path + "/brand");
                            Directory.CreateDirectory(path + "/fckfiles");
                            Directory.CreateDirectory(path + "/help");
                            Directory.CreateDirectory(path + "/link");
                        }
                        catch
                        {
                            ShowMsg("开通分销商站点失败", false);
                            return;
                        }
                    }
                    if (!Directory.Exists(str2))
                    {
                        try
                        {
                            CopyDir(srcPath, str2);

                            siteSettings.Theme = list[0].ThemeName;

                            SettingsManager.Save(siteSettings);
                        }
                        catch
                        {
                            ShowMsg("开通分销商站点失败", false);

                            return;
                        }
                    }

                    BindRequests();

                    ShowMsg("成功开通了分销商的站点", true);
                }
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            SiteRequestInfo siteRequestInfo = DistributorHelper.GetSiteRequestInfo(int.Parse(this.hidRequestId.Value));

            if (siteRequestInfo == null)
            {
                base.GotoResourceNotFound();
                return;
            }
            Hidistro.Membership.Context.SiteSettings siteSettings = new Hidistro.Membership.Context.SiteSettings(siteRequestInfo.FirstSiteUrl, new int?(siteRequestInfo.UserId));
            siteSettings.Disabled    = false;
            siteSettings.CreateDate  = new System.DateTime?(System.DateTime.Now);
            siteSettings.RequestDate = new System.DateTime?(siteRequestInfo.RequestTime);
            siteSettings.LogoUrl     = "/utility/pics/agentlogo.jpg";
            bool flag;
            bool flag2;
            int  siteQty;

            Hidistro.Membership.Context.LicenseChecker.Check(out flag, out flag2, out siteQty);
            if (!DistributorHelper.AddSiteSettings(siteSettings, siteRequestInfo.RequestId, siteQty))
            {
                this.ShowMsg("开通分销商站点失败,可能是您能够开启的数量已经达到了授权的上限或是授权已过有效期!", false);
                return;
            }
            System.Collections.Generic.IList <ManageThemeInfo> list = this.LoadThemes();
            string text    = this.Page.Request.MapPath(Globals.ApplicationPath + "/Storage/sites/") + siteSettings.UserId.ToString();
            string text2   = this.Page.Request.MapPath(Globals.ApplicationPath + "/Templates/sites/") + siteSettings.UserId.ToString() + "\\" + list[0].ThemeName;
            string srcPath = this.Page.Request.MapPath(Globals.ApplicationPath + "/Templates/library/") + list[0].ThemeName;

            if (!System.IO.Directory.Exists(text))
            {
                try
                {
                    System.IO.Directory.CreateDirectory(text);
                    System.IO.Directory.CreateDirectory(text + "/article");
                    System.IO.Directory.CreateDirectory(text + "/brand");
                    System.IO.Directory.CreateDirectory(text + "/fckfiles");
                    System.IO.Directory.CreateDirectory(text + "/help");
                    System.IO.Directory.CreateDirectory(text + "/link");
                    System.IO.Directory.CreateDirectory(text + "/category");
                }
                catch
                {
                    this.ShowMsg("开通分销商站点失败", false);
                    return;
                }
            }
            if (!System.IO.Directory.Exists(text2))
            {
                try
                {
                    this.CopyDir(srcPath, text2);
                    siteSettings.Theme = list[0].ThemeName;
                    Hidistro.Membership.Context.SettingsManager.Save(siteSettings);
                }
                catch
                {
                    this.ShowMsg("开通分销商站点失败", false);
                    return;
                }
            }
            this.BindRequests();
            this.ShowMsg("成功开通了分销商的站点", true);
        }