/// <summary> /// 根据账号数据类中条件筛选之后账号的数目 /// </summary> /// <param name="data">账号数据类</param> /// <returns></returns> public int GetAccountCount(Account data) { object obj = Ex_QueryForObject("SelectAccountCount", data); if (obj != null) { return Convert.ToInt32(obj); } return 0; }
/// <summary> /// 执行命令 /// </summary> protected internal override void InternalExecute() { try { objectDetails = Factorys.DaoFactory.GetDAO<IAccountDAO>().GetAccount(entityId); } catch (Exception e) { throw new CommandException(this.Name, "获取账号明细时发生错误:" + e.Message, e); } }
/// <summary> /// 根据账号数据类中的条件和分页筛选后的集合 /// </summary> /// <param name="data"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public IList<Account> GetAccountList(Account data, int pageIndex, int pageSize) { int intStart = pageSize * (pageIndex - 1) + 1; int intEnd = pageSize * pageIndex; Hashtable ht = new Hashtable(); ht.Add("AccountData", data); ht.Add("StartIndex", intStart); ht.Add("EndIndex", intEnd); return Ex_QueryForList<Account>("SelectAccountList", ht); }
/// <summary> /// 创建账号 /// </summary> /// <param name="data">账号数据类</param> /// <returns>Bool</returns> public bool CreateAccount(Account data) { Ex_Insert("InsertAccount", data); return true; }
public ChangeAccountDataCmd(string id, Account data) : base(id) { }
/// <summary> /// 创建账号CMD /// </summary> /// <param name="data">账号数据类</param> public CreateAccountCmd(Account entity = null) { this.entity = entity; this.BeforeExecute += CheckAccountEntity; }
/// <summary> /// 获取账号列表及总记录数 /// 账号的集合在执行完Execute后保存此命令的DataSource属性中 /// 账号的总记录数在执行完Execute后保存此命令的TotalRecord属性中 /// </summary> /// <param name="data">账号数据类</param> /// <param name="pageIndex">当前页</param> /// <param name="pageSize">页行数</param> public GetAccountListCmd(Account data, int pageIndex, int pageSize) { this.data = data; this.pageIndex = pageIndex; this.pageSize = pageSize; }
/// <summary> /// 修改现有用户信息 /// </summary> public ActionResult SaveUser(Account account) { try { ChangeAccountDataCmd cmd = CmdFactorys.CmdFactory.GetCommand<ChangeAccountDataCmd>(); cmd.Execute(); return Json(new { msg = "修改成功!" }); } catch (Exception e) { return Json(new { msg = "修改失败! Error:" + e.Message }); } }
/// <summary> /// 保存创建的新用户 /// </summary> public ActionResult SaveAddUser(Account account) { try { CreateAccountCmd cmd = CmdFactorys.CmdFactory.GetCommand<CreateAccountCmd>(); cmd.Entity = account; cmd.Execute(); return Json(new { msg = "创建用户成功!" }); } catch (Exception e) { return Json(new { msg = "创建用户失败! Error:", e.Message }); } }