Ejemplo n.º 1
0
 private bool DoAdd()
 {
     Rain.Model.channel_site model       = new Rain.Model.channel_site();
     Rain.BLL.channel_site   channelSite = new Rain.BLL.channel_site();
     model.title           = this.txtTitle.Text.Trim();
     model.build_path      = this.txtBuildPath.Text.Trim();
     model.domain          = this.txtDomain.Text.Trim();
     model.sort_id         = Utils.StrToInt(this.txtSortId.Text.Trim(), 99);
     model.is_default      = !this.cbIsDefault.Checked ? 0 : 1;
     model.name            = this.txtName.Text.Trim();
     model.logo            = this.txtLogo.Text.Trim();
     model.company         = this.txtCompany.Text.Trim();
     model.address         = this.txtAddress.Text.Trim();
     model.tel             = this.txtTel.Text.Trim();
     model.fax             = this.txtFax.Text.Trim();
     model.email           = this.txtEmail.Text.Trim();
     model.crod            = this.txtCrod.Text.Trim();
     model.seo_title       = this.txtSeoTitle.Text.Trim();
     model.seo_keyword     = this.txtSeoKeyword.Text.Trim();
     model.seo_description = Utils.DropHTML(this.txtSeoDescription.Text);
     model.copyright       = this.txtCopyright.Text.Trim();
     if (channelSite.Add(model) <= 0)
     {
         return(false);
     }
     CacheHelper.Remove("dt_cache_http_domain");
     this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加站点:" + model.title);
     return(true);
 }
Ejemplo n.º 2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel("sys_site_manage", DTEnums.ActionEnum.Delete.ToString());
            int num1 = 0;
            int num2 = 0;

            Rain.BLL.channel_site channelSite = new Rain.BLL.channel_site();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value);
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked)
                {
                    if (new Rain.BLL.channel().GetCount("site_id=" + (object)int32) > 0)
                    {
                        ++num2;
                    }
                    else
                    {
                        Rain.Model.channel_site model = channelSite.GetModel(int32);
                        if (channelSite.Delete(int32))
                        {
                            ++num1;
                            Utils.DeleteDirectory(this.siteConfig.webpath + "aspx/" + model.build_path);
                            Utils.DeleteDirectory(this.siteConfig.webpath + "html/" + model.build_path);
                        }
                        else
                        {
                            ++num2;
                        }
                    }
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除站点成功" + (object)num1 + "条,失败" + (object)num2 + "条");
            this.JscriptMsg("删除成功" + (object)num1 + "条,失败" + (object)num2 + "条!", Utils.CombUrlTxt("site_list.aspx", "keywords={0}", this.keywords), "parent.loadMenuTree");
        }
