示例#1
0
        //控件呈现事件
        protected override void Render(HtmlTextWriter writer)
        {
            int  siteQty;
            bool isValid, isExpired;

            //授权验证
            LicenseChecker.Check(out isValid, out isExpired, out siteQty);

            if (!isValid)
            {
                writer.Write(licenseMsg);
            }
            else if (isExpired)
            {
                using (StringWriter sw = new StringWriter())
                {
                    using (HtmlTextWriter htw = new HtmlTextWriter(sw))
                    {
                        base.Render(htw);

                        string str = sw.ToString();

                        str = str.Insert(str.IndexOf("</body>"), "<div class=\"checkInfo\">\r\n   <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n      <tr>\r\n        <td class=\"td1\"><img src=\"images/checkInfo.gif\" width=\"30\" height=\"30\" /></td>\r\n        <td class=\"td2\" width=\"100%\">您正在使用的易分销系统已过授权有效期!<br/>请联系官方(www.shopefx.com)购买软件使用权。</td>\r\n      </tr>\r\n   </table>\r\n</div>");

                        writer.Write(str);
                    }
                }
            }
            else
            {
                base.Render(writer);
            }
        }
示例#2
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title       = "请选择要打开的文件";
            ofd.Multiselect = false;
            ofd.Filter      = "授权文件(*.dat)|*.dat|所有文件(*.*)|*.*";;
            ofd.FilterIndex = 1;
            //设置对话框是否记忆之前打开的目录
            ofd.RestoreDirectory = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //获取用户选择的文件完整路径
                string filePath = ofd.FileName;
                string message  = string.Empty;

                var isChecked = lc.Check(filePath, out message);

                if (!isChecked)
                {
                    MessageBox.Show(message);
                }
                else
                {
                    System.IO.File.Copy(filePath, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "reg.dat"), true);

                    this.Close();
                }
            }
        }
示例#3
0
        private void SetStatus(LicenseRegistration details)
        {
            var status = checker.Check(details);

            IsLicensed = status.IsLicensed;
            IsTrial    = status.IsTrial;
        }
示例#4
0
        private bool GetIsLicensed(LicenseRegistration registration)
        {
            if (!validator.Isvalid(registration))
            {
                return(false);
            }

            var status = remote.Check(registration);

            return(status.IsLicensed);
        }
示例#5
0
        void Application_BeginRequest(object sender, EventArgs e)
        {
            LicenseChecker lc      = new LicenseChecker();
            string         message = string.Empty;
            bool           isCheck = lc.Check(this.Server.MapPath("~/授权文件[北京客户].dat"), out message);

            if (!isCheck)
            {
                this.Response.Write(message);
                this.Response.End();
            }
        }
示例#6
0
        static void Main()
        {
            LicenseChecker lc      = new LicenseChecker();
            string         message = string.Empty;
            bool           isCheck = lc.Check("授权文件[北京客户+CPU序列号].dat", out message);

            if (!isCheck)
            {
                MessageBox.Show(message);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
示例#7
0
        protected override void Render(HtmlTextWriter writer)
        {
            int  num;
            bool flag;
            bool flag2;

            LicenseChecker.Check(out flag, out flag2, out num);
            if (!flag)
            {
                writer.Write(this.licenseMsg);
            }
            else if (flag2)
            {
                writer.Write(this.noticeMsg);
            }
            else
            {
                base.Render(writer);
            }
        }
示例#8
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "reg.dat");

            if (File.Exists(filePath) == false)
            {
                FormReg formReg = new FormReg();
                formReg.ShowDialog();
                if (File.Exists(filePath) == false)
                {
                    return;
                }
                else
                {
                    //Application.Restart();
                }
            }


            LicenseChecker lc      = new LicenseChecker();
            string         message = string.Empty;
            bool           isCheck = lc.Check(filePath, out message);

            if (!isCheck)
            {
                MessageBox.Show(message);
                return;
            }


            Application.Run(new Form1());
        }
示例#9
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);
                }
            }
        }