Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.online_service model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "online_service set ");
            strSql.Append("group_id=@group_id,");
            strSql.Append("title=@title,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("link_url=@link_url,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",       SqlDbType.Int,        4),
                new SqlParameter("@group_id", SqlDbType.Int,        4),
                new SqlParameter("@title",    SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",  SqlDbType.NVarChar, 255),
                new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
                new SqlParameter("@sort_id",  SqlDbType.Int,        4),
                new SqlParameter("@is_lock",  SqlDbType.TinyInt,    1),
                new SqlParameter("@add_time", SqlDbType.DateTime)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.group_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.img_url;
            parameters[4].Value = model.link_url;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_lock;
            parameters[7].Value = model.add_time;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private bool DoAdd()
        {
            bool result = true;
            Model.online_service model = new Model.online_service();
            BLL.online_service bll = new BLL.online_service();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title = txtTitle.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.add_time = DateTime.Now;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
Exemple #3
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.online_service   bll   = new BLL.online_service();
            Model.online_service model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnlock":
                if (model.is_lock == 1)
                {
                    bll.UpdateField(id, "is_lock=0");
                }
                else
                {
                    bll.UpdateField(id, "is_lock=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort_id asc,id desc");
        }
Exemple #4
0
        private bool DoAdd()
        {
            bool result = false;
            Model.online_service model = new Model.online_service();
            BLL.online_service bll = new BLL.online_service();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title = txtTitle.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.add_time = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加在线客服:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
        private bool DoAdd()
        {
            bool result = true;

            Model.online_service model = new Model.online_service();
            BLL.online_service   bll   = new BLL.online_service();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title    = txtTitle.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.is_lock  = int.Parse(rblIsLock.SelectedValue);
            model.add_time = DateTime.Now;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.online_service   bll   = new BLL.online_service();
            Model.online_service model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title    = txtTitle.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.is_lock  = int.Parse(rblIsLock.SelectedValue);

            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }
Exemple #7
0
        private bool DoAdd()
        {
            bool result = false;

            Model.online_service model = new Model.online_service();
            BLL.online_service   bll   = new BLL.online_service();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title    = txtTitle.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.is_lock  = int.Parse(rblIsLock.SelectedValue);
            model.add_time = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加在线客服:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #8
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.online_service   bll   = new BLL.online_service();
            Model.online_service model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.title    = txtTitle.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            model.is_lock  = int.Parse(rblIsLock.SelectedValue);

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改在线客服:" + model.title); //记录日志
                result = true;
            }

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

            strSql.Append("insert into dt_online_service(");
            strSql.Append("group_id,title,img_url,link_url,sort_id,is_lock,add_time)");
            strSql.Append(" values (");
            strSql.Append("@group_id,@title,@img_url,@link_url,@sort_id,@is_lock,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@group_id", SqlDbType.Int,        4),
                new SqlParameter("@title",    SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",  SqlDbType.NVarChar, 255),
                new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
                new SqlParameter("@sort_id",  SqlDbType.Int,        4),
                new SqlParameter("@is_lock",  SqlDbType.TinyInt,    1),
                new SqlParameter("@add_time", SqlDbType.DateTime)
            };
            parameters[0].Value = model.group_id;
            parameters[1].Value = model.title;
            parameters[2].Value = model.img_url;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.sort_id;
            parameters[5].Value = model.is_lock;
            parameters[6].Value = model.add_time;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #10
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.online_service GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,group_id,title,img_url,link_url,sort_id,is_lock,add_time from " + databaseprefix + "online_service ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.online_service model = new Model.online_service();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["group_id"].ToString() != "")
                {
                    model.group_id = int.Parse(ds.Tables[0].Rows[0]["group_id"].ToString());
                }
                model.title = ds.Tables[0].Rows[0]["title"].ToString();
                model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString();
                if (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]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (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;
            }
        }
Exemple #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.online_service model)
 {
     return(dal.Update(model));
 }
Exemple #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.online_service model)
 {
     return(dal.Add(model));
 }