Beispiel #1
0
        /// <summary>
        /// 添加远程用户方法
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pwd"></param>
        /// <param name="email"></param>
        /// <returns></returns>
        public int Add(string username, string pwd, string email)
        {
            var         error = 0;
            XmlDocument doc   = new XmlDocument();

            doc.Load(ConfigPath);

            var nodes = doc.DocumentElement.SelectNodes("//item");

            for (int i = 0; i < nodes.Count; i++)
            {
                try
                {
                    var url     = nodes[i].Attributes["url"].Value;
                    var captcha = nodes[i].Attributes["captcha"].Value;
                    url = RequestHelper.AddOrUpdateParam(url, "action", "add");
                    url = RequestHelper.AddOrUpdateParam(url, "username", username);
                    url = RequestHelper.AddOrUpdateParam(url, "pwd", pwd);
                    url = RequestHelper.AddOrUpdateParam(url, "email", email);
                    url = RequestHelper.AddOrUpdateParam(url, "captcha", captcha);

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.Timeout = 300000;
                    HttpWebResponse response  = (HttpWebResponse)request.GetResponse();
                    StreamReader    srContent = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("gb2312"));

                    string result = srContent.ReadToEnd();
                    if (string.Compare(result, "0", true) != 0)
                    {
                        //添加成功
                        error++;
                    }
                }
                catch (Exception ex)
                {
                    //LOG
                    error++;
                    continue;
                }
            }

            return(error);
        }
Beispiel #2
0
        string BuildNavString()
        {
            string strActive = @"<LI class=TabIn id=tab{0} style='display:{2}'><A>{1}</A> </LI>";
            string strLink   = @"<LI class=TabOut id=tab{0}  style='display:{2}'><A  href={3}>{1}</A> </LI>";
            int    tab       = 1;
            string tabString = "";
            string dispay    = "";
            //string rawurl = Helper.RemoveParamFromUrl(Request.RawUrl, "tab");
            //rawurl = Helper.RemoveParamFromUrl(Request.RawUrl, "saved");
            //rawurl = Helper.AddParamToUrl(rawurl, "group", GroupName);
            //rawurl = Helper.AddParamToUrl(rawurl, "model", ModelName);

            string rawUrl = RequestHelper.RemoveParam(Request.RawUrl, "tab");

            rawUrl = RequestHelper.RemoveParam(rawUrl, "modelname");
            rawUrl = RequestHelper.RemoveParam(rawUrl, "panel");

            ModelInfo modelInfo = ModelHelper.GetModelInfoByName(ModelName);

            ContentModelType = modelInfo.Type;

            #region Article
            if (modelInfo.Type == ModelType.ARTICLE)
            {
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "modelname", RequestHelper.Get <string>("modelname"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "tab", RequestHelper.Get <string>("tab", "1"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "panel", RequestHelper.Get <string>("panel", "edit"));

                //记录操作历史,按照操作历史延续


                if (TabID != null && We7Helper.IsNumber(TabID) && int.Parse(TabID) > 0)
                {
                    tab = int.Parse(TabID);
                }

                if (tab == 1)
                {
                    tabString += string.Format(strActive, 1, "后台信息录入", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_Edit.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "1");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "edit");
                    tabString += string.Format(strLink, 1, "后台信息录入", dispay, rawUrl);
                }

                if (tab == 4)
                {
                    tabString += string.Format(strActive, 4, "后台列表显示", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_List.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "4");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "list");
                    tabString += string.Format(strLink, 4, "后台列表显示", dispay, rawUrl);
                }
                if (tab == 2)
                {
                    tabString += string.Format(strActive, 2, "会员中心列表显示", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_List.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "2");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "multi");
                    tabString += string.Format(strLink, 2, "会员中心列表显示", dispay, rawUrl);
                }
                if (tab == 3)
                {
                    tabString += string.Format(strActive, 3, "会员中心录入", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_Edit.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "3");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "multi");
                    tabString += string.Format(strLink, 3, "会员中心录入", dispay, rawUrl);
                }
            }

            #endregion

            #region ADVICE
            else if (modelInfo.Type == ModelType.ADVICE)
            {
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "modelname", RequestHelper.Get <string>("modelname"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "tab", RequestHelper.Get <string>("tab", "1"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "panel", RequestHelper.Get <string>("panel", "edit"));
                if (TabID != null && We7Helper.IsNumber(TabID) && int.Parse(TabID) > 0)
                {
                    tab = int.Parse(TabID);
                }

                if (tab == 1)
                {
                    tabString += string.Format(strActive, 1, "前台编辑", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_Edit.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "1");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "edit");
                    tabString += string.Format(strLink, 1, "前台编辑", dispay, rawUrl);
                }

                if (tab == 2)
                {
                    tabString += string.Format(strActive, 2, "后台编辑", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_Edit.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "2");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "adminView");
                    tabString += string.Format(strLink, 2, "后台编辑", dispay, rawUrl);
                }
            }
            #endregion

            #region Account
            else if (modelInfo.Type == ModelType.ACCOUNT)
            {
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "modelname", RequestHelper.Get <string>("modelname"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "tab", RequestHelper.Get <string>("tab", "1"));
                rawUrl = RequestHelper.AddOrUpdateParam(rawUrl, "panel", RequestHelper.Get <string>("panel", "edit"));
                if (TabID != null && We7Helper.IsNumber(TabID) && int.Parse(TabID) > 0)
                {
                    tab = int.Parse(TabID);
                }

                if (tab == 1)
                {
                    tabString += string.Format(strActive, 1, "录入信息", dispay);
                    Control ctl = this.LoadControl("Controls/Panel_Edit.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "panel");
                    rawUrl     = RequestHelper.RemoveParam(rawUrl, "tab");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "tab", "1");
                    rawUrl     = RequestHelper.AddOrUpdateParam(rawUrl, "panel", "edit");
                    tabString += string.Format(strLink, 1, "录入信息", dispay, rawUrl);
                }
            }
            #endregion

            return(tabString);
        }