Exemple #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        WebConfigModel wm = new WebConfigModel();

        wm.SiteName    = txtSiteName.Text;
        wm.SiteTitle   = txtsitetitle.Text;
        wm.SiteTitleEn = txtsitetitleen.Text;
        wm.SiteUrl     = txtSiteUrl.Text;
        wm.SiteICP     = txticp.Text;

        wm.SiteKeyword       = txtSiteKeyword.Text;
        wm.SiteKeywordEn     = txtSiteKeyworden.Text;
        wm.SiteDescription   = txtSiteDescription.Text;
        wm.SiteDescriptionEn = txtSiteDescriptionen.Text;
        wm.EmailSMTP         = txtEmailsmtp.Text;
        wm.EmailName         = txtSmtpName.Text;
        wm.EmailPassword     = txtSmtpPassword.Text;
        wm.Sitecnzz          = txtsitecnzz.Text;
        wm.SiteMail          = txtsiteemail.Text;
        wm.SiteFax           = txtfax.Text;
        wm.SiteTel           = txttel.Text;
        wm.SiteQQ            = txtqq.Text;
        wm.SiteAddress       = txtaddress.Text;
        wm.Other             = txtother.Text;
        //0基本配置,1留言内容,2留言列表,3单页勾选显示
        wm.SiteConfig = SetCheckedBox.GetChecked(this.CheckBoxList1, ",") + "|" + SetCheckedBox.GetChecked(this.CheckBoxList2, ",") + "|" + SetCheckedBox.GetChecked(this.CheckBoxList3, ",") + "|" + RadioButtonList1.SelectedValue;
        wm.id         = 1;

        bool b = new WebConfigBll().Update(wm);

        if (b)
        {
            BasePage.JscriptPrint(Page, "更新成功!", "WebConfig.aspx");
        }
    }
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;

            try
            {
                #region 赋值

                //获取实体
                var model = new WebConfig(x => x.Id == id);
                model.WebName   = StringHelper.Left(txtWebName.Text, 50);
                model.WebDomain = StringHelper.Left(txtWebDomain.Text, 50, true, false);
                model.WebEmail  = StringHelper.Left(txtWebEmail.Text, 50, true, false);

                model.LoginLogReserveTime = ConvertHelper.Cint0(txtLoginLogReserveTime.Text);
                model.UseLogReserveTime   = ConvertHelper.Cint0(txtUseLogReserveTime.Text);

                model.EmailSmtp     = StringHelper.Left(txtEmailSmtp.Text, 50, true, false);
                model.EmailUserName = StringHelper.Left(txtEmailUserName.Text, 50);
                model.EmailPassWord = StringHelper.Left(txtEmailPassWord.Text, 50, true, false);

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                WebConfigBll.GetInstence().Save(this, model);

                //------------------------------------
                //测试邮件发送服务
                if (chkSendTest.Checked && model.EmailSmtp.Length > 0 && model.EmailUserName.Length > 0)
                {
                    var    oMail = new MailBll();
                    string ss    = oMail.TestMail();

                    if (ss.Length > 0)
                    {
                        return("出错!" + ss);
                    }
                    else
                    {
                        return("发送成功!");
                    }
                }
                return("修改成功!");
            }
            catch (Exception e)
            {
                result = "保存失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }

            return(result);
        }
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            //获取指定ID的系统配置内容
            var model = WebConfigBll.GetInstence().GetModelForCache(x => x.Id == id);

            if (model == null)
            {
                return;
            }

            txtWebName.Text   = model.WebName;
            txtWebDomain.Text = model.WebDomain;
            txtWebEmail.Text  = model.WebEmail;

            //--------------------------------------------
            txtLoginLogReserveTime.Text = model.LoginLogReserveTime + "";
            txtUseLogReserveTime.Text   = model.UseLogReserveTime + "";

            //--------------------------------------------
            txtEmailSmtp.Text     = model.EmailSmtp;
            txtEmailUserName.Text = model.EmailUserName;
            txtEmailPassWord.Text = model.EmailPassWord;
        }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        shsiteconfig.Visible = false;

        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">系统基本设置</span>";
            string checklogin = new AdminBll().CheckLogin("0");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "6"))
            {
                shsiteconfig.Visible = true;
            }
            WebConfigModel wm = new WebConfigBll().GetModel(1);
            txtSiteName.Text    = wm.SiteName;
            txtsitetitle.Text   = wm.SiteTitle;
            txtsitetitleen.Text = wm.SiteTitleEn;
            txtSiteUrl.Text     = wm.SiteUrl;
            txticp.Text         = wm.SiteICP;

            txtSiteKeyword.Text       = wm.SiteKeyword;
            txtSiteKeyworden.Text     = wm.SiteKeywordEn;
            txtSiteDescription.Text   = wm.SiteDescription;
            txtSiteDescriptionen.Text = wm.SiteDescriptionEn;
            txtsiteemail.Text         = wm.SiteMail;
            txtEmailsmtp.Text         = wm.EmailSMTP;
            txtSmtpName.Text          = wm.EmailName;
            txtsitecnzz.Text          = wm.Sitecnzz;
            txtfax.Text     = wm.SiteFax;
            txttel.Text     = wm.SiteTel;
            txtaddress.Text = wm.SiteAddress;
            txtqq.Text      = wm.SiteQQ;
            txtaddress.Text = wm.SiteAddress;
            txtother.Text   = wm.Other;
            txtSmtpPassword.Attributes.Add("value", wm.EmailPassword);
            txtidnum.Text = BasePage.SiteId();
            if (!String.IsNullOrEmpty(wm.SiteConfig))
            {
                string   siteconfig = wm.SiteConfig;
                string[] a          = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    SetCheckedBox.SetChecked(this.CheckBoxList1, a[0], ","); //基本配置
                    SetCheckedBox.SetChecked(this.CheckBoxList2, a[1], ","); //留言内容
                    SetCheckedBox.SetChecked(this.CheckBoxList3, a[2], ","); //留言列表
                    RadioButtonList1.SelectedValue = a[3];                   //单页显示可选
                    showhide = a[0];
                }
            }
            //序列号
            //string word = GreateFiles.Read_File(Server.MapPath("~/id.txt"));
            //if (!String.IsNullOrEmpty(word))
            //{
            //    txtidnum.Text = word.Trim();
            //}
        }
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"GuestBook.aspx\" class=\"home\">留言管理</a>";
            string checklogin = new AdminBll().CheckLogin("3");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            id = BasePage.GetRequestId(Request.QueryString["id"]);

            string siteconfig = new WebConfigBll().GetModel(1).SiteConfig;
            if (!String.IsNullOrEmpty(siteconfig))
            {
                string[] a = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    showhide     = a[1];
                    showhidelist = a[2];
                }
            }

            if (id != 0)
            {
                GuestBookModel model = new GuestBookBll().GetModel(id);
                bool           b     = new CommonBll().Exists("GL_GuestBook", id);
                if (b)
                {
                    txtTitle.Text     = model.Title;
                    txtUserName.Text  = model.UserName;
                    txtTel.Text       = model.Tel;
                    txtFax.Text       = model.Fax;
                    txtMobile.Text    = model.Mobile;
                    txtCompany.Text   = model.Company;
                    txtAddress.Text   = model.Address;
                    txtEmail.Text     = model.Email;
                    txtSiteUrl.Text   = model.SiteUrl;
                    txtCode.Text      = model.Code;
                    txtAddTime.Text   = model.AddTime.ToString();
                    txtQQ.Text        = model.QQ;
                    txtWangWang.Text  = model.WangWang;
                    txtMSN.Text       = model.MSN;
                    txtContents.Text  = model.Contents;
                    txtIP.Text        = model.IP;
                    txtReply.Text     = model.Reply;
                    txtReplyTime.Text = model.ReplyTime.ToString();
                    if (model.Verific == 0)
                    {
                        txtVerific.Checked = true;
                    }
                    if (model.Sex == 0)
                    {
                        txtsex.Text = "先生";
                    }
                    else if (model.Sex == 1)
                    {
                        txtsex.Text = "女士";
                    }
                }
                else
                {
                    BasePage.Alertback("参数出错。");
                    return;
                }
            }
            else
            {
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页

                ds = new CommonBll().GetListPage("", "GL_GuestBook", "", "id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
                int totalrecord = new CommonBll().GetRecordCount("GL_GuestBook", "");//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\" class=\"red\">暂无相关留言</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        showhide.Visible   = false;
        showddltid.Visible = false;
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        if (!Page.IsPostBack)
        {
            string bx = "<a class=\"home\" href=\"DIYPage.aspx\">单页管理</a>";
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
            {
                bx += "<a href =\"?Ac=add&tid=" + Request.QueryString["tid"] + "\" class=\"add\">新建单页</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bx;
            string checklogin = new AdminBll().CheckLogin("9");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            string siteconfig = new WebConfigBll().GetModel(1).SiteConfig;
            if (!String.IsNullOrEmpty(siteconfig))
            {
                string[] a = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    if (a[3] == "0")
                    {
                        //隐藏
                        showhide.Visible = true;
                    }
                }
            }

            action = Request.QueryString["Ac"];
            int    tid      = BasePage.GetRequestId(Request.QueryString["tid"]);
            string strwhere = "Tid=" + tid;
            if (String.IsNullOrEmpty(action))
            {
                Repeater1.DataSource = new CommonBll().GetList("", datatable, strwhere, "PageType desc,px desc,id desc");
                Repeater1.DataBind();
            }
            else if (action == "add")
            {
                ddltid.DataSource     = new CommonBll().GetList("", datatable, "PageType=1", "id desc");
                ddltid.DataTextField  = "PageName";
                ddltid.DataValueField = "id";
                ddltid.DataBind();
                ddltid.Items.Insert(0, new ListItem("无上级栏目", "0"));
                if (id != 0)
                {
                    DiyPageModel dm = new DiyPageBll().GetModel(id);
                    txtPageName.Text     = dm.PageName;
                    ddltid.SelectedValue = dm.Tid.ToString();
                    // ddltid.Enabled = false;
                    txtpx.Text = dm.Px.ToString();

                    txtseotitle.Text       = dm.SeoTitle;
                    txtkeyword.Text        = dm.SeoKeyword;
                    txtSeoDescription.Text = dm.SeoDescription;
                    txtcontents.Text       = dm.PageContents;
                    txtPicUrl.Text         = dm.PagePicUrl;
                    Button1.Text           = "确认修改";
                    contentsfield          = dm.PageContentsField;
                    SetCheckedBox.SetChecked(this.txtpagecontentsfield, dm.PageContentsField, ",");
                }
                if (gethide("1"))
                {
                    showddltid.Visible = true;
                }
                if (tid != 0)//从栏目里点新建,则开启所属栏目
                {
                    showddltid.Visible   = true;
                    ddltid.SelectedValue = tid.ToString();
                    txtpagecontentsfield.SelectedValue = "1";
                }
            }
            else if (action == "clone")
            { //克隆数据
                if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
                {
                    string filename = "PageName,ModelName,PageFilename,PageContents,EditTime,SeoTitle,SeoKeyword,SeoDescription,PageType,Px,Tid,PageContentsField,PagePicUrl";
                    int    c        = new CommonBll().CloneData(filename, datatable, "id=" + id);
                    if (c > 0)
                    {
                        BasePage.JscriptPrint(Page, "克隆成功!", "diypage.aspx?tid=" + tid);
                    }
                }
            }
        }
    }