private void BindShow()
 {
     Tz888.Model.NewsTypeTab newtype = newstypetabbll.GetNewsTypeByTypeId(id);
     this.txtnewsTitle.Text = newtype.TypeName.ToString().Trim();
     this.radiocaozuo.Items.FindByValue(newtype.BoolStar.ToString().Trim()).Selected = true;
     this.radiotuijian.Items.FindByValue(newtype.Outid.ToString().Trim()).Selected   = true;
 }
Exemple #2
0
        public int UpdateNewTypeTab(Tz888.Model.NewsTypeTab newstypetab)
        {
            string sql = "update  NewsTypeTab set TypeName=@typename,BoolStar=@boolstar,outid=@outid where TypeID=@typeid";

            SqlParameter[] ps     = new SqlParameter[] { new SqlParameter("typename", newstypetab.TypeName), new SqlParameter("boolstar", newstypetab.BoolStar), new SqlParameter("outid", newstypetab.Outid), new SqlParameter("typeid", newstypetab.TypeID) };
            int            result = DBHelper.ExecuteCommand(sql, ps);

            return(result);
        }
Exemple #3
0
        public int InsertNewTypeTab(Tz888.Model.NewsTypeTab newstypetab)
        {
            string sql = "Insert into NewsTypeTab (TypeName,BoolStar,outid) values(@typename,@boolstar,@outid)";

            SqlParameter[] ps     = new SqlParameter[] { new SqlParameter("typename", newstypetab.TypeName), new SqlParameter("boolstar", newstypetab.BoolStar), new SqlParameter("outid", newstypetab.Outid) };
            int            result = DBHelper.ExecuteCommand(sql, ps);

            return(result);
        }
        public Tz888.Model.NewsTypeTab GetNewsTypeByTypeId(int typeId)
        {
            string  sql = "select TypeID ,TypeName from NewsTypeTab where TypeID=@typeid";
            DataSet set = DBHelpe.Query(sql, new SqlParameter("typeid", typeId));

            Tz888.Model.NewsTypeTab newstypetab = null;
            foreach (DataRow row in set.Tables[0].Rows)
            {
                newstypetab          = new Tz888.Model.NewsTypeTab();
                newstypetab.TypeID   = Convert.ToInt32(row["TypeID"]);
                newstypetab.TypeName = row["TypeName"].ToString().Trim();
            }
            return(newstypetab);
        }
Exemple #5
0
    public string GetType(int typeid)
    {
        Tz888.Model.NewsTypeTab newstypetab = newstypetabbll.GetNewsTypeByTypeId(typeid);
        string pard = "";

        if (newstypetab == null)
        {
            pard = "";
        }
        else
        {
            pard = newstypetab.TypeName.ToString().Trim();
        }
        return(pard);
    }
Exemple #6
0
        public List <Tz888.Model.NewsTypeTab> GetAllNewsType()
        {
            string sql = "select TypeID ,TypeName from NewsTypeTab where BoolStar=1";
            List <Tz888.Model.NewsTypeTab> list = new List <NewsTypeTab>();
            DataSet set = null;

            set = DBHelper.Query(sql);
            foreach (DataRow row in set.Tables[0].Rows)
            {
                Tz888.Model.NewsTypeTab newstypetab = new Tz888.Model.NewsTypeTab();
                newstypetab.TypeID   = Convert.ToInt32(row["TypeID"]);
                newstypetab.TypeName = row["TypeName"].ToString().Trim();
                list.Add(newstypetab);
            }
            return(list);
        }
Exemple #7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Tz888.BLL.news.NewsTypeTabBLL newtypebll  = new Tz888.BLL.news.NewsTypeTabBLL();
        Tz888.Model.NewsTypeTab       newstypetab = new Tz888.Model.NewsTypeTab();
        newstypetab.TypeName = txtnewsTitle.Text.Trim();
        newstypetab.Outid    = Convert.ToInt32(radiotuijian.SelectedValue.Trim());
        newstypetab.BoolStar = Convert.ToInt32(radiocaozuo.SelectedValue.Trim());
        if (txtnewsTitle.Text.Trim() == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入名称');", true);
            return;
        }
        int result = newtypebll.InsertNewTypeTab(newstypetab);

        if (result > 0)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewTypeManage.aspx';", true);
        }
        else
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('录入失败');", true);
        }
    }