public string ModelListEntity(string sqlwhere) { if (string.IsNullOrEmpty(sqlwhere)) { sqlwhere += "1=1"; } else sqlwhere += " and 1=1"; ModelListBll ob = new ModelListBll(); List<ModelList> orderList = new List<ModelList>(); //转换 List<ConvertEntity> ce = new List<ConvertEntity>(); orderList = ob.GetModelList(sqlwhere); foreach (ModelList item in orderList) { ConvertEntity ceSingle = new ConvertEntity(); ceSingle.ModalName = item.ModelName; ceSingle.RemarkD = item.Remark; ceSingle.eg3 = item.ModelPrice; ceSingle.eg4 = item.StationPrice; ceSingle.Unit = item.Unit; ceSingle.ModelProfit = item.ModelProfit; ceSingle.StationProfit = item.StationProfit; ce.Add(ceSingle); } int rows = ob.GetRecordCount(sqlwhere); string output = JsonConvert.SerializeObject(ce); string json = @"{""Rows"":" + output + @",""Total"":""" + rows + @"""}"; return json; }
/// <summary> /// Добавить массив элементов /// </summary> /// <param name="items">массив элементов</param> /// <returns>Логическое значение</returns> static public bool AddItems(IEnumerable <ProductInStock> items) { List <ProductInStockEnt> clients = new List <ProductInStockEnt>(); foreach (var item in items) { clients.Add(ConvertEntity.Convert(item)); } return(Unit.ProductInStockRepository.AddItems(clients)); }
ICollection <Order> BooksList() { List <Order> ord = new List <Order>(); foreach (var x in context.Orders) { ord.Add(ConvertEntity.ConvertToOrder(x)); } return(ord); }
/// <summary> /// Добавить массив элементов /// </summary> /// <param name="items">массив элементов</param> /// <returns>Логическое значение</returns> static public bool AddItems(IEnumerable <Employee> items) { List <EmployeeEnt> clients = new List <EmployeeEnt>(); foreach (var item in items) { clients.Add(ConvertEntity.Convert(item)); } return(Unit.EmployeeRepository.AddItems(clients)); }
/// <summary> /// Добавить массив элементов /// </summary> /// <param name="items">массив элементов</param> /// <returns>Логическое значение</returns> static public bool AddItems(IEnumerable <InvoiceForPurchase> items) { List <InvoiceForPurchaseEnt> clients = new List <InvoiceForPurchaseEnt>(); foreach (var item in items) { clients.Add(ConvertEntity.Convert(item)); } return(Unit.InvoiceForPurchaseRepository.AddItems(clients)); }
ICollection <Book> BooksList() { List <Book> Book = new List <Book>(); foreach (var x in context.Books) { Book.Add(ConvertEntity.ConvertToBook(x)); } return(Book); }
/// <summary> /// Добавить массив элементов /// </summary> /// <param name="items">массив элементов</param> /// <returns>Логическое значение</returns> static public bool AddItems(IEnumerable <CompanyCustomer> items) { List <CompanyCustomerEnt> clients = new List <CompanyCustomerEnt>(); foreach (var item in items) { clients.Add(ConvertEntity.Convert(item)); } return(Unit.CompanyСustomerRepository.AddItems(clients)); }
/// <summary> /// Лист всех элементов /// </summary> /// <returns>Лист всех элементов</returns> static public IEnumerable <ProductInStock> Outpoot() { List <ProductInStockEnt> list = Unit.ProductInStockRepository.AllItems.ToList(); List <ProductInStock> clients = new List <ProductInStock>(); foreach (var item in list) { clients.Add(ConvertEntity.Convert(item)); } return(clients); }
/// <summary> /// Лист всех элементов /// </summary> /// <returns>Лист всех элементов</returns> static public IEnumerable <InvoiceForPurchase> Outpoot() { List <InvoiceForPurchaseEnt> list = Unit.InvoiceForPurchaseRepository.AllItems.ToList(); List <InvoiceForPurchase> clients = new List <InvoiceForPurchase>(); foreach (var item in list) { clients.Add(ConvertEntity.Convert(item)); } return(clients); }
/// <summary> /// Лист всех элементов /// </summary> /// <returns>Лист всех элементов</returns> static public IEnumerable <ClientUser> Outpoot() { List <ClientUserEnt> list = Unit.ClientUserRepository.AllItems.ToList(); List <ClientUser> clients = new List <ClientUser>(); foreach (var item in list) { clients.Add(ConvertEntity.Convert(item)); } return(clients); }
/// <summary> /// Лист всех элементов /// </summary> /// <returns>Лист всех элементов</returns> static public IEnumerable <Employee> Outpoot() { List <EmployeeEnt> list = Unit.EmployeeRepository.AllItems.ToList(); List <Employee> clients = new List <Employee>(); foreach (var item in list) { clients.Add(ConvertEntity.Convert(item)); } return(clients); }
public void SaveOrder(Order order) { OrderEnt orderEnt = ConvertEntity.ConvertToOrderEnt(order); context.AttachRange(order.Lines.Select(l => l.Book)); if (order.OrderId == 0) { context.Orders.Add(orderEnt); } context.SaveChanges(); }
public Book DeleteBook(int bookID) { BookEnt dbEntry = context.Books.FirstOrDefault(b => b.BookEntId == bookID); if (dbEntry != null) { context.Books.Remove(dbEntry); context.SaveChanges(); } Book book = ConvertEntity.ConvertToBook(dbEntry); return(book); }
public void SaveBook(Book book) { BookEnt bookEnt = ConvertEntity.ConvertToBookEnt(book); if (book.BookId == 0) { context.Books.Add(bookEnt); } else { BookEnt dbEntry = context.Books.FirstOrDefault(b => b.BookEntId == book.BookId); if (dbEntry != null) { dbEntry.Name = book.Name; dbEntry.Description = book.Description; dbEntry.Price = book.Price; dbEntry.Category = book.Category; dbEntry.Author = book.Author; dbEntry.Count = book.Count; } } context.SaveChanges(); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public Employee GetItem(int id) { return(ConvertEntity.Convert(Unit.EmployeeRepository.GetItem(id))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(Employee item) { return(Unit.EmployeeRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public Product GetItem(int id) { return(ConvertEntity.Convert(Unit.ProductRepository.GetItem(id))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(Product item) { return(Unit.ProductRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(SalesInvoice item) { return(Unit.SalesInvoiceRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public InvoiceForPurchase GetItem(int id) { return(ConvertEntity.Convert(Unit.InvoiceForPurchaseRepository.GetItem(id))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(ClientUser item) { return(Unit.ClientUserRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public ClientUser GetItem(int id) { return(ConvertEntity.Convert(Unit.ClientUserRepository.GetItem(id))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public Category GetItem(int id) { return(ConvertEntity.Convert(Unit.CategoryRepository.GetItem(id))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public Statistics GetItem(int id) { return(ConvertEntity.Convert(Unit.StatisticsRepository.GetItem(id))); }
/// <summary> /// Добавить новый элемент /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool AddItem(ProductInStock item) { return(Unit.ProductInStockRepository.AddItem(ConvertEntity.Convert(item))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public CompanyCustomer GetItem(int id) { return(ConvertEntity.Convert(Unit.CompanyСustomerRepository.GetItem(id))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(CompanyCustomer item) { return(Unit.CompanyСustomerRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(InvoiceForPurchase item) { return(Unit.InvoiceForPurchaseRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Поиск элемента /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(Statistics item) { return(Unit.StatisticsRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Поиск элемента по ID и изменяет его /// </summary> /// <param name="item">Элемент</param> /// <returns>Логическое значение</returns> static public bool ChangeItem(Category item) { return(Unit.CategoryRepository.ChangeItem(ConvertEntity.Convert(item))); }
/// <summary> /// Получение элемента по индексу /// </summary> /// <param name="id">ID элемента</param> /// <returns>Элемент</returns> static public SalesInvoice GetItem(int id) { return(ConvertEntity.Convert(Unit.SalesInvoiceRepository.GetItem(id))); }