public string GenerateCode(string libelle) { DB_PostgreSQL dataBase = new DB_PostgreSQL(); long count = (Int64)dataBase.executeScalar("SELECT count(*) FROM \"Articles\""); string prefix = libelle != string.Empty ? libelle[0] + "_" : "_"; string code = prefix + count.ToString(); while (FindByKey(code)) { count++; code = prefix + count.ToString(); } this.Code = code; return(code); }
public string GenerateCode() { DB_PostgreSQL dataBase = new DB_PostgreSQL(); string prefix = string.Empty; long count = (Int64)dataBase.executeScalar("SELECT count(*) FROM \"Client\""); prefix = GlobalVars.PrefixClient; string code = prefix + count.ToString(); while (FindByKey(code)) { count++; code = prefix + count.ToString(); } this.Code = code; return(code); }
public string GenerateCode() { DB_PostgreSQL dataBase = new DB_PostgreSQL(); long count = (Int64)dataBase.executeScalar("SELECT count(*) FROM \"Famille\""); string code = "F_" + count.ToString(); while (FindByKey(code)) { count++; code = "F_" + count.ToString(); } this.Code = code; return(code); }
public string GenerateCode(params string[] args) { DB_PostgreSQL dataBase = new DB_PostgreSQL(); long count = (Int64)dataBase.executeScalar("SELECT count(*) FROM \"Facture\""); string prefix = GlobalVars.PrefixFacture; string premier = GlobalVars.PremierFacture; count = count > 0 ? count : int.Parse(premier); foreach (string s in args) { prefix += s[0]; } string code = prefix + count.ToString(); while (FindByKey(code)) { count++; code = prefix + count.ToString(); } this.Code = code; return(code); }