public CSSaleItemTax get(Guid csSaleItemTaxID) { using (context = new CSFPOSWareContext()) { var query = from s in context.CSSaleItemTaxes where s.CSSaleItemTaxID == csSaleItemTaxID select s; return query.FirstOrDefault(); } }
public List<Discount> getDiscounts() { using (context = new CSFPOSWareContext()) { var query = from d in context.Discounts orderby d.DiscountIndex select d; return query.ToList(); } }
public Item get(string itemName) { using (context = new CSFPOSWareContext()) { var query = from i in context.Items where i.ItemName == itemName select i; return query.FirstOrDefault(); } }
public List<Media> getMedia() { using (context = new CSFPOSWareContext()) { var query = from m in context.Medias orderby m.MediaIndex select m; return query.ToList(); } }
public List<SaleItemDiscount> find(string saleItemID) { using (context = new CSFPOSWareContext()) { var query = from sid in context.SaleItemDiscounts where sid.SaleItemID.ToString() == saleItemID select sid; return query.ToList<SaleItemDiscount>(); } }
public CSConfiguration get(string section, string parameter) { using (context = new CSFPOSWareContext()) { var query = from c in context.CSConfigurations where c.Section == section where c.Parameter == parameter select c; return query.FirstOrDefault(); } }
public void add(CSSaleItemDiscount csSaleItemDiscount) { using (context = new CSFPOSWareContext()) { context.CSSaleItemDiscounts.Add(csSaleItemDiscount); try { context.SaveChanges(); } catch (Exception e) { Logger.log.Error(e.Message); Logger.log.Error(e.StackTrace); } } }
public Sale getById(Guid saleID) { using (context = new CSFPOSWareContext())//found in BaseDAO { var query = from s in context.Sales where s.SaleID.Equals(saleID) select s; //Logger.log.Debug(query.Expression.ToString()); //Logger.log.Debug(query.First().SaleID.ToString()); //foreach (var s in query) //{ // Logger.log.Debug(s.SaleID); //} return query.FirstOrDefault(); } }
public List<SaleItem> find(string saleID) { using (context = new CSFPOSWareContext()) { var query = from si in context.SaleItems where si.SaleID.ToString() == saleID orderby si.ItemIndex select si; //Logger.log.Debug(query.Expression.ToString()); //Logger.log.Debug(query.First().SaleID.ToString()); //foreach (var s in query) //{ // Logger.log.Debug(s.SaleID); //} return query.ToList<SaleItem>(); } }
public Sale get(Guid saleID) { using (context = new CSFPOSWareContext())//found in BaseDAO { var query = from s in context.Sales where s.IsSuspend.Equals(true) //bit converts to boolean where s.IsRetrieved.Equals(1) //but tinyint does not. @#$%!!@# select s; //Logger.log.Debug(query.Expression.ToString()); //Logger.log.Debug(query.First().SaleID.ToString()); //foreach (var s in query) //{ // Logger.log.Debug(s.SaleID); //} return query.FirstOrDefault(); } }
public List<CSSaleItemTax> findBySaleItem(Guid saleItemID) { List<CSSaleItemTax> CSSaleItemTaxList = null; using (context = new CSFPOSWareContext()) { var query = from sit in context.CSSaleItemTaxes where sit.CSSaleItemID == saleItemID select sit; try { CSSaleItemTaxList = query.ToList(); } catch (Exception e) { //Logger.log.Error(e.Message); //Logger.log.Error(e.StackTrace); } return CSSaleItemTaxList; } }
public void removeBySaleItem(CSSaleItem csSaleItem) { List<CSSaleItemDiscount> CSSaleItemDiscountList = null; using (context = new CSFPOSWareContext()) { var query = from sid in context.CSSaleItemDiscounts where sid.CSSaleItemID == csSaleItem.CSSaleItemID select sid; CSSaleItemDiscountList = query.ToList(); } using (context = new CSFPOSWareContext()) { foreach (CSSaleItemDiscount CSSaleItemDiscount in CSSaleItemDiscountList) { context.CSSaleItemDiscounts.Remove(CSSaleItemDiscount); context.SaveChanges(); } } }
public CSSaleItemDiscount get(Guid csSaleItemDiscountID) { CSSaleItemDiscount CSSaleItemDiscount = null; using (context = new CSFPOSWareContext()) { var query = from d in context.CSSaleItemDiscounts where d.CSSaleItemDiscountID == csSaleItemDiscountID select d; try { CSSaleItemDiscount = query.FirstOrDefault(); } catch (Exception e) { //Logger.log.Error(e.Message); //Logger.log.Error(e.StackTrace); } return CSSaleItemDiscount; } }
public CSSaleItem get(Guid saleItemID) { CSSaleItem CSSaleItem = null; using (context = new CSFPOSWareContext()) { var query = from s in context.CSSaleItems where s.CSSaleItemID == saleItemID select s; //return query.FirstOrDefault(); try { CSSaleItem = query.FirstOrDefault(); } catch (Exception e) { Logger.log.Error(e.Message); Logger.log.Error(e.StackTrace); } return CSSaleItem; } }
public void remove(CSSaleItemDiscount csSaleItemDiscount) { csSaleItemDiscount = get(csSaleItemDiscount.CSSaleItemDiscountID); if (null != csSaleItemDiscount) { using (context = new CSFPOSWareContext()) { context.CSSaleItemDiscounts.Remove(csSaleItemDiscount); try { context.SaveChanges(); } catch (Exception e) { Logger.log.Error(e.Message); Logger.log.Error(e.StackTrace); Logger.log.Error(e.InnerException.StackTrace); } } } }
public void remove(CSSaleItemTax csSaleItemTax) { csSaleItemTax = get(csSaleItemTax.CSSaleItemTaxID); using (context = new CSFPOSWareContext()) { if (null != csSaleItemTax) { context.CSSaleItemTaxes.Remove(csSaleItemTax); try { context.SaveChanges(); } catch (Exception e) { Logger.log.Error(e.Message); Logger.log.Error(e.StackTrace); Logger.log.Error(e.InnerException.StackTrace); } } } }
public List<CSSaleItem> removeByCSSale(CSSale CSSale) { List<CSSaleItem> CSSaleItemList = null; using (context = new CSFPOSWareContext()) { var query = from si in context.CSSaleItems where si.CSSaleID == CSSale.CSSaleID select si; CSSaleItemList = query.ToList(); } using (context = new CSFPOSWareContext()) { foreach (CSSaleItem CSSaleItem in CSSaleItemList) { context.CSSaleItems.Remove(CSSaleItem); context.SaveChanges(); } } return CSSaleItemList; }
//public void removeBySaleItem(SaleItem saleItem) //{ // List<CSSaleItemTax> CSSaleItemTaxes = findBySaleItem(saleItem.SaleItemID); // if (CSSaleItemTaxes != null) // { // using (context = new CSFPOSWareContext()) // { // foreach (CSSaleItemTax csSaleItemTax in CSSaleItemTaxes) // { // Logger.log.Debug("deleting CSSaleItemTaxes..."); // context.CSSaleItemTaxes.Remove(csSaleItemTax); // try // { // context.SaveChanges(); // } // catch (Exception e) // { // Logger.log.Error(e.Message); // Logger.log.Error(e.StackTrace); // Logger.log.Error(e.InnerException.StackTrace); // } // } // } // } // else // { // Logger.log.Debug("no CSSaleItemTaxes to delete"); // } //} public void removeBySaleItem(CSSaleItem csSaleItem) { List<CSSaleItemTax> CSSaleItemTaxList = null; using (context = new CSFPOSWareContext()) { var query = from sit in context.CSSaleItemTaxes where sit.CSSaleItemID == csSaleItem.CSSaleItemID select sit; CSSaleItemTaxList = query.ToList(); } using (context = new CSFPOSWareContext()) { foreach (CSSaleItemTax CSSaleItemTax in CSSaleItemTaxList) { context.CSSaleItemTaxes.Remove(CSSaleItemTax); context.SaveChanges(); } } }