示例#1
0
 private void ShowInfo(int _id)
 {
     BLL.attributes   bll   = new BLL.attributes();
     Model.attributes model = bll.GetModel(_id);
     txtTitle.Text         = model.title;
     txtRemark.Text        = model.remark;
     ddlType.SelectedValue = model.type.ToString();
     txtDefaultValue.Text  = model.default_value;
     txtSortId.Text        = model.sort_id.ToString();
 }
示例#2
0
 private bool DoAdd()
 {
     bool result = true;
     Model.attributes model = new Model.attributes();
     BLL.attributes bll = new BLL.attributes();
     model.channel_id = this.channel_id;
     model.title = txtTitle.Text.Trim();
     model.remark = txtRemark.Text.Trim();
     model.type = int.Parse(ddlType.SelectedValue);
     model.default_value = txtDefaultValue.Text.Trim();
     model.sort_id = int.Parse(txtSortId.Text.Trim());
     if (bll.Add(model) < 1)
     {
         result = false;
     }
     return result;
 }
示例#3
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.attributes   bll   = new BLL.attributes();
            Model.attributes model = bll.GetModel(_id);
            model.title         = txtTitle.Text.Trim();
            model.remark        = txtRemark.Text.Trim();
            model.type          = int.Parse(ddlType.SelectedValue);
            model.default_value = txtDefaultValue.Text.Trim();
            model.sort_id       = int.Parse(txtSortId.Text.Trim());
            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }
示例#4
0
        private bool DoAdd()
        {
            bool result = true;

            Model.attributes model = new Model.attributes();
            BLL.attributes   bll   = new BLL.attributes();
            model.channel_id    = this.channel_id;
            model.title         = txtTitle.Text.Trim();
            model.remark        = txtRemark.Text.Trim();
            model.type          = int.Parse(ddlType.SelectedValue);
            model.default_value = txtDefaultValue.Text.Trim();
            model.sort_id       = int.Parse(txtSortId.Text.Trim());
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
示例#5
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public DTcms.Model.attributes GetModel(int id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,channel_id,title,remark,type,default_value,sort_id,add_time from dt_attributes ");
			strSql.Append(" where id=@id");
			OleDbParameter[] parameters = {
					new OleDbParameter("@id", OleDbType.Integer,4)};
			parameters[0].Value = id;

			Model.attributes model=new Model.attributes();
			DataSet ds=DbHelperOleDb.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["id"]!=null && ds.Tables[0].Rows[0]["id"].ToString()!="")
				{
					model.id=int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
				}
				if(ds.Tables[0].Rows[0]["channel_id"]!=null && ds.Tables[0].Rows[0]["channel_id"].ToString()!="")
				{
					model.channel_id=int.Parse(ds.Tables[0].Rows[0]["channel_id"].ToString());
				}
				if(ds.Tables[0].Rows[0]["title"]!=null && ds.Tables[0].Rows[0]["title"].ToString()!="")
				{
					model.title=ds.Tables[0].Rows[0]["title"].ToString();
				}
				if(ds.Tables[0].Rows[0]["remark"]!=null && ds.Tables[0].Rows[0]["remark"].ToString()!="")
				{
					model.remark=ds.Tables[0].Rows[0]["remark"].ToString();
				}
				if(ds.Tables[0].Rows[0]["type"]!=null && ds.Tables[0].Rows[0]["type"].ToString()!="")
				{
					model.type=int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
				}
				if(ds.Tables[0].Rows[0]["default_value"]!=null && ds.Tables[0].Rows[0]["default_value"].ToString()!="")
				{
					model.default_value=ds.Tables[0].Rows[0]["default_value"].ToString();
				}
				if(ds.Tables[0].Rows[0]["sort_id"]!=null && ds.Tables[0].Rows[0]["sort_id"].ToString()!="")
				{
					model.sort_id=int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
				}
				if(ds.Tables[0].Rows[0]["add_time"]!=null && ds.Tables[0].Rows[0]["add_time"].ToString()!="")
				{
					model.add_time=DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
				}
				return model;
			}
			else
			{
				return null;
			}
		}
示例#6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.attributes model)
 {
     return(dal.Update(model));
 }
示例#7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.attributes model)
 {
     return(dal.Add(model));
 }