private void ShowInfo(int _id)
        {
            BLL.channel_site   bll   = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            txtTitle.Text     = model.title;
            txtBuildPath.Text = model.build_path;
            txtBuildPath.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_site_validate&old_build_path=" + Utils.UrlEncode(model.build_path));
            txtBuildPath.Focus(); //设置焦点,防止JS无法提交
            txtDomain.Text = model.domain;
            txtSortId.Text = model.sort_id.ToString();
            if (model.is_default == 1)
            {
                cbIsDefault.Checked = true;
            }
            else
            {
                cbIsDefault.Checked = false;
            }
            txtName.Text           = model.name;
            txtLogo.Text           = model.logo;
            txtCompany.Text        = model.company;
            txtAddress.Text        = model.address;
            txtTel.Text            = model.tel;
            txtFax.Text            = model.fax;
            txtEmail.Text          = model.email;
            txtCrod.Text           = model.crod;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeyword.Text     = model.seo_keyword;
            txtSeoDescription.Text = model.seo_description;
            txtCopyright.Text      = model.copyright;
        }
Exemple #2
0
        private void ShowInfo(int _id)
        {
            BLL.channel_site   bll   = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            txtTitle.Text     = model.title;
            txtBuildPath.Text = model.build_path;
            txtBuildPath.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_site_validate&old_build_path=" + Utils.UrlEncode(model.build_path));
            txtBuildPath.Focus(); //设置焦点,防止JS无法提交
            txtDomain.Text = model.domain;
            txtSortId.Text = model.sort_id.ToString();
            if (model.is_default == 1)
            {
                cbIsDefault.Checked = true;
            }
            else
            {
                cbIsDefault.Checked = false;
            }
            if (model.is_mobile == 1)
            {
                cbIsMobile.Checked = true;
            }
            else
            {
                cbIsMobile.Checked = false;
            }
            ddlSiteId.SelectedValue = model.inherit_id.ToString();
            txtName.Text            = model.name;
            txtCompany.Text         = model.company;
            txtAddress.Text         = model.address;
            txtTel.Text             = model.tel;
            txtFax.Text             = model.fax;
            txtEmail.Text           = model.email;
            txtCrod.Text            = model.crod;
            txtSeoTitle.Text        = model.seo_title;
            txtSeoKeyword.Text      = model.seo_keyword;
            txtSeoDescription.Text  = model.seo_description;
            txtCopyright.Text       = model.copyright;
            //图片
            txtLogo.Text = model.logo;
            if (!string.IsNullOrEmpty(model.logo))
            {
                ImgDiv.Visible  = true;
                ImgUrl.ImageUrl = model.logo;
            }
            //百度推送
            if (model.bdsend == 1)
            {
                bdSend.Checked = true;
            }
            else
            {
                bdSend.Checked = false;
            }
            bdToken.Text = model.bdtoken;
        }
Exemple #3
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.channel_site   bll   = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            model.title      = txtTitle.Text.Trim();
            model.build_path = txtBuildPath.Text.Trim();
            model.domain     = txtDomain.Text.Trim();
            model.sort_id    = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            if (cbIsDefault.Checked == true)
            {
                model.is_default = 1;
            }
            else
            {
                model.is_default = 0;
            }
            if (cbIsMobile.Checked == true)
            {
                model.is_mobile = 1;
            }
            else
            {
                model.is_mobile = 0;
            }
            model.name            = txtName.Text.Trim();
            model.logo            = txtLogo.Text.Trim();
            model.company         = txtCompany.Text.Trim();
            model.address         = txtAddress.Text.Trim();
            model.tel             = txtTel.Text.Trim();
            model.fax             = txtFax.Text.Trim();
            model.email           = txtEmail.Text.Trim();
            model.crod            = txtCrod.Text.Trim();
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keyword     = txtSeoKeyword.Text.Trim();
            model.seo_description = Utils.DropHTML(txtSeoDescription.Text);
            model.copyright       = txtCopyright.Text.Trim();

            if (bll.Update(model))
            {
                //更新一下域名缓存
                CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改站点:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
        private void CreateIndexHtml(string lang, string aspx_filename, string catalogue)
        {
            try
            {
                if (File.Exists(Utils.GetMapPath(config.webpath + aspx_filename.Substring(0, aspx_filename.IndexOf(".aspx") + 5))))
                {
                    string urlPath  = config.webpath + aspx_filename.Replace("^", "&"); //文件相对路径
                    string htmlPath = config.webpath + catalogue;                       //保存相对路径
                    if (htmlPath.IndexOf(".") < 0)
                    {
                        htmlPath = htmlPath + "index." + config.staticextension;
                    }
                    //检查目录是否存在
                    string directorystr = HttpContext.Current.Server.MapPath(htmlPath.Substring(0, htmlPath.LastIndexOf("/")));
                    if (!Directory.Exists(directorystr))
                    {
                        Directory.CreateDirectory(directorystr);
                    }
                    string linkwebsite = HttpContext.Current.Request.Url.Authority;

                    Model.channel_site modelchannelsite = objchannel_site.GetModel(lang);
                    if (modelchannelsite != null && !string.IsNullOrEmpty(modelchannelsite.domain))
                    {
                        linkwebsite = modelchannelsite.domain;
                    }
                    System.Net.WebRequest  request      = System.Net.WebRequest.Create("http://" + linkwebsite + urlPath);
                    System.Net.WebResponse response     = request.GetResponse();
                    System.IO.Stream       stream       = response.GetResponseStream();
                    System.IO.StreamReader streamreader = new System.IO.StreamReader(stream, System.Text.Encoding.GetEncoding("utf-8"));
                    string content = streamreader.ReadToEnd();
                    using (StreamWriter sw = new StreamWriter(Utils.GetMapPath(htmlPath), false, Encoding.UTF8))
                    {
                        sw.WriteLine(content);
                        sw.Flush();
                        sw.Close();
                    }
                }
                else
                {
                    HttpContext.Current.Response.Write("1");//找不到生成的模版!
                }
            }
            catch (Exception ex)
            {
                RPoney.Log.LoggerManager.Error(GetType().Name, "生产模版错误", ex);
            }
        }
        private void ShowInfo(int _id)
        {
            BLL.channel_site bll = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            txtTitle.Text = model.title;
            txtBuildPath.Text = model.build_path;
            txtBuildPath.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_site_validate&old_build_path=" + Utils.UrlEncode(model.build_path));
            txtBuildPath.Focus(); //设置焦点,防止JS无法提交
            txtDomain.Text = model.domain;
            txtSortId.Text = model.sort_id.ToString();
            if (model.is_default == 1)
            {
                cbIsDefault.Checked = true;
            }
            else
            {
                cbIsDefault.Checked = false;
            }
            if (model.is_mobile == 1)
            {
                cbIsMobile.Checked = true;
            }
            else
            {
                cbIsMobile.Checked = false;
            }
            txtName.Text = model.name;
            txtLogo.Text = model.logo;
            txtCompany.Text = model.company;
            txtAddress.Text = model.address;
            txtTel.Text = model.tel;
            txtFax.Text = model.fax;
            txtEmail.Text = model.email;
            txtCrod.Text = model.crod;
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeyword.Text = model.seo_keyword;
            txtSeoDescription.Text = model.seo_description;
            txtCopyright.Text = model.copyright;
        }
Exemple #6
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_site_manage", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.channel_site bll = new BLL.channel_site();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    //检查该分类下是否还有频道
                    int channelCount = new BLL.channel().GetCount("site_id=" + id);
                    if (channelCount > 0)
                    {
                        errorCount += 1;
                        continue;
                    }
                    Model.channel_site model = bll.GetModel(id);
                    //删除成功后对应的目录及文件
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                        Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + model.build_path);
                        Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + model.build_path);
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除站点成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("site_list.aspx", "keywords={0}", this.keywords), "parent.loadMenuTree");
        }
Exemple #7
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_site_manage", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.channel_site bll = new BLL.channel_site();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             //检查该分类下是否还有频道
             int channelCount = new BLL.channel().GetCount("site_id=" + id);
             if (channelCount > 0)
             {
                 errorCount += 1;
                 continue;
             }
             Model.channel_site model = bll.GetModel(id);
             //删除成功后对应的目录及文件
             if (bll.Delete(id))
             {
                 sucCount += 1;
                 Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + model.build_path);
                 Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + model.build_path);
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除站点成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("site_list.aspx", "keywords={0}", this.keywords), "parent.loadMenuTree");
 }
Exemple #8
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.channel_site   bll   = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            model.title      = txtTitle.Text.Trim();
            model.build_path = txtBuildPath.Text.Trim();
            model.domain     = txtDomain.Text.Trim();
            model.sort_id    = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            if (cbIsDefault.Checked == true)
            {
                model.is_default = 1;
            }
            else
            {
                model.is_default = 0;
            }
            if (cbIsMobile.Checked == true)
            {
                model.is_mobile = 1;
            }
            else
            {
                model.is_mobile = 0;
            }
            model.inherit_id      = int.Parse(ddlSiteId.SelectedValue);
            model.name            = txtName.Text.Trim();
            model.company         = txtCompany.Text.Trim();
            model.address         = txtAddress.Text.Trim();
            model.tel             = txtTel.Text.Trim();
            model.fax             = txtFax.Text.Trim();
            model.email           = txtEmail.Text.Trim();
            model.crod            = txtCrod.Text.Trim();
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keyword     = txtSeoKeyword.Text.Trim();
            model.seo_description = Utils.DropHTML(txtSeoDescription.Text);
            model.copyright       = txtCopyright.Text.Trim();
            //判断上传图片
            if (this.imgUpload.HasFile)
            {
                //上传前先删除原图片
                if (!string.IsNullOrEmpty(model.logo))
                {
                    Utils.DeleteFile(model.logo);
                }
                Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false);
                if (upfile.status > 0)
                {
                    model.logo = upfile.path;
                }
            }
            else
            {
                //判断是否需要删除原图
                if (txtLogo.Text.Trim() == "" && !string.IsNullOrEmpty(model.logo))
                {
                    Utils.DeleteFile(model.logo);
                }
                model.logo = txtLogo.Text.Trim();
            }
            //百度推送
            if (bdSend.Checked == true)
            {
                model.bdsend = 1;
            }
            else
            {
                model.bdsend = 0;
            }
            model.bdtoken = bdToken.Text.Trim();

            if (bll.Update(model))
            {
                //更新一下域名缓存
                CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改站点:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.channel_site bll = new BLL.channel_site();
            Model.channel_site model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            model.build_path = txtBuildPath.Text.Trim();
            model.domain = txtDomain.Text.Trim();
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            if (cbIsDefault.Checked == true)
            {
                model.is_default = 1;
            }
            else
            {
                model.is_default = 0;
            }
            model.name = txtName.Text.Trim();
            model.logo = txtLogo.Text.Trim();
            model.company = txtCompany.Text.Trim();
            model.address = txtAddress.Text.Trim();
            model.tel = txtTel.Text.Trim();
            model.fax = txtFax.Text.Trim();
            model.email = txtEmail.Text.Trim();
            model.crod = txtCrod.Text.Trim();
            model.seo_title = txtSeoTitle.Text.Trim();
            model.seo_keyword = txtSeoKeyword.Text.Trim();
            model.seo_description = Utils.DropHTML(txtSeoDescription.Text);
            model.copyright = txtCopyright.Text.Trim();

            if (bll.Update(model))
            {
                //更新一下域名缓存
                CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改站点:" + model.title); //记录日志
                result = true;
            }

            return result;
        }