Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.NicheTypeInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into NicheTypeInfo(");
            strSql.Append("NicheTypeTitle)");
            strSql.Append(" values (");
            strSql.Append("@NicheTypeTitle)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NicheTypeTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.NicheTypeTitle;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.NicheTypeInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update NicheTypeInfo set ");
            strSql.Append("NicheTypeTitle=@NicheTypeTitle");
            strSql.Append(" where NicheTypeID=@NicheTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NicheTypeID",    SqlDbType.Int,     4),
                new SqlParameter("@NicheTypeTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.NicheTypeID;
            parameters[1].Value = model.NicheTypeTitle;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["NicheID"] != null)
         {
             if (Request.QueryString["NicheID"].ToString() != "")
             {
                 int nicheid = int.Parse(Request.QueryString["NicheID"].ToString());
                 Maticsoft.BLL.NicheInfo       nichebll   = new Maticsoft.BLL.NicheInfo();
                 Maticsoft.Model.NicheInfo     nichemodel = nichebll.GetModel(nicheid);
                 Maticsoft.BLL.NicheTypeInfo   typebll    = new Maticsoft.BLL.NicheTypeInfo();
                 Maticsoft.Model.NicheTypeInfo typemodel  = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString()));
                 lblFatime.Text         = Convert.ToDateTime(nichemodel.Fatime.ToString()).ToString("yyyy-MM-dd");
                 lblNicheContent.Text   = nichemodel.NicheContent;
                 lblNicheTitle.Text     = nichemodel.NicheTitle;
                 lblNicheTypeTitle.Text = typemodel.NicheTypeTitle;
                 lblWrite.Text          = nichemodel.Write;
             }
             else
             {
                 Response.Redirect("NicheList.aspx");
             }
         }
         else
         {
             Response.Redirect("NicheList.aspx");
         }
     }
 }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NicheTypeInfo GetModel(int NicheTypeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 NicheTypeID,NicheTypeTitle from NicheTypeInfo ");
            strSql.Append(" where NicheTypeID=@NicheTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NicheTypeID", SqlDbType.Int, 4)
            };
            parameters[0].Value = NicheTypeID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["NicheTypeID"].ToString() != "")
                {
                    model.NicheTypeID = int.Parse(ds.Tables[0].Rows[0]["NicheTypeID"].ToString());
                }
                model.NicheTypeTitle = ds.Tables[0].Rows[0]["NicheTypeTitle"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
 private void ShowInfo(int NicheTypeID)
 {
     Maticsoft.BLL.NicheTypeInfo   bll   = new Maticsoft.BLL.NicheTypeInfo();
     Maticsoft.Model.NicheTypeInfo model = bll.GetModel(NicheTypeID);
     this.lblNicheTypeID.Text    = model.NicheTypeID.ToString();
     this.lblNicheTypeTitle.Text = model.NicheTypeTitle;
 }
Example #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtNicheTypeTitle.Text.Trim().Length == 0)
            {
                strErr += "NicheTypeTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    NicheTypeID    = int.Parse(this.lblNicheTypeID.Text);
            string NicheTypeTitle = this.txtNicheTypeTitle.Text;


            Maticsoft.Model.NicheTypeInfo model = new Maticsoft.Model.NicheTypeInfo();
            model.NicheTypeID    = NicheTypeID;
            model.NicheTypeTitle = NicheTypeTitle;

            Maticsoft.BLL.NicheTypeInfo bll = new Maticsoft.BLL.NicheTypeInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #7
0
        protected void datamess_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int index = int.Parse(datamess.DataKeys[e.Item.ItemIndex].ToString());

            Maticsoft.BLL.NicheInfo       nichebll   = new Maticsoft.BLL.NicheInfo();
            Maticsoft.Model.NicheInfo     nichemodel = nichebll.GetModel(index);
            Maticsoft.BLL.NicheTypeInfo   typebll    = new Maticsoft.BLL.NicheTypeInfo();
            Maticsoft.Model.NicheTypeInfo typemodel  = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString()));
            ((Label)e.Item.FindControl("lbltype")).Text = typemodel.NicheTypeTitle;
        }
Example #8
0
 protected void btntype_Click(object sender, EventArgs e)
 {
     if (txtaddtype.Text.Trim() == "")
     {
         lbladdtype.Text = "请填写服务类型";
         return;
     }
     Maticsoft.BLL.NicheTypeInfo   typebll   = new Maticsoft.BLL.NicheTypeInfo();
     Maticsoft.Model.NicheTypeInfo typemodel = new Maticsoft.Model.NicheTypeInfo();
     typemodel.NicheTypeTitle = txtaddtype.Text.Trim();
     typebll.Add(typemodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<SCRIPT>alert('信息提交成功)</SCRIPT>");
 }
Example #9
0
 protected void btnNiche_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.NicheTypeInfo   nichebll   = new Maticsoft.BLL.NicheTypeInfo();
     Maticsoft.Model.NicheTypeInfo nichemodel = new Maticsoft.Model.NicheTypeInfo();
     if (txtNiche.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请将填写完整!')</script>");
         return;
     }
     nichemodel.NicheTypeTitle = txtNiche.Text.Trim();
     nichebll.Add(nichemodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
     txtNiche.Text = string.Empty;
 }
Example #10
0
        private void bind()
        {
            Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo();
            int index = int.Parse(Request.QueryString["NicheID"].ToString());

            Maticsoft.Model.NicheInfo     nichemodel = nichebll.GetModel(index);
            Maticsoft.BLL.NicheTypeInfo   typebll    = new Maticsoft.BLL.NicheTypeInfo();
            Maticsoft.Model.NicheTypeInfo typemodel  = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString()));
            lbldatime.Text     = Convert.ToDateTime(nichemodel.Fatime.ToString()).ToString("yyyy-MM-dd");
            lblkey.Text        = nichemodel.NicheKey;
            lblNichetitle.Text = nichemodel.NicheTitle;
            lbltype.Text       = typemodel.NicheTypeTitle;
            lblwrite.Text      = nichemodel.Write;
            Image1.ImageUrl    = nichemodel.ImageURL;
            txtcontent.Text    = nichemodel.NicheContent;
        }
Example #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtNicheTypeTitle.Text.Trim().Length == 0)
            {
                strErr += "NicheTypeTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string NicheTypeTitle = this.txtNicheTypeTitle.Text;

            Maticsoft.Model.NicheTypeInfo model = new Maticsoft.Model.NicheTypeInfo();
            model.NicheTypeTitle = NicheTypeTitle;

            Maticsoft.BLL.NicheTypeInfo bll = new Maticsoft.BLL.NicheTypeInfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }