public List <ItemVarient> GetItemVarients() { List <ItemVarient> itemVarientList1 = new List <ItemVarient>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <ItemVarient> itemVarientList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <ItemVarient> list = customErpEntities.ItemVarient.Select <ItemVarient, ItemVarient>((Expression <Func <ItemVarient, ItemVarient> >)(itm => itm)).ToList <ItemVarient>(); if (list.Count > 0) { foreach (ItemVarient itemVarient in list) { ItemVarient itemName = itemVarient; Item obj = customErpEntities.Item.Where <Item>((Expression <Func <Item, bool> >)(itm => itm.IDNUMBER == itemName.ItemID)).FirstOrDefault <Item>(); if (obj != null) { itemName.ItemName = obj.ItemName; itemName.ProductImage = obj.ItemImage; itemName.ItemVarientName = obj.ItemName + " - " + itemName.Color + " - " + itemName.Size; } } itemVarientList1 = list; } itemVarientList2 = itemVarientList1; } } catch (Exception ex) { itemVarientList2 = itemVarientList1; } return(itemVarientList2); }
public List <cls_user_responses> UserModule(string sp_name) { string baseUrl = Credentials.BaseUrl; DateTime.Now.ToString("yyyyMMddHHmmssfff"); List <cls_user_responses> clsUserResponsesList1 = new List <cls_user_responses>(); cls_user_responses clsUserResponses1 = new cls_user_responses(); List <cls_user_responses> clsUserResponsesList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <cls_user_responses> list = customErpEntities.Database.SqlQuery <cls_user_responses>(sp_name).ToList <cls_user_responses>(); if (list.Count <= 0) { clsUserResponses1.UserID = ""; clsUserResponses1.IDNUMBER = 0; clsUserResponses1.UserName = ""; clsUserResponses1.EmailID = ""; clsUserResponses1.MobileNo = ""; clsUserResponses1.UserTypeName = ""; clsUserResponses1.BOD = ""; clsUserResponses1.Active = ""; clsUserResponsesList1.Add(clsUserResponses1); } else { foreach (cls_user_responses clsUserResponses2 in list) { clsUserResponses1.UserID = clsUserResponses2.UserID; clsUserResponses1.UserName = !string.IsNullOrEmpty(clsUserResponses2.UserName) ? clsUserResponses2.UserName : ""; clsUserResponses1.EmailID = !string.IsNullOrEmpty(clsUserResponses2.EmailID) ? clsUserResponses2.EmailID : ""; clsUserResponses1.MobileNo = !string.IsNullOrEmpty(clsUserResponses2.MobileNo) ? clsUserResponses2.MobileNo : ""; clsUserResponses1.UserTypeName = !string.IsNullOrEmpty(clsUserResponses1.UserTypeName) ? clsUserResponses2.UserTypeName : ""; clsUserResponses1.Active = !string.IsNullOrEmpty(clsUserResponses1.Active) ? clsUserResponses2.Active : ""; clsUserResponsesList1.Add(clsUserResponses1); } } clsUserResponsesList2 = list; } } catch (Exception ex) { clsUserResponses1.UserID = ""; clsUserResponses1.IDNUMBER = 0; clsUserResponses1.UserName = ""; clsUserResponses1.EmailID = ""; clsUserResponses1.MobileNo = ""; clsUserResponses1.UserTypeName = ""; clsUserResponses1.BOD = ""; clsUserResponses1.Active = ""; clsUserResponsesList1.Add(clsUserResponses1); clsUserResponsesList2 = clsUserResponsesList1; } return(clsUserResponsesList2); }
public List <Item> GetProducts() { List <Item> objList1 = new List <Item>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Item> objList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Item> list1 = customErpEntities.Item.Select <Item, Item>((Expression <Func <Item, Item> >)(itm => itm)).ToList <Item>(); if (list1.Count > 0) { foreach (Item obj in list1) { Item categoryName = obj; Decimal num = new Decimal(); int? nullable1 = new int?(0); List <ItemVarient> list2 = customErpEntities.ItemVarient.Where <ItemVarient>((Expression <Func <ItemVarient, bool> >)(itmvar => itmvar.ItemID == categoryName.IDNUMBER)).ToList <ItemVarient>(); if (list2.Count > 0) { categoryName.ItemVarients = list2; } Category category = customErpEntities.Category.Where <Category>((Expression <Func <Category, bool> >)(ct => (int?)ct.IDNUMBER == categoryName.CategoryID)).FirstOrDefault <Category>(); if (category != null) { categoryName.CategoryName = category.CategoryName; } List <ItemVarient> list3 = customErpEntities.ItemVarient.Where <ItemVarient>((Expression <Func <ItemVarient, bool> >)(ct => ct.ItemID == categoryName.IDNUMBER)).ToList <ItemVarient>(); if (list3 != null) { foreach (ItemVarient itemVarient in list3) { num += itemVarient.Inventory; int?nullable2 = nullable1; int?warehouseId = itemVarient.WarehouseID; nullable1 = !(nullable2.HasValue & warehouseId.HasValue) ? new int?() : new int?(nullable2.GetValueOrDefault() + warehouseId.GetValueOrDefault()); } categoryName.Total = num; categoryName.ShanghaiTotal = nullable1; } } objList1 = list1; } objList2 = objList1; } } catch (Exception ex) { objList2 = objList1; } return(objList2); }
public List <Sales> GetSales() { List <Sales> salesList1 = new List <Sales>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Sales> salesList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Sales> list1 = customErpEntities.Sales.Select <Sales, Sales>((Expression <Func <Sales, Sales> >)(itm => itm)).ToList <Sales>(); foreach (Sales sales in list1) { Sales customerName = sales; List <SalesDetails> list2 = customErpEntities.SalesDetails.Where <SalesDetails>((Expression <Func <SalesDetails, bool> >)(sl => sl.SalesID == customerName.IDNUMBER)).ToList <SalesDetails>(); if (list2.Count > 0) { foreach (SalesDetails salesDetails in list2) { SalesDetails itemName = salesDetails; Item obj = customErpEntities.Item.Where <Item>((Expression <Func <Item, bool> >)(it => it.IDNUMBER == itemName.ItemID)).FirstOrDefault <Item>(); if (obj != null) { itemName.ItemName = obj.ItemName; itemName.ProductImage = obj.ItemImage; ItemVarient itemVarient = customErpEntities.ItemVarient.Where <ItemVarient>((Expression <Func <ItemVarient, bool> >)(itv => itv.IDNUMBER == itemName.ItemVarientID)).FirstOrDefault <ItemVarient>(); if (itemVarient != null) { itemName.Color = itemVarient.Color; itemName.SKU = itemVarient.SKU; itemName.UPC = itemVarient.UPC; } } } customerName.SalesDetails = list2; } Customer customer = customErpEntities.Customer.Where <Customer>((Expression <Func <Customer, bool> >)(cp => cp.IDNUMBER == customerName.CustomerID)).FirstOrDefault <Customer>(); if (customer != null) { customerName.CustomerName = customer.CustomerName; } } salesList1 = list1; salesList2 = salesList1; } } catch (Exception ex) { salesList2 = salesList1; } return(salesList2); }
public List <Purchase> GetPurchases() { List <Purchase> purchaseList1 = new List <Purchase>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Purchase> purchaseList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Purchase> list1 = customErpEntities.Purchase.Select <Purchase, Purchase>((Expression <Func <Purchase, Purchase> >)(itm => itm)).ToList <Purchase>(); foreach (Purchase purchase in list1) { Purchase supplierName = purchase; List <PurchaseDetails> list2 = customErpEntities.PurchaseDetails.Where <PurchaseDetails>((Expression <Func <PurchaseDetails, bool> >)(pd => pd.PurchaseID == supplierName.IDNUMBER)).ToList <PurchaseDetails>(); if (list2.Count > 0) { foreach (PurchaseDetails purchaseDetails in list2) { PurchaseDetails itemName = purchaseDetails; Item obj = customErpEntities.Item.Where <Item>((Expression <Func <Item, bool> >)(it => it.IDNUMBER == itemName.ItemID)).FirstOrDefault <Item>(); if (obj != null) { itemName.ItemName = obj.ItemName; itemName.ProductImage = obj.ItemImage; ItemVarient itemVarient = customErpEntities.ItemVarient.Where <ItemVarient>((Expression <Func <ItemVarient, bool> >)(itv => itv.IDNUMBER == itemName.ItemVarientID)).FirstOrDefault <ItemVarient>(); if (itemVarient != null) { itemName.Color = itemVarient.Color; itemName.SKU = itemVarient.SKU; itemName.UPC = itemVarient.UPC; } } } supplierName.PurchaseDetails = list2; } Supplier supplier = customErpEntities.Supplier.Where <Supplier>((Expression <Func <Supplier, bool> >)(sp => sp.IDNUMBER == supplierName.SupplierID)).FirstOrDefault <Supplier>(); if (supplier != null) { supplierName.SupplierName = supplier.SupplierName; } } purchaseList1 = list1; purchaseList2 = purchaseList1; } } catch (Exception ex) { purchaseList2 = purchaseList1; } return(purchaseList2); }
public HttpResponseMessage GetEmployees() { EmployeeManager employeeManager = new EmployeeManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <Employee> >(HttpStatusCode.OK, employeeManager.GetEmployees()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public HttpResponseMessage GetSuppliers() { SupplierManager supplierManager = new SupplierManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <Supplier> >(HttpStatusCode.OK, supplierManager.GetSupplier()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public HttpResponseMessage GetCategories() { CategoryManager categoryManager = new CategoryManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <Category> >(HttpStatusCode.OK, categoryManager.GetCategories()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public HttpResponseMessage GetItemVarients() { ItemVarientManager itemVarientManager = new ItemVarientManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <ItemVarient> >(HttpStatusCode.OK, itemVarientManager.GetItemVarients()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public HttpResponseMessage GetUsers() { UserManager userManager = new UserManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <cls_user_responses> >(HttpStatusCode.OK, userManager.UserModule("Proc_Users_FillGrid")); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public HttpResponseMessage GetDashBoardData() { DashBoardManager dashBoardManager = new DashBoardManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <cls_DashBoard_Data>(HttpStatusCode.OK, dashBoardManager.GetDashBoardData()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public List <Warehouse> GetWarehouses() { List <Warehouse> warehouseList1 = new List <Warehouse>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Warehouse> warehouseList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Warehouse> list = customErpEntities.Warehouse.Select <Warehouse, Warehouse>((Expression <Func <Warehouse, Warehouse> >)(war => war)).ToList <Warehouse>(); if (list.Count > 0) { warehouseList1 = list; } warehouseList2 = warehouseList1; } } catch (Exception ex) { warehouseList2 = warehouseList1; } return(warehouseList2); }
public List <Category> GetCategories() { List <Category> categoryList1 = new List <Category>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Category> categoryList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Category> list = customErpEntities.Category.Select <Category, Category>((Expression <Func <Category, Category> >)(cat => cat)).ToList <Category>(); if (list.Count > 0) { categoryList1 = list; } categoryList2 = categoryList1; } } catch (Exception ex) { categoryList2 = categoryList1; } return(categoryList2); }
public List <Employee> GetEmployees() { List <Employee> employeeList1 = new List <Employee>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Employee> employeeList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Employee> list = customErpEntities.Employee.Select <Employee, Employee>((Expression <Func <Employee, Employee> >)(emp => emp)).ToList <Employee>(); if (list.Count > 0) { employeeList1 = list; } employeeList2 = employeeList1; } } catch (Exception ex) { employeeList2 = employeeList1; } return(employeeList2); }
public List <Supplier> GetSupplier() { List <Supplier> supplierList1 = new List <Supplier>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Supplier> supplierList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Supplier> list = customErpEntities.Supplier.Select <Supplier, Supplier>((Expression <Func <Supplier, Supplier> >)(sup => sup)).ToList <Supplier>(); if (list.Count > 0) { supplierList1 = list; } supplierList2 = supplierList1; } } catch (Exception ex) { supplierList2 = supplierList1; } return(supplierList2); }
public List <Customer> GetCustomers() { List <Customer> customerList1 = new List <Customer>(); cls_user_responses clsUserResponses = new cls_user_responses(); List <Customer> customerList2; try { using (CustomERPEntities customErpEntities = new CustomERPEntities()) { List <Customer> list = customErpEntities.Customer.Select <Customer, Customer>((Expression <Func <Customer, Customer> >)(cus => cus)).ToList <Customer>(); if (list.Count > 0) { customerList1 = list; } customerList2 = customerList1; } } catch (Exception ex) { customerList2 = customerList1; } return(customerList2); }