public string Delete(Store oStore, int nStoreID) { string sReturnMessage = ""; Connection.Open(); Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Delete, nStoreID); try { Command.ExecuteNonQuery(); } catch (Exception e) { sReturnMessage = e.Message.Split('~')[0]; } Connection.Close(); return(sReturnMessage); }
public Store IUD(Store oStore, int nStoreID) { Connection.Open(); if (oStore.StoreID == 0) { Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Insert, nStoreID); } else { Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Update, nStoreID); } SqlDataReader reader = Command.ExecuteReader(); Store _oStore = new Store(); if (reader.HasRows) { _oStore = MakeObject(reader); } reader.Close(); Connection.Close(); return(_oStore); }