Example #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //string strErr = "";
            string ClassDesc    = this.txtClassDesc.Text;
            string ClassPicture = this.txtClassPicture.Text;
            int    ParentId     = 0;

            if (this.dropParent.SelectedIndex > 0)
            {
                ParentId = int.Parse(this.dropParent.SelectedValue);
            }


            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassDesc    = ClassDesc;
            model.ClassPicture = ClassPicture;
            model.ParentId     = ParentId;
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            bll.Add(model);

            if (chkAddContinue.Checked)
            {
                Session["newsclass"] = model;
                Response.Redirect("Add.aspx");
            }
            else
            {
                Session["newsclass"] = null;
                Response.Redirect("index.aspx");
            }
        }
Example #2
0
 protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string Dormancy = (string)DataBinder.Eval(e.Row.DataItem, "Dormancy");
         int    ClassId  = (int)DataBinder.Eval(e.Row.DataItem, "ClassId");
         int    IsTop    = (int)DataBinder.Eval(e.Row.DataItem, "IsTop");
         if (Dormancy.ToLower() == "true")
         {
             e.Row.Cells[3].Text = "<span style=\" color:Red\">休眠</span>";
         }
         else
         {
             e.Row.Cells[3].Text = "<span style=\" color:Green\">发布</span>";
         }
         if (IsTop == 1)
         {
             e.Row.Cells[4].Text = "<span style=\" color:Green\">是</span>";
         }
         else
         {
             e.Row.Cells[4].Text = "<span style=\" color:Red\">否</span>";
         }
         Maticsoft.BLL.NewsManage.NewsClass   bll = new Maticsoft.BLL.NewsManage.NewsClass();
         Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModel(ClassId);
         if (mod != null)
         {
             e.Row.Cells[5].Text = mod.ClassDesc;
         }
         else
         {
             e.Row.Cells[5].Text = "未知类别";
         }
     }
 }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NewsManage.NewsClass GetModel(int ClassId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from T_NewsClass ");
            strSql.Append(" where ClassId=@ClassId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClassId", SqlDbType.Int, 4)
            };
            parameters[0].Value = ClassId;
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            model.ClassId = ClassId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ClassDesc    = ds.Tables[0].Rows[0]["ClassDesc"].ToString();
                model.ClassPicture = ds.Tables[0].Rows[0]["ClassPicture"].ToString();
                if (ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentId = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        protected void BindClassList(int ClassID)
        {
            string strWhere="";
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model = bll.GetModel(ClassID);
            int parentid = model.ParentId;
            if (parentid != 0)
            {
                model= bll.GetModelByCache(parentid);
                parentid = model.ParentId;
            }
    
            strWhere = "parentid="+model.ClassId;
            DataSet ds = new DataSet();
            ds = bll.GetList(strWhere);
            DataTable dt = ds.Tables[0];
            this.ClassName.InnerHtml = model.ClassDesc;


            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string classname="nav_2";
                   // Ñ¡ÖÐ״̬Ñùʽ
                    if (ClassID.ToString() == dt.Rows[i][0].ToString())
                        classname = "nav_2_on";
                    this.ClassList.InnerHtml += "<li class='" + classname + "'><img src='images/picto_feuilles.gif' align='absmiddle' /><a href='main.aspx?classid=" + dt.Rows[i][0].ToString() + "' >" + dt.Rows[i][1].ToString() + "</a></li>";
                    
                }
            }
        }
Example #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //string strErr = "";
            string ClassDesc = this.txtClassDesc.Text;
            string ClassPicture = this.txtClassPicture.Text;
            int ParentId = 0;
            if (this.dropParent.SelectedIndex > 0)
            {
                ParentId = int.Parse(this.dropParent.SelectedValue);
            }

            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassDesc = ClassDesc;
            model.ClassPicture = ClassPicture;
            model.ParentId = ParentId;
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            bll.Add(model);

            if (chkAddContinue.Checked)
            {
                Session["newsclass"] = model;
                Response.Redirect("Add.aspx");
            }
            else
            {
                Session["newsclass"] = null;
                Response.Redirect("index.aspx");
            }
        }
Example #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NewsManage.NewsClass GetModel(int ClassId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from T_NewsClass ");
            strSql.Append(" where ClassId=@ClassId");

            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ClassId", DbType.Int16, ClassId);
            DataSet ds = db.ExecuteDataSet(dbCommand);

            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassId = ClassId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ClassDesc    = ds.Tables[0].Rows[0]["ClassDesc"].ToString();
                model.ClassPicture = ds.Tables[0].Rows[0]["ClassPicture"].ToString();
                if (ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentId = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        protected void grid_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                string Dormancy = (string)DataBinder.Eval(e.Item.DataItem, "Dormancy");
                int    ClassId  = (int)DataBinder.Eval(e.Item.DataItem, "ClassId");
                if (Dormancy.ToLower() == "true")
                {
                    e.Item.Cells[4].Text = "<span style=\" color:Red\">休眠</span>";
                }
                else
                {
                    e.Item.Cells[4].Text = "<span style=\" color:Green\">发布</span>";
                }

                Maticsoft.BLL.NewsManage.NewsClass   bll = new Maticsoft.BLL.NewsManage.NewsClass();
                Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModelByCache(ClassId);
                if (mod != null)
                {
                    e.Item.Cells[5].Text = mod.ClassDesc;
                }
                else
                {
                    e.Item.Cells[5].Text = "未知类别";
                }
            }
        }
Example #8
0
        //#region BiudTree
        //private void BiudTree()
        //{
        //    //			if(Session["UserInfo"]==null)
        //    //			{
        //    //				return ;
        //    //			}
        //    //			MoviePrincipal user=new MoviePrincipal(Context.User.Identity.Name);
        //    //			PowerWeb.Web.Accounts.CS.Bus.User currentUser=(PowerWeb.Web.Accounts.CS.Bus.User)Session["UserInfo"];00
        //    Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
        //    DataTable dt;
        //    //			if(user.HasPermissionID(newsmanageid))
        //    //			{
        //    //				dt=nc.GetNewsClassList("").Tables[0];
        //    //			}
        //    //			else
        //    //			{
        //    //				dt=nc.GetNewsClassList(int.Parse(currentUser.DepartmentID)).Tables[0];
        //    dt = bll.GetList("").Tables[0];
        //    //			}

        //    this.dropParent.Items.Clear();
        //    //加载树
        //    this.dropParent.Items.Add(new ListItem("顶级目录", "0"));
        //    DataRow[] drs = dt.Select("ParentId= 0");


        //    foreach (DataRow r in drs)
        //    {
        //        string nodeid = r["ClassId"].ToString();
        //        string text = r["ClassDesc"].ToString();
        //        string parentid = r["ParentId"].ToString();
        //        //				string permissionid=r["PermissionID"].ToString();
        //        text = "╋" + text;
        //        this.dropParent.Items.Add(new ListItem(text, nodeid));
        //        int sonparentid = int.Parse(nodeid);
        //        string blank = "├";

        //        BindNode(sonparentid, dt, blank);

        //    }
        //    this.dropParent.DataBind();

        //}
        //private void BindNode(int parentid, DataTable dt, string blank)
        //{
        //    DataRow[] drs = dt.Select("ParentID= " + parentid);

        //    foreach (DataRow r in drs)
        //    {
        //        string nodeid = r["ClassId"].ToString();
        //        string text = r["ClassDesc"].ToString();
        //        //string permissionid=r["PermissionID"].ToString();
        //        text = blank + "『" + text + "』";

        //        this.dropParent.Items.Add(new ListItem(text, nodeid));
        //        int sonparentid = int.Parse(nodeid);
        //        string blank2 = blank + "─";

        //        BindNode(sonparentid, dt, blank2);
        //    }
        //}

        //#endregion

        private void ShowInfo(int id)
        {
            Navigation011.Para_Str = "id=" + id;
            Maticsoft.BLL.NewsManage.NewsClass   bll   = new Maticsoft.BLL.NewsManage.NewsClass();
            Maticsoft.Model.NewsManage.NewsClass model = bll.GetModel(id);
            this.lblClassId.Text = model.ClassId.ToString();
            txtClassDesc.Text    = model.ClassDesc;
            txtClassPicture.Text = model.ClassPicture;
        }
Example #9
0
 private void ShowInfo(int Id)
 {
     Navigation011.Para_Str = "id=" + Id;
     Maticsoft.BLL.NewsManage.NewsClass   bll   = new Maticsoft.BLL.NewsManage.NewsClass();
     Maticsoft.Model.NewsManage.NewsClass model = bll.GetModel(Id);
     lblClassId.Text      = model.ClassId.ToString();
     lblClassDesc.Text    = model.ClassDesc;
     lblClassPicture.Text = model.ClassPicture;
     lblParentId.Text     = model.ParentId.ToString();
 }
Example #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Maticsoft.Model.NewsManage.NewsClass model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_NewsClass(");
            strSql.Append("ClassDesc,ClassPicture,ParentId)");
            strSql.Append(" values (");
            strSql.Append("@ClassDesc,@ClassPicture,@ParentId)");

            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ClassDesc", DbType.String, model.ClassDesc);
            db.AddInParameter(dbCommand, "ClassPicture", DbType.String, model.ClassPicture);
            db.AddInParameter(dbCommand, "ParentId", DbType.Int16, model.ParentId);
            db.ExecuteNonQuery(dbCommand);
            //db.GetParameterValue(dbCommand,"ClassId");
        }
Example #11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Maticsoft.Model.NewsManage.NewsClass model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_NewsClass set ");
            strSql.Append("ClassDesc=@ClassDesc,");
            strSql.Append("ClassPicture=@ClassPicture,");
            strSql.Append("ParentId=@ParentId");
            strSql.Append(" where ClassId=@ClassId");

            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ClassId", DbType.Int16, model.ClassId);
            db.AddInParameter(dbCommand, "ClassDesc", DbType.String, model.ClassDesc);
            db.AddInParameter(dbCommand, "ClassPicture", DbType.String, model.ClassPicture);
            db.AddInParameter(dbCommand, "ParentId", DbType.Int16, model.ParentId);
            db.ExecuteNonQuery(dbCommand);
        }
Example #12
0
        protected void BindClassList(int ClassID)
        {
            string strWhere = "";
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model = bll.GetModel(ClassID);
            int parentid = model.ParentId;
            if (parentid != 0)
            {
                model = bll.GetModelByCache(parentid);
                parentid = model.ParentId;
            }

            strWhere = "parentid=" + model.ClassId;
            DataSet ds = new DataSet();
            ds = bll.GetList(strWhere);
            DataTable dt = ds.Tables[0];


        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //邦定类别的树菜单
         BiudTree();
         if (Session["newsclass"] != null)
         {
             Maticsoft.Model.NewsManage.NewsClass model = (Maticsoft.Model.NewsManage.NewsClass)Session["newsclass"];
             for (int m = 0; m < this.dropParent.Items.Count; m++)
             {
                 if (this.dropParent.Items[m].Value == model.ParentId.ToString())
                 {
                     this.dropParent.Items[m].Selected = true;
                 }
             }
             this.chkAddContinue.Checked = true;
         }
     }
 }
Example #14
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int classid = int.Parse(lblClassId.Text);
            string ClassDesc = this.txtClassDesc.Text;
            string ClassPicture = this.txtClassPicture.Text;
            int ParentId = 0;
            if (this.dropParent.SelectedIndex > 0)
            {
                ParentId = int.Parse(this.dropParent.SelectedValue);
            }

            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassId = classid;
            model.ClassDesc = ClassDesc;
            model.ClassPicture = ClassPicture;
            model.ParentId = ParentId;
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            bll.Update(model);
            Response.Redirect("show.aspx?id=" + classid);
        }
Example #15
0
        protected void BindClassList(int ClassID)
        {
            string strWhere = "";

            Maticsoft.BLL.NewsManage.NewsClass   bll   = new Maticsoft.BLL.NewsManage.NewsClass();
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model = bll.GetModel(ClassID);
            int parentid = model.ParentId;

            if (parentid != 0)
            {
                model    = bll.GetModelByCache(parentid);
                parentid = model.ParentId;
            }

            strWhere = "parentid=" + model.ClassId;
            DataSet ds = new DataSet();

            ds = bll.GetList(strWhere);
            DataTable dt = ds.Tables[0];
        }
