Esempio n. 1
0
 private void ShowInfo(int _id)
 {
     BLL.floor   bll   = new BLL.floor();
     Model.floor model = bll.GetModel(_id);
     rblBelongChannel.SelectedValue = model.belongchannel.ToString();
     txtfloorname.Text       = model.floorname;
     txtTitle.Text           = model.title;
     txtcolor.Text           = model.color;
     txtRemark.Text          = model.remark;
     rblStatus.SelectedValue = model.status;
     txtSortId.Text          = model.sort_id.ToString();
 }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.floor model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "floors set ");
            strSql.Append("belongchannel=@belongchannel,");
            strSql.Append("floorname=@floorname,");
            strSql.Append("title=@title,");
            strSql.Append("color=@color,");
            strSql.Append("remark=@remark,");
            strSql.Append("add_time=@add_time,");
            strSql.Append("status=@status");
            strSql.Append("sort_id=@sort_id");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@belongchannel", SqlDbType.TinyInt,     1),
                new SqlParameter("@floorname",     SqlDbType.NVarChar,   50),
                new SqlParameter("@title",         SqlDbType.NVarChar,   50),
                new SqlParameter("@color",         SqlDbType.NVarChar,   50),
                new SqlParameter("@remark",        SqlDbType.NVarChar,  255),
                new SqlParameter("@add_time",      SqlDbType.DateTime),
                new SqlParameter("@status",        SqlDbType.TinyInt,     1),
                new SqlParameter("@sort_id",       SqlDbType.Int,         4),
                new SqlParameter("@id",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.belongchannel;
            parameters[1].Value = model.floorname;
            parameters[2].Value = model.title;
            parameters[3].Value = model.color;
            parameters[4].Value = model.remark;
            parameters[5].Value = model.add_time;
            parameters[6].Value = model.status;
            parameters[7].Value = model.sort_id;
            parameters[8].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        private bool DoAdd()
        {
            bool result = false;
            Model.floor model = new Model.floor();
            BLL.floor bll = new BLL.floor();
            model.belongchannel = int.Parse(rblBelongChannel.SelectedValue);
            model.floorname = txtfloorname.Text.Trim();
            model.title = txtTitle.Text.Trim();
            model.color = txtcolor.Text.Trim();
            model.remark = txtRemark.Text.Trim();
            model.status = rblStatus.SelectedValue;
            model.sort_id = int.Parse(txtSortId.Text.Trim());

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加楼层:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
Esempio n. 4
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.floor   bll   = new BLL.floor();
            Model.floor model = bll.GetModel(_id);
            model.belongchannel = int.Parse(rblBelongChannel.SelectedValue);
            model.floorname     = txtfloorname.Text.Trim();
            model.title         = txtTitle.Text.Trim();
            model.color         = txtcolor.Text.Trim();
            model.remark        = txtRemark.Text.Trim();
            model.status        = rblStatus.SelectedValue;
            model.sort_id       = int.Parse(txtSortId.Text.Trim());
            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改楼层:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.floor model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "floors(");
            strSql.Append("belongchannel,floorname,title,color,remark,add_time,status,sort_id)");
            strSql.Append(" values (");
            strSql.Append("@belongchannel,@floorname,@title,@color,@remark,@add_time,@status,@sort_id)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@belongchannel", SqlDbType.TinyInt,     1),
                new SqlParameter("@floorname",     SqlDbType.NVarChar,   50),
                new SqlParameter("@title",         SqlDbType.NVarChar,   50),
                new SqlParameter("@color",         SqlDbType.NVarChar,   50),
                new SqlParameter("@remark",        SqlDbType.NVarChar,  255),
                new SqlParameter("@add_time",      SqlDbType.DateTime),
                new SqlParameter("@status",        SqlDbType.TinyInt,     1),
                new SqlParameter("@sort_id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.belongchannel;
            parameters[1].Value = model.floorname;
            parameters[2].Value = model.title;
            parameters[3].Value = model.color;
            parameters[4].Value = model.remark;
            parameters[5].Value = model.add_time;
            parameters[6].Value = model.status;
            parameters[7].Value = model.sort_id;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.floor GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,belongchannel,floorname,title,color,remark,add_time,status,sort_id from " + databaseprefix + "floors ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.floor model = new Model.floor();
            DataSet ds = DbHelperSQL.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]["belongchannel"] != null && ds.Tables[0].Rows[0]["belongchannel"].ToString() != "")
                {
                    model.belongchannel = int.Parse(ds.Tables[0].Rows[0]["belongchannel"].ToString());
                }
                if (ds.Tables[0].Rows[0]["floorname"] != null && ds.Tables[0].Rows[0]["floorname"].ToString() != "")
                {
                    model.floorname = ds.Tables[0].Rows[0]["floorname"].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]["color"] != null && ds.Tables[0].Rows[0]["color"].ToString() != "")
                {
                    model.color = ds.Tables[0].Rows[0]["color"].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]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = (ds.Tables[0].Rows[0]["status"].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());
                }

                return model;
            }
            else
            {
                return null;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.floor GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,belongchannel,floorname,title,color,remark,add_time,status,sort_id from " + databaseprefix + "floors ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.floor model = new Model.floor();
            DataSet     ds    = DbHelperSQL.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]["belongchannel"] != null && ds.Tables[0].Rows[0]["belongchannel"].ToString() != "")
                {
                    model.belongchannel = int.Parse(ds.Tables[0].Rows[0]["belongchannel"].ToString());
                }
                if (ds.Tables[0].Rows[0]["floorname"] != null && ds.Tables[0].Rows[0]["floorname"].ToString() != "")
                {
                    model.floorname = ds.Tables[0].Rows[0]["floorname"].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]["color"] != null && ds.Tables[0].Rows[0]["color"].ToString() != "")
                {
                    model.color = ds.Tables[0].Rows[0]["color"].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]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = (ds.Tables[0].Rows[0]["status"].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());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.floor model)
 {
     return(dal.Update(model));
 }
Esempio n. 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.floor model)
 {
     return(dal.Add(model));
 }