Ejemplo n.º 3
0
        public bool Update(Rain.Model.channel_site model)
        {
            string buildPath = this.dal.GetBuildPath(model.id);

            if (string.IsNullOrEmpty(buildPath) || !this.dal.Update(model, buildPath))
            {
                return(false);
            }
            if (buildPath.ToLower() != model.build_path.ToLower())
            {
                Utils.MoveDirectory(this.siteConfig.webpath + "aspx/" + buildPath, this.siteConfig.webpath + "aspx/" + model.build_path);
                Utils.MoveDirectory(this.siteConfig.webpath + "html/" + buildPath, this.siteConfig.webpath + "html/" + model.build_path);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public Rain.Model.channel_site GetModel(string build_path)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select top 1 id,title,build_path,templet_path,[domain],[name],logo,company,address,tel,fax,email,crod,copyright,seo_title,seo_keyword,seo_description,is_default,sort_id");
            stringBuilder.Append(" from " + this.databaseprefix + nameof(channel_site));
            stringBuilder.Append(" where build_path=@build_path");
            OleDbParameter[] oleDbParameterArray = new OleDbParameter[1]
            {
                new OleDbParameter("@build_path", OleDbType.VarChar, 50)
            };
            oleDbParameterArray[0].Value = (object)build_path;
            Rain.Model.channel_site channelSite = new Rain.Model.channel_site();
            DataSet dataSet = DbHelperOleDb.Query(stringBuilder.ToString(), oleDbParameterArray);

            if (dataSet.Tables[0].Rows.Count > 0)
            {
                return(this.DataRowToModel(dataSet.Tables[0].Rows[0]));
            }
            return((Rain.Model.channel_site)null);
        }
Ejemplo n.º 5
0
 public int Add(Rain.Model.channel_site model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 6
0
 public int Add(Rain.Model.channel_site model)
 {
     using (OleDbConnection oleDbConnection = new OleDbConnection(DbHelperOleDb.connectionString))
     {
         oleDbConnection.Open();
         using (OleDbTransaction trans = oleDbConnection.BeginTransaction())
         {
             try
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.Append("insert into " + this.databaseprefix + "channel_site(");
                 stringBuilder.Append("title,build_path,templet_path,[domain],[name],logo,company,address,tel,fax,email,crod,copyright,seo_title,seo_keyword,seo_description,is_default,sort_id)");
                 stringBuilder.Append(" values (");
                 stringBuilder.Append("@title,@build_path,@templet_path,@domain,@name,@logo,@company,@address,@tel,@fax,@email,@crod,@copyright,@seo_title,@seo_keyword,@seo_description,@is_default,@sort_id)");
                 OleDbParameter[] oleDbParameterArray = new OleDbParameter[18]
                 {
                     new OleDbParameter("@title", OleDbType.VarChar, 100),
                     new OleDbParameter("@build_path", OleDbType.VarChar, 100),
                     new OleDbParameter("@templet_path", OleDbType.VarChar, 100),
                     new OleDbParameter("@domain", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@name", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@logo", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@company", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@address", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@tel", OleDbType.VarChar, 30),
                     new OleDbParameter("@fax", OleDbType.VarChar, 30),
                     new OleDbParameter("@email", OleDbType.VarChar, 50),
                     new OleDbParameter("@crod", OleDbType.VarChar, 100),
                     new OleDbParameter("@copyright", OleDbType.VarChar),
                     new OleDbParameter("@seo_title", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@seo_keyword", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@seo_description", OleDbType.VarChar, 500),
                     new OleDbParameter("@is_default", OleDbType.Integer, 4),
                     new OleDbParameter("@sort_id", OleDbType.Integer, 4)
                 };
                 oleDbParameterArray[0].Value  = (object)model.title;
                 oleDbParameterArray[1].Value  = (object)model.build_path;
                 oleDbParameterArray[2].Value  = (object)model.templet_path;
                 oleDbParameterArray[3].Value  = (object)model.domain;
                 oleDbParameterArray[4].Value  = (object)model.name;
                 oleDbParameterArray[5].Value  = (object)model.logo;
                 oleDbParameterArray[6].Value  = (object)model.company;
                 oleDbParameterArray[7].Value  = (object)model.address;
                 oleDbParameterArray[8].Value  = (object)model.tel;
                 oleDbParameterArray[9].Value  = (object)model.fax;
                 oleDbParameterArray[10].Value = (object)model.email;
                 oleDbParameterArray[11].Value = (object)model.crod;
                 oleDbParameterArray[12].Value = (object)model.copyright;
                 oleDbParameterArray[13].Value = (object)model.seo_title;
                 oleDbParameterArray[14].Value = (object)model.seo_keyword;
                 oleDbParameterArray[15].Value = (object)model.seo_description;
                 oleDbParameterArray[16].Value = (object)model.is_default;
                 oleDbParameterArray[17].Value = (object)model.sort_id;
                 DbHelperOleDb.ExecuteSql(oleDbConnection, trans, stringBuilder.ToString(), oleDbParameterArray);
                 model.id = this.GetMaxId(oleDbConnection, trans);
                 new navigation(this.databaseprefix).Add(oleDbConnection, trans, "sys_contents", "channel_" + model.build_path, model.title, "", model.sort_id, 0, "Show");
                 trans.Commit();
             }
             catch
             {
                 trans.Rollback();
                 return(0);
             }
         }
     }
     return(model.id);
 }
Ejemplo n.º 7
0
 public Rain.Model.channel_site DataRowToModel(DataRow row)
 {
     Rain.Model.channel_site channelSite = new Rain.Model.channel_site();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             channelSite.id = int.Parse(row["id"].ToString());
         }
         if (row["title"] != null)
         {
             channelSite.title = row["title"].ToString();
         }
         if (row["build_path"] != null)
         {
             channelSite.build_path = row["build_path"].ToString();
         }
         if (row["templet_path"] != null)
         {
             channelSite.templet_path = row["templet_path"].ToString();
         }
         if (row["domain"] != null)
         {
             channelSite.domain = row["domain"].ToString();
         }
         if (row["name"] != null)
         {
             channelSite.name = row["name"].ToString();
         }
         if (row["logo"] != null)
         {
             channelSite.logo = row["logo"].ToString();
         }
         if (row["company"] != null)
         {
             channelSite.company = row["company"].ToString();
         }
         if (row["address"] != null)
         {
             channelSite.address = row["address"].ToString();
         }
         if (row["tel"] != null)
         {
             channelSite.tel = row["tel"].ToString();
         }
         if (row["fax"] != null)
         {
             channelSite.fax = row["fax"].ToString();
         }
         if (row["email"] != null)
         {
             channelSite.email = row["email"].ToString();
         }
         if (row["crod"] != null)
         {
             channelSite.crod = row["crod"].ToString();
         }
         if (row["copyright"] != null)
         {
             channelSite.copyright = row["copyright"].ToString();
         }
         if (row["seo_title"] != null)
         {
             channelSite.seo_title = row["seo_title"].ToString();
         }
         if (row["seo_keyword"] != null)
         {
             channelSite.seo_keyword = row["seo_keyword"].ToString();
         }
         if (row["seo_description"] != null)
         {
             channelSite.seo_description = row["seo_description"].ToString();
         }
         if (row["is_default"] != null && row["is_default"].ToString() != "")
         {
             channelSite.is_default = int.Parse(row["is_default"].ToString());
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             channelSite.sort_id = int.Parse(row["sort_id"].ToString());
         }
     }
     return(channelSite);
 }
Ejemplo n.º 8
0
 public bool Update(Rain.Model.channel_site model, string old_build_path)
 {
     using (OleDbConnection oleDbConnection = new OleDbConnection(DbHelperOleDb.connectionString))
     {
         oleDbConnection.Open();
         using (OleDbTransaction trans = oleDbConnection.BeginTransaction())
         {
             try
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.Append("update " + this.databaseprefix + "channel_site set ");
                 stringBuilder.Append("title=@title,");
                 stringBuilder.Append("build_path=@build_path,");
                 stringBuilder.Append("templet_path=@templet_path,");
                 stringBuilder.Append("[domain]=@domain,");
                 stringBuilder.Append("[name]=@name,");
                 stringBuilder.Append("logo=@logo,");
                 stringBuilder.Append("company=@company,");
                 stringBuilder.Append("address=@address,");
                 stringBuilder.Append("tel=@tel,");
                 stringBuilder.Append("fax=@fax,");
                 stringBuilder.Append("email=@email,");
                 stringBuilder.Append("crod=@crod,");
                 stringBuilder.Append("copyright=@copyright,");
                 stringBuilder.Append("seo_title=@seo_title,");
                 stringBuilder.Append("seo_keyword=@seo_keyword,");
                 stringBuilder.Append("seo_description=@seo_description,");
                 stringBuilder.Append("is_default=@is_default,");
                 stringBuilder.Append("sort_id=@sort_id");
                 stringBuilder.Append(" where id=@id");
                 OleDbParameter[] oleDbParameterArray = new OleDbParameter[19]
                 {
                     new OleDbParameter("@title", OleDbType.VarChar, 100),
                     new OleDbParameter("@build_path", OleDbType.VarChar, 100),
                     new OleDbParameter("@templet_path", OleDbType.VarChar, 100),
                     new OleDbParameter("@domain", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@name", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@logo", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@company", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@address", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@tel", OleDbType.VarChar, 30),
                     new OleDbParameter("@fax", OleDbType.VarChar, 30),
                     new OleDbParameter("@email", OleDbType.VarChar, 50),
                     new OleDbParameter("@crod", OleDbType.VarChar, 100),
                     new OleDbParameter("@copyright", (object)SqlDbType.Text),
                     new OleDbParameter("@seo_title", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@seo_keyword", OleDbType.VarChar, (int)byte.MaxValue),
                     new OleDbParameter("@seo_description", OleDbType.VarChar, 500),
                     new OleDbParameter("@is_default", OleDbType.Integer, 4),
                     new OleDbParameter("@sort_id", OleDbType.Integer, 4),
                     new OleDbParameter("@id", OleDbType.Integer, 4)
                 };
                 oleDbParameterArray[0].Value  = (object)model.title;
                 oleDbParameterArray[1].Value  = (object)model.build_path;
                 oleDbParameterArray[2].Value  = (object)model.templet_path;
                 oleDbParameterArray[3].Value  = (object)model.domain;
                 oleDbParameterArray[4].Value  = (object)model.name;
                 oleDbParameterArray[5].Value  = (object)model.logo;
                 oleDbParameterArray[6].Value  = (object)model.company;
                 oleDbParameterArray[7].Value  = (object)model.address;
                 oleDbParameterArray[8].Value  = (object)model.tel;
                 oleDbParameterArray[9].Value  = (object)model.fax;
                 oleDbParameterArray[10].Value = (object)model.email;
                 oleDbParameterArray[11].Value = (object)model.crod;
                 oleDbParameterArray[12].Value = (object)model.copyright;
                 oleDbParameterArray[13].Value = (object)model.seo_title;
                 oleDbParameterArray[14].Value = (object)model.seo_keyword;
                 oleDbParameterArray[15].Value = (object)model.seo_description;
                 oleDbParameterArray[16].Value = (object)model.is_default;
                 oleDbParameterArray[17].Value = (object)model.sort_id;
                 oleDbParameterArray[18].Value = (object)model.id;
                 DbHelperOleDb.ExecuteSql(oleDbConnection, trans, stringBuilder.ToString(), oleDbParameterArray);
                 if (new navigation(this.databaseprefix).GetModel(oleDbConnection, trans, "channel_" + old_build_path) != null)
                 {
                     new navigation(this.databaseprefix).Update(oleDbConnection, trans, "channel_" + old_build_path, "channel_" + model.build_path, model.title, model.sort_id);
                 }
                 else
                 {
                     new navigation(this.databaseprefix).Add(oleDbConnection, trans, "sys_contents", "channel_" + model.build_path, model.title, "", model.sort_id, 0, "Show");
                 }
                 trans.Commit();
             }
             catch
             {
                 trans.Rollback();
                 return(false);
             }
         }
     }
     return(true);
 }