예제 #1
0
        /// <summary>
        /// 根据id得到会客类型实体
        /// </summary>
        /// <param name="type_id"></param>
        /// <returns></returns>
        public YouthReceptionType GetListById(int type_id)
        {
            YouthReceptionType model = new YouthReceptionType();
            StringBuilder      str   = new StringBuilder();

            str.Append(" select * from reception_type ");
            str.Append(" where reception_type_id= " + type_id);
            DataSet ds = DbHelperSQL.Query(str.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["reception_type_id"] != null)
                {
                    model.Reception_type_id = Convert.ToInt32(ds.Tables[0].Rows[0]["reception_type_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["reception_type"] != null)
                {
                    model.Reception_type = ds.Tables[0].Rows[0]["reception_type"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
        protected void bindReceptionType()
        {
            int type_id = Convert.ToInt32(ViewState["type_id"].ToString());

            model        = bll.GetListById(type_id);
            txtName.Text = model.Reception_type;
        }
        /// <summary>
        /// 添加会客版块
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddReceptionType(YouthReceptionType model)
        {
            int rows = dal.AddReceptionType(model);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            YouthReceptionType    model = new YouthReceptionType();
            YouthReceptionTypeBLL bll   = new YouthReceptionTypeBLL();

            model.Reception_type = txtName.Text.ToString();
            if (bll.AddReceptionType(model))
            {
                MyUtil.ShowMessageRedirect(this.Page, "添加成功", "ReceptionType.aspx");
            }
            else
            {
                MyUtil.ShowMessage(this.Page, "添加失败");
            }
        }
예제 #5
0
        /// <summary>
        /// 添加会客版块
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddReceptionType(YouthReceptionType model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" insert into reception_type ");
            str.Append(" (reception_type) ");
            str.Append(" values ");
            str.Append("(@reception_type)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@reception_type", SqlDbType.NVarChar, 25)
            };
            parameters[0].Value = model.Reception_type;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }
예제 #6
0
        /// <summary>
        /// 更新会客类型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdReceptionType(YouthReceptionType model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" update reception_type set  ");
            str.Append(" reception_type=@reception_type ");
            str.Append(" where reception_type_id=@reception_type_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@reception_type",    SqlDbType.NVarChar, 25),
                new SqlParameter("@reception_type_id", SqlDbType.Int, 8)
            };
            parameters[0].Value = model.Reception_type;
            parameters[1].Value = model.Reception_type_id;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }