public bool hasUser(string username) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); User user = dBUtil.getUser(username); if (user == null) { return(false); } else { return(true); } }
public int getPerLevel(string username) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); User user = dBUtil.getUser(username); if (user == null) { return(-1); } else { return(user.PerLevel); } }
public bool verifyUser(string username, string email) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); User user = dBUtil.getUser(username); if (user.Email == email) { return(true); } else { return(false); } }
public bool isLogin(string username, string pwd) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); User user = dBUtil.getUser(username); if (pwd != user.Pwd) { return(false); } else { return(true); } }
public int[] getRelativeId(int num, int id) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); Member m1 = dBUtil.getMember(id); int[] a = new int[10]; for (int i = 0; i < 10; i++) { a[i] = 0; } if (num == 1) { a[0] = m1.Fatherid; } else if (num == 2) { List <Member> l1 = dBUtil.getChildList(m1.Fatherid); for (int i = 0; i < l1.Count; i++) { if (l1[i].Sex == '男' && l1[i].Id != id) { a[i] = l1[i].Id; } } } else if (num == 3) { List <Member> l1 = dBUtil.getChildList(m1.Fatherid); for (int i = 0; i < l1.Count; i++) { if (l1[i].Sex == '女' && l1[i].Id != id) { a[i] = l1[i].Id; } } } else if (num == 4) { List <Member> l1 = dBUtil.getChildList(m1.Id); { for (int i = 0; i < l1.Count; i++) { a[i] = l1[i].Id; } } } return(a); }
public Partner getMother(int id) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); Member m1 = dBUtil.getMember(id); Member f1 = dBUtil.getMember(m1.Fatherid); List <Partner> p1 = dBUtil.getPartnerList(f1.Name); if (p1.Count != 0) { return(p1[0]); } else { return(null); } }
/// <summary> /// 构造函数注入。单例模式。 /// </summary> /// <param name="dbType"></param> private DBFactory(DBType dbType) { switch (dbType) { case DBType.sql: dBUtil = SqlDBUtil.SingleSqlDBUtil(); break; case DBType.access: dBUtil = AccessUtil.SingleSqlDBUtil(); break; default: dBUtil = SqlDBUtil.SingleSqlDBUtil(); break; } }
/*第二版*/ public void deleteMap(int mapid) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); dBUtil.deleteMap(mapid); List <Member> list1 = dBUtil.getMemberList(mapid); for (int i = 0; i < list1.Count; i++) { List <Partner> list2 = dBUtil.getPartnerList(list1[i].Name); for (int j = 0; j < list2.Count; j++) { dBUtil.deletePartner(list2[j].Name); } dBUtil.deleteMember(list1[i].Name); } }
public Member queryMember(string name) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); return(dBUtil.getMember(name)); }
public void SetDAO(IDBUtil dao) { _DAO = dao; }
public void modifyMember(int id, Member member) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); dBUtil.modifyMember(id, 0, member); }
public void addPartner(Partner partner) { IDBUtil sd = DBUtilFactory.getDBUtil("DBUtilImpl"); sd.addPartner(partner); }
public void addMember(Member member) { IDBUtil sd = DBUtilFactory.getDBUtil("DBUtilImpl"); sd.addMember(member); }
/// <summary> /// 查詢欄位最小值 /// </summary> /// <typeparam name="TSource"></typeparam> /// <typeparam name="T"></typeparam> /// <param name="model"></param> /// <param name="exp"></param> /// <param name="dao"></param> /// <param name="conn"></param> /// <param name="trns"></param> /// <returns></returns> public static T QueryMin <TSource, T>(this TSource model, Expression <Func <TSource, T> > exp, IDBUtil dao, DbConnection conn = null, DbTransaction trns = null) where TSource : IDBEntity { return(QueryAggregate(model, exp, "MIN", dao, conn, trns)); }
//==================================================================== //新增 INSERT //==================================================================== #endregion "新增 INSERT" /// <summary> /// 新增 (條件式結束語句) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="model"></param> /// <param name="dao"></param> /// <param name="conn"></param> /// <param name="trns"></param> /// <returns></returns> public static int Insert <T>(this T model, IDBUtil dao, DbConnection conn = null, DbTransaction trns = null) where T : IDBEntity { //Insert return(dao.Insert(model, model.GetTableName(), conn, trns)); }
public User queryUser(string username) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); return(dBUtil.getUser(username)); }
public void modifyUser(string username, User user) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); dBUtil.modifyUser(username, 0, user); }
public void addMap(Map map) { IDBUtil sd = DBUtilFactory.getDBUtil("DBUtilImpl"); sd.addMap(map); }
public void modifyMap(int id, Map map) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); dBUtil.modifyMap(id, 0, map); }
public void addUser(User user) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); dBUtil.addUser(user); }
public string getMemberName(int id) { IDBUtil dBUtil = DBUtilFactory.getDBUtil("DBUtilImpl"); return(dBUtil.getMember(id).Name); }