public static bool AddClientGrounp(ClientGrounp cg) { int i = 0; i=new SqlClientGrounpProvider().AddClientGrounp(cg); if (i != 0) return true; else return false; }
public bool UpdateClientGrounp(ClientGrounp cg) { int i = 0; i = new SqlClientGrounpProvider().UpdateClientGrounp(cg); if (i != 0) return true; else return false; }
public List<ClientGrounp> GetClientGrounpByAccountId(string accountId) { string sql = string.Format("select * from LiveSupport_ClientGrounp where accountId='{0}' order by addDate", accountId); List<ClientGrounp> list = new List<ClientGrounp>(); using (SqlDataReader sdr = DBHelper.GetReader(sql)) { while (sdr.Read()) { ClientGrounp cg = new ClientGrounp(sdr); cg.Account = new SqlAccountProvider().GetAccountByAccountId(accountId); list.Add(cg); } return list; } }
public ClientGrounp GetClientGrounpById(string grounpId) { string sql = string.Format("select * from LiveSupport_ClientGrounp where Id='{0}' order by addDate", grounpId); using (SqlDataReader sdr = DBHelper.GetReader(sql)) { if (sdr.Read()) { ClientGrounp cg = new ClientGrounp(sdr); cg.Account = new SqlAccountProvider().GetAccountByAccountId(grounpId); return cg; } else { return null; } } }
public ClientGrounp CheckClientGrounpByAccountIdAndGrountpName(string accountId, string GrountpName) { string sql = string.Format("select * from LiveSupport_ClientGrounp where accountId='{0}' and [Name]='{1}' order by addDate", accountId, GrountpName); using (SqlDataReader sdr = DBHelper.GetReader(sql)) { if (sdr.Read()) { ClientGrounp cg = new ClientGrounp(sdr); cg.Account = new SqlAccountProvider().GetAccountByAccountId(accountId); return cg; } else { return null; } } }
public int UpdateClientGrounp(ClientGrounp cg) { string sql = string.Format("update from LiveSupport_ClientGrounp Name='{0}',accountId='{1}' where Id='{2}'",cg.Name,cg.Account.AccountId,cg.Id); return DBHelper.ExecuteSql(sql); }
public int AddClientGrounp(ClientGrounp cg) { string sql = string.Format("insert into LiveSupport_ClientGrounp([Id],[Name],accountId,addDate) values('{0}','{1}','{2}','{3}',)", cg.Id, cg.Name, cg.Account.AccountId,cg.AddDate); return DBHelper.ExecuteSql(sql); }