Example #16
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int    classid      = int.Parse(lblClassId.Text);
            string ClassDesc    = this.txtClassDesc.Text;
            string ClassPicture = this.txtClassPicture.Text;
            int    ParentId     = 0;

            if (this.dropParent.SelectedIndex > 0)
            {
                ParentId = int.Parse(this.dropParent.SelectedValue);
            }

            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassId      = classid;
            model.ClassDesc    = ClassDesc;
            model.ClassPicture = ClassPicture;
            model.ParentId     = ParentId;
            Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
            bll.Update(model);
            Response.Redirect("show.aspx?id=" + classid);
        }
Example #17
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Maticsoft.Model.NewsManage.NewsClass model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_NewsClass(");
            strSql.Append("ClassDesc,ClassPicture,ParentId)");
            strSql.Append(" values (");
            strSql.Append("@ClassDesc,@ClassPicture,@ParentId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClassDesc",    SqlDbType.VarChar,  50),
                new SqlParameter("@ClassPicture", SqlDbType.VarChar, 100),
                new SqlParameter("@ParentId",     SqlDbType.Int, 4)
            };

            parameters[0].Value = model.ClassDesc;
            parameters[1].Value = model.ClassPicture;
            parameters[2].Value = model.ParentId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            //return model.ClassId;
        }
Example #18
0
        protected void BindClassList(int ClassID)
        {
            string strWhere = "";

            Maticsoft.BLL.NewsManage.NewsClass   bll   = new Maticsoft.BLL.NewsManage.NewsClass();
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model = bll.GetModel(ClassID);
            int parentid = model.ParentId;

            if (parentid != 0)
            {
                model    = bll.GetModelByCache(parentid);
                parentid = model.ParentId;
            }

            strWhere = "parentid=" + model.ClassId;
            DataSet ds = new DataSet();

            ds = bll.GetList(strWhere);
            DataTable dt = ds.Tables[0];

            this.ClassName.InnerHtml = model.ClassDesc;


            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string classname = "nav_2";
                    // Ñ¡ÖÐ״̬Ñùʽ
                    if (ClassID.ToString() == dt.Rows[i][0].ToString())
                    {
                        classname = "nav_2_on";
                    }
                    this.ClassList.InnerHtml += "<li class='" + classname + "'><img src='images/picto_feuilles.gif' align='absmiddle' /><a href='main.aspx?classid=" + dt.Rows[i][0].ToString() + "' >" + dt.Rows[i][1].ToString() + "</a></li>";
                }
            }
        }
Example #19
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Maticsoft.Model.NewsManage.NewsClass model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_NewsClass set ");
            strSql.Append("ClassDesc=@ClassDesc,");
            strSql.Append("ClassPicture=@ClassPicture,");
            strSql.Append("ParentId=@ParentId");
            strSql.Append(" where ClassId=@ClassId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClassId",      SqlDbType.Int,       4),
                new SqlParameter("@ClassDesc",    SqlDbType.VarChar,  50),
                new SqlParameter("@ClassPicture", SqlDbType.VarChar, 100),
                new SqlParameter("@ParentId",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ClassId;
            parameters[1].Value = model.ClassDesc;
            parameters[2].Value = model.ClassPicture;
            parameters[3].Value = model.ParentId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #20
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NewsManage.NewsClass GetModel(int ClassId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from T_NewsClass ");
            strSql.Append(" where ClassId=@ClassId");
            SqlParameter[] parameters = {
					new SqlParameter("@ClassId", SqlDbType.Int,4)};
            parameters[0].Value = ClassId;
            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            model.ClassId = ClassId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ClassDesc = ds.Tables[0].Rows[0]["ClassDesc"].ToString();
                model.ClassPicture = ds.Tables[0].Rows[0]["ClassPicture"].ToString();
                if (ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentId = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Example #21
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Maticsoft.Model.NewsManage.NewsClass model)
 {
     dal.Update(model);
 }
Example #22
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Maticsoft.Model.NewsManage.NewsClass GetModel(int ClassId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from T_NewsClass ");
            strSql.Append(" where ClassId=@ClassId");

            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ClassId", DbType.Int16, ClassId);
            DataSet ds=db.ExecuteDataSet(dbCommand);

            Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass();
            model.ClassId = ClassId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ClassDesc = ds.Tables[0].Rows[0]["ClassDesc"].ToString();
                model.ClassPicture = ds.Tables[0].Rows[0]["ClassPicture"].ToString();
                if (ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentId = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Example #23
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Maticsoft.Model.NewsManage.NewsClass model)
 {
     dal.Add(model);
 }