public string Delete(Bill oBill, int nUserID) { string sReturnMessage = ""; Connection.Open(); Command.CommandText = BillDA.IUD(oBill, EnumDBOperation.Delete, nUserID); try { Command.ExecuteNonQuery(); } catch (Exception e) { sReturnMessage = e.Message.Split('~')[0]; } Connection.Close(); return(sReturnMessage); }
public Bill IUD(Bill oBill, int nUserID) { Connection.Open(); if (oBill.BillID == 0) { Command.CommandText = BillDA.IUD(oBill, EnumDBOperation.Insert, nUserID); } else { Command.CommandText = BillDA.IUD(oBill, EnumDBOperation.Update, nUserID); } SqlDataReader reader = Command.ExecuteReader(); Bill _oBill = new Bill(); if (reader.HasRows) { _oBill = MakeObject(reader); } reader.Close(); Connection.Close(); return(_oBill); }