/// <summary> /// 根据主键刷新全部的值 /// </summary> public bool Update() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); if (!string.IsNullOrEmpty(username)) { p.Add("username", username); } if (!string.IsNullOrEmpty(password)) { p.Add("password", password); } if (!string.IsNullOrEmpty(nickname)) { p.Add("nickname", nickname); } if (!string.IsNullOrEmpty(head)) { p.Add("head", head); } p.Add("coin", coin); p.Add("cash", cash); p.Add("sex", sex); if (!string.IsNullOrEmpty(phone)) { p.Add("phone", phone); } p.Add("rank", rank); return(SqlManager.Instance.UpdateInItems(p)); }
/// <summary> /// 根据 Phone 得到一个对象实体 /// </summary> public void GetModelByPhone(string phone) { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("phone", phone); p.Add("id", null); p.Add("username", null); p.Add("password", null); p.Add("nickname", null); p.Add("head", null); p.Add("coin", null); p.Add("cash", null); p.Add("sex", null); p.Add("rank", null); SqlManager.Instance.GetTable(ref p); if (p != null && p.Count > 0) { if (!string.IsNullOrEmpty(p["id"])) { this.id = int.Parse(p["id"]); } if (!string.IsNullOrEmpty(p["username"])) { this.username = p["username"]; } if (!string.IsNullOrEmpty(p["password"])) { this.password = p["password"]; } if (!string.IsNullOrEmpty(p["nickname"])) { this.nickname = p["nickname"]; } if (!string.IsNullOrEmpty(p["head"])) { this.head = p["head"]; } if (!string.IsNullOrEmpty(p["coin"])) { this.coin = int.Parse(p["coin"]); } if (!string.IsNullOrEmpty(p["cash"])) { this.cash = int.Parse(p["cash"]); } if (!string.IsNullOrEmpty(p["sex"])) { this.sex = int.Parse(p["sex"]); } if (!string.IsNullOrEmpty(p["phone"])) { this.phone = p["phone"]; } if (!string.IsNullOrEmpty(p["rank"])) { this.rank = int.Parse(p["rank"]); } } }
/// <summary> /// 根据主键刷新 Rank 的值 /// </summary> public bool UpdateByRank() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); p.Add("rank", rank); return(SqlManager.Instance.UpdateInItems(p)); }
/// <summary> /// 根据主键刷新 Sex 的值 /// </summary> public bool UpdateBySex() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); p.Add("sex", sex); return(SqlManager.Instance.UpdateInItems(p)); }
/// <summary> /// 根据主键刷新 Cash 的值 /// </summary> public bool UpdateByCash() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); p.Add("cash", cash); return(SqlManager.Instance.UpdateInItems(p)); }
/// <summary> /// 根据主键刷新 Phone 的值 /// </summary> public bool UpdateByPhone() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); if (!string.IsNullOrEmpty(phone)) { p.Add("phone", phone); } return(SqlManager.Instance.UpdateInItems(p)); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete() { DictionaryPara p = new DictionaryPara(tablename, true); p.Add("id", id); return(SqlManager.Instance.Delete(p)); }
/// <summary> /// 根据 Cash 获取本列数据表最后一行的值 /// </summary> public int GetEndLineValueByCash() { DictionaryPara p = new DictionaryPara(tablename); p.Add("cash", null); SqlManager.Instance.GetEndLineValue(ref p); if (p != null && p.Count > 0) { if (!string.IsNullOrEmpty(p["cash"])) { return(int.Parse(p["cash"])); } } return(0); }
/// <summary> /// 根据 Head 获取本列数据表最后一行的值 /// </summary> public string GetEndLineValueByHead() { DictionaryPara p = new DictionaryPara(tablename); p.Add("head", null); SqlManager.Instance.GetEndLineValue(ref p); if (p != null && p.Count > 0) { if (!string.IsNullOrEmpty(p["head"])) { return(p["head"]); } } return(null); }
/// <summary> /// 根据 Rank 获取列全部值的值 /// </summary> public List <int> GetRowByRank() { DictionaryPara p = new DictionaryPara(tablename); p.Add("rank", rank); List <DictionaryPara> dp = SqlManager.Instance.GetColume(p); List <int> list = new List <int>(); if (dp == null) { return(list); } for (int i = 0; i < dp.Count; i++) { if (!string.IsNullOrEmpty(dp[i]["rank"])) { list.Add(int.Parse(dp[i]["rank"])); } } return(list); }
/// <summary> /// 根据 Phone 获取列全部值的值 /// </summary> public List <string> GetRowByPhone() { DictionaryPara p = new DictionaryPara(tablename); p.Add("phone", phone); List <DictionaryPara> dp = SqlManager.Instance.GetColume(p); List <string> list = new List <string>(); if (dp == null) { return(list); } for (int i = 0; i < dp.Count; i++) { if (!string.IsNullOrEmpty(dp[i]["phone"])) { list.Add(dp[i]["phone"]); } } return(list); }