/// <summary> /// 登录后更新 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> UpdateAfterLogin(AccountDBModel user) { string funcUrl = "/api/UserAccount/UpdateAfterLogin"; var res = bridge.CallApi <AccountDBModel, DataShell <AccountDBModel> >(funcUrl, user); return(res); }
/// <summary> /// 插入新用户 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> Insert(AccountDBModel user) { string funcUrl = "/api/UserAccount/Insert"; var res = bridge.CallApi <AccountDBModel, DataShell <AccountDBModel> >(funcUrl, user); return(res); }
/// <summary> /// 设置真名 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> SetRealName(AccountDBModel user) { string funcUrl = "/api/UserAccount/SetRealName"; var res = bridge.CallApi <AccountDBModel, DataShell <AccountDBModel> >(funcUrl, user); return(res); }
public IDataShell <int> Del(AccountDBModel user) { string funcUrl = "/api/UserAccount/Del"; var res = bridge.CallApi <AccountDBModel, DataShell <int> >(funcUrl, user); return(res); }
public ActionResult Login(LoginModel model) { if (model.account == null) { model.account = ""; } if (model.password == null) { model.password = ""; } var checkLogin = new AccountDBModel().Login(model.account, model.password); if (checkLogin != 0 && ModelState.IsValid) { var result = new AccountDBModel().getAccount(model.account, model.password); SessionHelper.SetSession(new InfoSession() { id = result.N_ID, account = result.S_ACCOUNT, type = result.S_TYPE, password = result.S_PASSWORD, fullName = result.S_FULLNAME, address = result.S_ADDRESS, birthDay = result.D_BIRTHDAY }); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "Login failed, please try again !"); } return(View(model)); }
public ActionResult Create(AccountModel accountModel) { try { var accountDBModel = new AccountDBModel(); TB_ACCOUNT account = new TB_ACCOUNT(); account.S_ACCOUNT = accountModel.account; account.S_PASSWORD = accountModel.password; account.S_FULLNAME = accountModel.fullName; account.S_PHONE = accountModel.phone; account.S_ADDRESS = accountModel.address; account.S_TECHNICAL = accountModel.technical; account.D_BIRTHDAY = accountModel.birthDay; account.S_TYPE = accountModel.type == 0 ? "employee" : "manager"; account.N_STORE_ID = accountModel.storeId; account.N_DEPARTMENT_ID = accountModel.departmentId; accountDBModel.createAccount(account); return(RedirectToAction("List")); } catch { return(View()); } }
/// <summary> /// 修改密码更新 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> UpdateModifyPassword(AccountDBModel user) { string funcUrl = "/api/UserAccount/UpdateModifyPassword"; var res = bridge.CallApi <AccountDBModel, DataShell <AccountDBModel> >(funcUrl, user); return(res); }
public IDataShell <AccountDBModel> Get(AccountDBModel user) { Console.WriteLine("call data_service/useraccount/get"); var res = _userDAL.Get(user); return(res); }
/// <summary> /// 帐号数据实体转业务实体 /// </summary> /// <param name="self"></param> /// <returns></returns> public static AccountModel ToBllModel(this AccountDBModel self) { AccountModel res = new AccountModel(); res.AccountID = self.AccountID; res.Account = self.Account; res.Password = self.Password; res.HighPsaaword = self.HighPsaaword; res.Email = self.Email; res.OldEmail = self.OldEmail; res.Mobile = self.Mobile; res.OldMobile = self.OldMobile; res.RegistTime = self.RegistTime; res.Status = self.Status; res.TempPassword = self.TempPassword; res.TempPassOverTime = self.TempPassOverTime; res.TempPassUseFor = self.TempPassUseFor; res.TotalLoginTimes = self.TotalLoginTimes; res.LastLoginTime = self.LastLoginTime; res.ExtensionInfo = self.ExtensionInfo; res.Remark = self.Remark; res.SysRemark = self.SysRemark; res.UserID = self.UserID; res.UserName = self.UserName; res.NickName = self.NickName; res.LastNickName = self.LastNickName; res.NickPic = self.NickPic; res.RealName = self.RealName; res.RealFacePic = self.RealFacePic; res.IDCard = self.IDCard; res.IDCardPic = self.IDCardPic; res.Address = self.Address; res.MainPic = self.MainPic; return(res); }
/// <summary> /// 根据核心id /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> GetByCoreID(AccountDBModel user) { string funcUrl = "/api/UserAccount/GetByCoreID"; var res = bridge.CallApi <AccountDBModel, DataShell <AccountDBModel> >(funcUrl, user); return(res); }
// GET: Admin/Home public ActionResult List(string type) { var accountModel = new AccountDBModel(); if (type == null) { type = (string)RouteData.Values["type"]; } if (type == null) { var listManager = accountModel.getListManager(); return(View(listManager)); } else { if (type.Equals("employee")) { var listEmployee = accountModel.getListEmployee(); return(View(listEmployee)); } else { var listManager = accountModel.getListManager(); return(View(listManager)); } } }
/// <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>>(); }
/// <summary> /// 插入新数据 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> Insert(AccountDBModel user) { user.CoreID = this.NewCoreID(); user.AccountID = this.NewAccountID(); user.UserID = user.AccountID; this.Insert <string, AccountDBModel>(user); return(user.Success()); }
public ActionResult UpdateStatusAccount(int n_id, string s_status) { var accountModel = new AccountDBModel(); s_status = s_status.Equals("Active") ? "InActive" : "Active"; accountModel.updateStatusAccount(n_id, s_status); return(RedirectToAction("List", "Account")); }
public IDataShell <AccountDBModel> Login(AccountDBModel account) { using (var conn = ConnFactory.GetUserConn()) using (var dal = new UserAccountTDAL(conn)) { var result = dal.GetSingle(account); return(result); } }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="user"></param> /// <returns></returns> public IDataShell <AccountDBModel> GetSingle(AccountDBModel user) { var result = base.Get(user); if (result.NotNull()) { return(result.Success()); } return("无此用户".Fail <AccountDBModel>()); }
/// <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); } } }
// 登录更新(查询验证,更新登录时间,次数) // 改密码更新 // 改高级密码更新 // 更新状态 // 更新邮件 // 更新手机号 // 设置临时密码 // 验证临时密码 // 改昵称 // 设置真名,身份证 // // 管理系统 改状态 更新 // /// <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); } } }
/// <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>(); }
/// <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); } } }
/*更新有几类:更新到外部来的新值,依据旧值更新如累加,更新其他旧值*/ /// <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()); } } }
/// <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()); } } }
/// <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()); } } }
public ActionResult Edit(int n_id) { var model = new AccountDBModel(); var accountModel = new AccountModel(); var account = model.getAccountById(n_id); accountModel.id = account.N_ID; accountModel.fullName = account.S_FULLNAME; accountModel.phone = account.S_PHONE; accountModel.address = account.S_ADDRESS; accountModel.technical = account.S_TECHNICAL; accountModel.account = account.S_ACCOUNT; accountModel.password = account.S_PASSWORD; accountModel.type = account.S_TYPE.Equals("employee") ? 0 : 1; return(View(accountModel)); }
// GET: Admin/Store/Create public ActionResult Create() { var accountDBModel = new AccountDBModel(); var accountModel = new AccountModel(); List <TB_STORE> storeList = accountDBModel.getAllStore(); List <TB_DEPARTMENT> departmentList = accountDBModel.getAllDepartment(); accountModel.storeList = new List <DropDownModel>(); accountModel.departmentList = new List <DropDownModel>(); accountModel.accountTypeList = new List <DropDownModel>(); accountModel.accountTypeList.Add(new DropDownModel(0, "employee")); accountModel.accountTypeList.Add(new DropDownModel(1, "manager")); storeList.ForEach(store => accountModel.storeList.Add(new DropDownModel(store.N_ID, store.S_NAME))); departmentList.ForEach(department => accountModel.departmentList.Add(new DropDownModel(department.N_ID, department.S_NAME))); return(View(accountModel)); }
/// <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); } } }
public ActionResult Edit(AccountModel accountModel) { try { var model = new AccountDBModel(); TB_ACCOUNT account = new TB_ACCOUNT(); account.N_ID = accountModel.id; account.S_FULLNAME = accountModel.fullName; account.S_PHONE = accountModel.phone; account.S_ADDRESS = accountModel.address; account.S_TECHNICAL = accountModel.technical; account.S_PASSWORD = accountModel.password; model.updateAccountById(account); return(RedirectToAction("List")); } catch { return(View()); } }
/// <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()); } } }
/// <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()); } } }
/// <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()); } } }