Пример #1
0
        private AjaxResult Del(int id)
        {
            BLL.BLLBase bll = new BLLBase();
            AjaxResult re = null;

            var ctx = new Common.DataContext();

            ctx.BeginTransaction();
            try
            {
                bll.Update(ctx, new Model.Channel() {ID = id, State = 255});

                ctx.CommitTransaction();

                re = new AjaxResult() {Success = 1};
            }
            catch (Exception ex)
            {
                ctx.RollBackTransaction();

                re = new AjaxResult() {Success = 0, Message = "操作失败,原因:" + ex.Message};
            }
            finally
            {
                ctx.CloseConnection();
            }

            return re;
        }
Пример #2
0
        private AjaxResult ResetPwd(int id)
        {
            BLL.BLLBase bll = new BLLBase();
            AjaxResult re = null;

            this.ctx.BeginTransaction();
            try
            {
                bll.Update(this.ctx, new Admin() {ID = id, Password = PubFunc.Md5("123456")});

                this.ctx.CommitTransaction();

                re = new AjaxResult() { Success = 1 };
            }
            catch (Exception ex)
            {
                this.ctx.RollBackTransaction();

                re = new AjaxResult() { Success = 0, Message = "操作失败,原因:" + ex.Message };
            }
            finally
            {
                this.ctx.CloseConnection();
            }

            return re;
        }