public BillDetail Get(int nID, int nUserID) { Connection.Open(); Command.CommandText = BillDetailDA.Get(nID, nUserID); SqlDataReader reader = Command.ExecuteReader(); BillDetail _oBillDetail = new BillDetail(); if (reader.HasRows) { _oBillDetail = MakeObject(reader); } reader.Close(); Connection.Close(); return(_oBillDetail); }
public List <BillDetail> Gets(int nBUID, int nBillDetail) { Connection.Open(); Command.CommandText = BillDetailDA.Gets(nBUID, nBillDetail); SqlDataReader reader = Command.ExecuteReader(); BillDetail _oBillDetail = new BillDetail(); List <BillDetail> _oBillDetails = new List <BillDetail>(); if (reader.HasRows) { _oBillDetails = MakeObjects(reader); } reader.Close(); Connection.Close(); return(_oBillDetails); }
public string Delete(BillDetail oBillDetail, int nUserID) { string sReturnMessage = ""; Connection.Open(); Command.CommandText = BillDetailDA.IUD(oBillDetail, EnumDBOperation.Delete, nUserID); try { Command.ExecuteNonQuery(); } catch (Exception e) { sReturnMessage = e.Message.Split('~')[0]; } Connection.Close(); return(sReturnMessage); }
public BillDetail IUD(BillDetail oBillDetail, int nUserID) { Connection.Open(); if (oBillDetail.BillDetailID == 0) { Command.CommandText = BillDetailDA.IUD(oBillDetail, EnumDBOperation.Insert, nUserID); } else { Command.CommandText = BillDetailDA.IUD(oBillDetail, EnumDBOperation.Update, nUserID); } SqlDataReader reader = Command.ExecuteReader(); BillDetail _oBillDetail = new BillDetail(); if (reader.HasRows) { _oBillDetail = MakeObject(reader); } reader.Close(); Connection.Close(); return(_oBillDetail); }