Ejemplo n.º 1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public IDataShell <IEnumerable <AccountDBModel> > GetList(AccountDBModel account)
        {
            using (var conn = ConnFactory.GetUserConn())
            {
                using (var dal = new UserAccountTDAL(conn))
                {
#if DEBUG
                    try
                    {
                        var result = dal.GetList(account);
                        //throw new Exception("需要捕获的人造错误");
                        return(result);
                    }
                    catch (Exception ex)
                    {
                        return(ex.Fail <IEnumerable <AccountDBModel> >());
                    }
                    return(new DataShell <IEnumerable <AccountDBModel> >());
#else
                    var result = dal.GetList(account);
                    return(result);
#endif
                }
            }
            //return "未能提取到数据".Fail<IEnumerable<BimUser>>();
        }
Ejemplo n.º 2
0
 public IDataShell <AccountDBModel> Login(AccountDBModel account)
 {
     using (var conn = ConnFactory.GetUserConn())
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.GetSingle(account);
             return(result);
         }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取全部用户信息,用于管理端对照提取用户关联信息使用
 /// </summary>
 /// <returns></returns>
 public IDataShell <IEnumerable <AccountDBModel> > GetAllAccount()
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.GetAllAccount();
             return(result);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 分页提取数据
 /// </summary>
 /// <param name="condition"></param>
 /// <returns></returns>
 public IDataShell <PageShell <AccountDBModel> > GetPage(PageCondition <UserQueryPageCondition> condition)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.GetPage(condition);
             return(result);
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取所有用户的简要信息,用于对照名字之类
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> GetAllUser(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var res = dal.GetByCoreID(user);
             return(res);
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 逻辑删除列表通过ids
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public IDataShell <int> DelList(List <string> accountids)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.DelList(accountids);//要测试是否可行
             return(result);
         }
     }
 }
Ejemplo n.º 7
0
        // 登录更新(查询验证,更新登录时间,次数)
        // 改密码更新
        // 改高级密码更新
        // 更新状态
        // 更新邮件
        // 更新手机号
        // 设置临时密码
        // 验证临时密码
        // 改昵称
        // 设置真名,身份证
        //

        // 管理系统 改状态 更新
        //

        /// <summary>
        /// 逻辑上删除
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public IDataShell <int> Del(AccountDBModel account)
        {
            using (var conn = ConnFactory.GetUserConn())
            {
                using (var dal = new UserAccountTDAL(conn))
                {
                    var result = dal.Del(account);
                    return(result);
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 获取单个记录
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> Get(AccountDBModel account)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.GetSingle(account);
             return(result);
         }
     }
     //return "未能提取到数据".Fail<BimUser>();
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 插入新纪录
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public IDataShell <AccountDBModel> Insert(AccountDBModel account)
        {
            using (var conn = ConnFactory.GetUserConn())
            {
                using (var dal = new UserAccountTDAL(conn))
                {
                    var uid = dal.NewUserID();
                    account.AccountID = Convert.ToString(uid.Data);

                    var result = dal.Insert(account);
                    return(result);
                }
            }
        }
Ejemplo n.º 10
0
 /*更新有几类:更新到外部来的新值,依据旧值更新如累加,更新其他旧值*/
 /// <summary>
 /// 登录后更新
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> UpdateAfterLogin(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user, "TotalLoginTimes=TotalLoginTimes+1, LastLoginTime=@LastLoginTime", "AccountID=@AccountID", new { @AccountID = user.AccountID, @LastLoginTime = user.LastLoginTime });
             if (result != 1)
             {
                 return($"登录更新影响行数异常{result}".Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 更新帐号状态
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> UpdateStatus(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user, "Status=@Status", "AccountID=@AccountID", new { Status = user.Status, @AccountID = user.AccountID });
             if (result != 1)
             {
                 return($"修改状态更新影响行数异常{result}".Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 修改密码更新
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> UpdateModifyPassword(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user, "Password=@Password", "AccountID=@AccountID", new { @AccountID = user.AccountID, @Password = user.Password });
             if (result != 1)
             {
                 return($"修改密码更新影响行数异常{result}".Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 事务方式插入新纪录
 /// 事务范例
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> TranWork(AccountDBModel account)
 {
     using (var conn = ConnFactory.GetUserConn()) //打开链接
     {
         using (var uk = new UniteWork(conn))     //启动事务
         {
             var dal = new UserAccountTDAL(conn, uk.Tran);
             var uid = dal.NewUserID();
             account.AccountID = Convert.ToString(uid.Data);
             var result = dal.Insert(account);
             account.Account = "XXEW";
             result          = dal.Update(account);
             account.Email   = "XXEW11";
             result          = dal.Update(account);
             uk.Commit();//成功就提交事务
             return(result);
         }
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 设置临时密码,(TempPassword,TempPassOverTime,TempPassUseFor)
 /// 用空参数设置临时密码就是清空临时密码
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> SetTempPassword(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user,
                                     "TempPassword=@TempPassword, TempPassOverTime=@TempPassOverTime, TempPassUseFor=@TempPassUseFor",
                                     "AccountID=@AccountID",
                                     new { @TempPassword     = user.TempPassword,
                                           @TempPassOverTime = user.TempPassOverTime,
                                           @TempPassUseFor   = user.TempPassUseFor,
                                           @AccountID        = user.AccountID });
             if (result != 1)
             {
                 return(PubError.DBError("ERR-00200301", "SetTempPassword|设置临时密码").ToStr().Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 高级 管理 更新
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public IDataShell <AccountDBModel> Update(AccountDBModel account)
        {
            var ig_list = new List <string>()
            {
                "AccountID", "CoreID", "UserID", "Account"
            };

            using (var conn = ConnFactory.GetUserConn())
            {
                using (var dal = new UserAccountTDAL(conn))
                {
                    var result = dal.Update(account, updateIgnoreField: ig_list);

                    if (result != 1)
                    {
                        throw new Exception("高级更新失败影响数据为0");
                    }
                    return(account.Succ());
                }
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 更新系统备注
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> UpdateSysRemark(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user,
                                     "SysRemark=@SysRemark",
                                     "AccountID=@AccountID",
                                     new
             {
                 @SysRemark = user.SysRemark,
                 @AccountID = user.AccountID
             });
             if (result != 1)
             {
                 return(PubError.DBError("ERR-00200301", "UpdateSysRemark|更新系统备注").ToStr().Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 设置真名
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> SetRealName(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user,
                                     "RealName=@RealName",
                                     "AccountID=@AccountID",
                                     new
             {
                 @RealName  = user.RealName,
                 @AccountID = user.AccountID
             });
             if (result != 1)
             {
                 return(PubError.DBError("ERR-00200301", "SetRealName|设置真名").ToStr().Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 更新头像
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> UpdateNickPic(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user,
                                     "NickPic=NickPic",
                                     "AccountID=@AccountID",
                                     new
             {
                 @NickPic   = user.NickPic,
                 @AccountID = user.AccountID
             });
             if (result != 1)
             {
                 return(PubError.DBError("ERR-00200301", "UpdateNickPic|更新头像").ToStr().Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 设置身份证信息
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IDataShell <AccountDBModel> SetIDCard(AccountDBModel user)
 {
     using (var conn = ConnFactory.GetUserConn())
     {
         using (var dal = new UserAccountTDAL(conn))
         {
             var result = dal.Update(user,
                                     "IDCard=@IDCard, IDCardPic=@IDCardPic",
                                     "AccountID=@AccountID",
                                     new
             {
                 @IDCard    = user.IDCard,
                 @IDCardPic = user.IDCardPic,
                 @AccountID = user.AccountID
             });
             if (result != 1)
             {
                 return(PubError.DBError("ERR-00200301", "SetIDCard|设置身份证信息").ToStr().Fail <AccountDBModel>());
             }
             return(user.Succ());
         }
     }
 }