Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TFXK.Model.Category GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,title,codeNo,parentID,description,orderId,imgPath,stateID,typeID,outLink,simpleDes,otherDes1,otherDes2 from tb_Category ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            TFXK.Model.Category model = new TFXK.Model.Category();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.title  = ds.Tables[0].Rows[0]["title"].ToString();
                model.codeNo = ds.Tables[0].Rows[0]["codeNo"].ToString();
                if (ds.Tables[0].Rows[0]["parentID"].ToString() != "")
                {
                    model.parentID = int.Parse(ds.Tables[0].Rows[0]["parentID"].ToString());
                }
                model.description = ds.Tables[0].Rows[0]["description"].ToString();
                if (ds.Tables[0].Rows[0]["orderId"].ToString() != "")
                {
                    model.orderId = int.Parse(ds.Tables[0].Rows[0]["orderId"].ToString());
                }
                model.imgPath = ds.Tables[0].Rows[0]["imgPath"].ToString();
                if (ds.Tables[0].Rows[0]["stateID"].ToString() != "")
                {
                    model.stateID = int.Parse(ds.Tables[0].Rows[0]["stateID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["typeID"].ToString() != "")
                {
                    model.typeID = int.Parse(ds.Tables[0].Rows[0]["typeID"].ToString());
                }
                model.outLink   = ds.Tables[0].Rows[0]["outLink"].ToString();
                model.simpleDes = ds.Tables[0].Rows[0]["simpleDes"].ToString();
                model.otherDes1 = ds.Tables[0].Rows[0]["otherDes1"].ToString();
                model.otherDes2 = ds.Tables[0].Rows[0]["otherDes2"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TFXK.Model.Category model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Category set ");
            strSql.Append("title=@title,");
            strSql.Append("codeNo=@codeNo,");
            strSql.Append("parentID=@parentID,");
            strSql.Append("description=@description,");
            strSql.Append("orderId=@orderId,");
            strSql.Append("imgPath=@imgPath,");
            strSql.Append("stateID=@stateID,");
            strSql.Append("typeID=@typeID,");
            strSql.Append("outLink=@outLink,");
            strSql.Append("simpleDes=@simpleDes,");
            strSql.Append("otherDes1=@otherDes1,");
            strSql.Append("otherDes2=@otherDes2");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",          SqlDbType.Int,        4),
                new SqlParameter("@title",       SqlDbType.VarChar,   50),
                new SqlParameter("@codeNo",      SqlDbType.VarChar,   50),
                new SqlParameter("@parentID",    SqlDbType.Int,        4),
                new SqlParameter("@description", SqlDbType.Text),
                new SqlParameter("@orderId",     SqlDbType.Int,        4),
                new SqlParameter("@imgPath",     SqlDbType.VarChar,   50),
                new SqlParameter("@stateID",     SqlDbType.Int,        4),
                new SqlParameter("@typeID",      SqlDbType.Int,        4),
                new SqlParameter("@outLink",     SqlDbType.VarChar,  100),
                new SqlParameter("@simpleDes",   SqlDbType.VarChar, 5000),
                new SqlParameter("@otherDes1",   SqlDbType.VarChar,   50),
                new SqlParameter("@otherDes2",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.title;
            parameters[2].Value  = model.codeNo;
            parameters[3].Value  = model.parentID;
            parameters[4].Value  = model.description;
            parameters[5].Value  = model.orderId;
            parameters[6].Value  = model.imgPath;
            parameters[7].Value  = model.stateID;
            parameters[8].Value  = model.typeID;
            parameters[9].Value  = model.outLink;
            parameters[10].Value = model.simpleDes;
            parameters[11].Value = model.otherDes1;
            parameters[12].Value = model.otherDes2;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TFXK.Model.Category GetModel(string code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,title,codeNo,parentID,description,orderId,imgPath,stateID,typeID,outLink from tb_Category ");
            strSql.Append(" where codeNo=@code ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@code", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = code;

            TFXK.Model.Category model = new TFXK.Model.Category();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.title  = ds.Tables[0].Rows[0]["title"].ToString();
                model.codeNo = ds.Tables[0].Rows[0]["codeNo"].ToString();
                if (ds.Tables[0].Rows[0]["parentID"].ToString() != "")
                {
                    model.parentID = int.Parse(ds.Tables[0].Rows[0]["parentID"].ToString());
                }
                model.description = ds.Tables[0].Rows[0]["description"].ToString();
                if (ds.Tables[0].Rows[0]["orderId"].ToString() != "")
                {
                    model.orderId = int.Parse(ds.Tables[0].Rows[0]["orderId"].ToString());
                }
                model.imgPath = ds.Tables[0].Rows[0]["imgPath"].ToString();
                if (ds.Tables[0].Rows[0]["stateID"].ToString() != "")
                {
                    model.stateID = int.Parse(ds.Tables[0].Rows[0]["stateID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["typeID"].ToString() != "")
                {
                    model.typeID = int.Parse(ds.Tables[0].Rows[0]["typeID"].ToString());
                }
                model.outLink = ds.Tables[0].Rows[0]["outLink"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TFXK.Model.Category model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Category(");
            strSql.Append("title,codeNo,parentID,description,orderId,imgPath,stateID,typeID,outLink,simpleDes,otherDes1,otherDes2)");
            strSql.Append(" values (");
            strSql.Append("@title,@codeNo,@parentID,@description,@orderId,@imgPath,@stateID,@typeID,@outLink,@simpleDes,@otherDes1,@otherDes2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",       SqlDbType.VarChar,   50),
                new SqlParameter("@codeNo",      SqlDbType.VarChar,   50),
                new SqlParameter("@parentID",    SqlDbType.Int,        4),
                new SqlParameter("@description", SqlDbType.Text),
                new SqlParameter("@orderId",     SqlDbType.Int,        4),
                new SqlParameter("@imgPath",     SqlDbType.VarChar,   50),
                new SqlParameter("@stateID",     SqlDbType.Int,        4),
                new SqlParameter("@typeID",      SqlDbType.Int,        4),
                new SqlParameter("@outLink",     SqlDbType.VarChar,  100),
                new SqlParameter("@simpleDes",   SqlDbType.VarChar, 5000),
                new SqlParameter("@otherDes1",   SqlDbType.VarChar,   50),
                new SqlParameter("@otherDes2",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.title;
            parameters[1].Value  = model.codeNo;
            parameters[2].Value  = model.parentID;
            parameters[3].Value  = model.description;
            parameters[4].Value  = model.orderId;
            parameters[5].Value  = model.imgPath;
            parameters[6].Value  = model.stateID;
            parameters[7].Value  = model.typeID;
            parameters[8].Value  = model.outLink;
            parameters[9].Value  = model.simpleDes;
            parameters[10].Value = model.otherDes1;
            parameters[11].Value = model.otherDes2;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int exid = 0;

        if (int.TryParse(Request.QueryString["id"] + "", out exid) && exid > 0)
        {
            InitExamData(exid);
            //var data = ExamAuthHelper.GetAuthPersonID(this.Context);
            //InitData(data);
            bkfysmCategory = bllCategory.GetModel("bkfysm");
        }
        else
        {
            Response.Redirect("Default.aspx");
            Response.End();
        }
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string ids = Request.QueryString["id"] + "";
            int    id  = 0;
            if (string.IsNullOrEmpty(ids) || !int.TryParse(ids, out id) || id <= 0)
            {
                Response.Redirect("/Default.aspx");
            }
            articles = bllArticles.GetModel(id);
            if (articles == null)
            {
                Response.Redirect("/Default.aspx");
            }
            bllArticles.UpdateClick(id);

            currentCategory = bllCategory.GetModel(articles.parentId);
            if (currentCategory != null)
            {
                LeftNavControl.navParentID      = currentCategory.parentID;
                LeftNavControl.navCode          = currentCategory.codeNo;
                LocationControl.currentCategory = currentCategory;

                parentCategory = bllCategory.GetModel(currentCategory.parentID);
                if (parentCategory != null)
                {
                    LocationControl.parentCategory = parentCategory;
                    LeftNavControl.navTitle        = parentCategory.title;
                    Page.Title = articles.title + "-" + currentCategory.title + "-" + parentCategory.title;


                    activeNav = LocationControl.GetNavName();
                }
                else
                {
                    LeftNavControl.navTitle = currentCategory.title;
                    Page.Title = articles.title + "-" + currentCategory.title;
                }
            }
            else
            {
                Response.Redirect("~/");
            }
        }
    }
Esempio n. 7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TFXK.Model.Category> DataTableToList(DataTable dt)
        {
            List <TFXK.Model.Category> modelList = new List <TFXK.Model.Category>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TFXK.Model.Category model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TFXK.Model.Category();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.title  = dt.Rows[n]["title"].ToString();
                    model.codeNo = dt.Rows[n]["codeNo"].ToString();
                    if (dt.Rows[n]["parentID"].ToString() != "")
                    {
                        model.parentID = int.Parse(dt.Rows[n]["parentID"].ToString());
                    }
                    model.description = dt.Rows[n]["description"].ToString();
                    if (dt.Rows[n]["orderId"].ToString() != "")
                    {
                        model.orderId = int.Parse(dt.Rows[n]["orderId"].ToString());
                    }
                    model.imgPath = dt.Rows[n]["imgPath"].ToString();
                    if (dt.Rows[n]["stateID"].ToString() != "")
                    {
                        model.stateID = int.Parse(dt.Rows[n]["stateID"].ToString());
                    }
                    if (dt.Rows[n]["typeID"].ToString() != "")
                    {
                        model.typeID = int.Parse(dt.Rows[n]["typeID"].ToString());
                    }
                    model.outLink   = dt.Rows[n]["outLink"].ToString();
                    model.simpleDes = dt.Rows[n]["simpleDes"].ToString();
                    model.otherDes1 = dt.Rows[n]["otherDes1"].ToString();
                    model.otherDes2 = dt.Rows[n]["otherDes2"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 8
0
        /// <summary>
        /// 更具编号获取父分类的编号
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns>dataset pid</returns>
        public DataSet GetParentIdsByID(int id)
        {
            Model.Category model = new TFXK.Model.Category();
            model.parentID = id;
            DataTable dt = new DataTable();

            dt.Columns.Add("pid");
            while (model != null && model.parentID != 0)
            {
                model = GetParentID(model.parentID);
                DataRow dr = dt.NewRow();
                dr["pid"] = model.parentID;
                dt.Rows.Add(dr);
            }
            DataSet ds = new DataSet();

            ds.Tables.Add(dt);
            return(ds);
        }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string code = Request.QueryString["code"] + "";
            if (string.IsNullOrEmpty(code))
            {
                code = "zxjj";
            }
            if (code.Equals("zxly"))
            {
                Response.Redirect("Message.aspx");
            }

            currentCategory = bllCategory.GetModel(code);
            if (currentCategory != null)
            {
                LocationControl.currentCategory = currentCategory;
                LeftNavControl.navParentID      = currentCategory.parentID;
                LeftNavControl.navCode          = code;
                parentCategory = bllCategory.GetModel(currentCategory.parentID);
                if (parentCategory != null)
                {
                    //set nav
                    LocationControl.parentCategory = parentCategory;
                    activeNav = LocationControl.GetNavName();

                    LeftNavControl.navTitle = parentCategory.title;
                    Page.Title = currentCategory.title + "-" + parentCategory.title;
                }
                else
                {
                    LeftNavControl.navTitle = currentCategory.title;
                    Page.Title = currentCategory.title;
                }
            }
            else
            {
                Response.Redirect("~/");
            }
        }
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string code = Request.QueryString["code"] + "";
            if (string.IsNullOrEmpty(code))
            {
                code = "zxjj";
            }

            currentCategory = bllCategory.GetModel(code);
            if (currentCategory != null)
            {
                LeftNavControl.navParentID      = currentCategory.parentID;
                LeftNavControl.navCode          = code;
                LocationControl.currentCategory = currentCategory;

                parentCategory = bllCategory.GetModel(currentCategory.parentID);
                if (parentCategory != null)
                {                    //set nav
                    LocationControl.parentCategory = parentCategory;
                    activeNav = LocationControl.GetNavName();

                    LeftNavControl.navTitle = parentCategory.title;
                    Page.Title = currentCategory.title + "-" + parentCategory.title;
                }
                else
                {
                    LeftNavControl.navTitle = currentCategory.title;
                    Page.Title = currentCategory.title;
                }

                rptSubCategory.DataSource = bllCategory.GetNextNodeByCode(currentCategory.codeNo);
                rptSubCategory.DataBind();
            }
            else
            {
                Response.Redirect("~/");
            }
        }
    }
Esempio n. 11
0
    private void InitData()
    {
        string code = Request.QueryString["code"] + "";

        if (string.IsNullOrEmpty(code))
        {
            code = "zxly";
        }

        currentCategory = bllCategory.GetModel(code);
        if (currentCategory != null)
        {
            LocationControl.currentCategory = currentCategory;
            LeftNavControl.navParentID      = currentCategory.parentID;
            LeftNavControl.navCode          = code;
            parentCategory = bllCategory.GetModel(currentCategory.parentID);
            if (parentCategory != null)
            {
                //set nav
                LocationControl.parentCategory = parentCategory;
                activeNav = LocationControl.GetNavName();

                LeftNavControl.navTitle = parentCategory.title;
                Page.Title = currentCategory.title + "-" + parentCategory.title;
            }
            else
            {
                LeftNavControl.navTitle = currentCategory.title;
                Page.Title = currentCategory.title;
            }
        }
        else
        {
            Response.Redirect("~/");
        }
    }
Esempio n. 12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TFXK.Model.Category model)
 {
     dal.Update(model);
 }
Esempio n. 13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TFXK.Model.Category model)
 {
     return(dal.Add(model));
 }