void ID() { string OID = "select STAFF_ID from STAFF ORDER BY STAFF_ID"; string SName; int SID; string format = "0000000"; SqlDataAdapter ad = new SqlDataAdapter(OID, consql); DataSet ds = new DataSet(); ad.Fill(ds, "STAFF"); if (ds.Tables["STAFF"].Rows.Count > 0) { SName = ds.Tables["STAFF"].Rows[ds.Tables["STAFF"].Rows.Count - 1][0].ToString(); SID = int.Parse(SName.Substring(1, (SName.Length - 1))); staffID = "S" + ((SID + 1).ToString(format)); } else { staffID = "S0000001"; } }
void damageGenerateId() { string OID = "SELECT DEMAGE_ID FROM DAMAGE ORDER BY DEMAGE_ID"; string SName; int SID; string format = "0000000"; SqlDataAdapter adSale = new SqlDataAdapter(OID, conSql); DataSet dsSale = new DataSet(); adSale.Fill(dsSale, "Damage"); if (dsSale.Tables["Damage"].Rows.Count > 0) { SName = dsSale.Tables["Damage"].Rows[dsSale.Tables["Damage"].Rows.Count - 1][0].ToString(); SID = int.Parse(SName.Substring(1, (SName.Length - 1))); DamageID = "D" + ((SID + 1).ToString(format)); } else { DamageID = "D0000001"; } }
void SaleGenerateId() { string OID = "SELECT SALE_ID FROM SALE ORDER BY SALE_ID"; string SName; int SID; string format = "0000000"; SqlDataAdapter adSale = new SqlDataAdapter(OID, consql); DataSet dsSale = new DataSet(); adSale.Fill(dsSale, "Sale"); if (dsSale.Tables["Sale"].Rows.Count > 0) { SName = dsSale.Tables["Sale"].Rows[dsSale.Tables["Sale"].Rows.Count - 1][0].ToString(); SID = int.Parse(SName.Substring(1, (SName.Length - 1))); saleID = "S" + ((SID + 1).ToString(format)); } else { saleID = "S0000001"; } }