public async Task <ActionResult> UpdateViewQA(string search) { var nhnch = new NHibernateNonCatalogStore(); var employees = new NHibernateCompanyStore(); var category = new NHibernateCategoryStore(); var supplier = new NHibernateISupplierStore(); IList <NonCatalogItemHeadModel> nonCatalogHeads = null; ViewData["Categories"] = await category.GeatAllCategoryAsync(); ViewData["pageName"] = "QuoteAnalysisUV"; ViewData["employees"] = await employees.GetAllEmployeeAsync(); ViewData["supplier"] = await supplier.GeatAllSupplierAsync(); ViewData["brand"] = await supplier.GeatAllBrandAsync(); long id; if (search == null) { nonCatalogHeads = await nhnch.FindLatestNonCatalogHeadAsync(10); } else if (long.TryParse(search, out id)) { nonCatalogHeads = await nhnch.FindIdNonCatalogHeadListAsync(id); } else { nonCatalogHeads = await nhnch.SearchNonCatalogByNameAsync(search); } return(View(nonCatalogHeads)); }
// GET api/<controller>/5 public async Task <IList <SubCategoryModel> > Get(long id) { var category = new NHibernateCategoryStore(); var sub = await category.GeatSubCategoryAsync(id); return(sub); }
public async Task <ActionResult> QuoteAnalysis() { var category = new NHibernateCategoryStore(); var supplier = new NHibernateISupplierStore(); var employees = new NHibernateCompanyStore(); ViewData["pageName"] = "QuoteAnalysis"; ViewData["Categories"] = await category.GeatAllCategoryAsync(); ViewData["supplier"] = await supplier.GeatAllSupplierAsync(); ViewData["brand"] = await supplier.GeatAllBrandAsync(); ViewData["employees"] = await employees.GetAllEmployeeAsync(); return(View()); }
public async Task <long> Post(NonCatalogViewModel value) { const long PurchaserHead = 6; var nhnch = new NHibernateNonCatalogStore(); var user = new NHibernateUserStore(); var nnc = new NHibernateNonCatalogStore(); var supplierStore = new NHibernateISupplierStore(); var subcategoryStore = new NHibernateCategoryStore(); var company = new NHibernateCompanyStore(); var createdby = await user.FindByStampAsync(value.SecurityStamp); var nonCatalog = await nnc.GetNonCatalogAsync(value.Id); if (nonCatalog == null) { nonCatalog = new NonCatalogItemHeadModel(); } nonCatalog.Name = value.Name; nonCatalog.Analysis = value.Analysis; nonCatalog.SubCategory = await subcategoryStore.FindSubCategoryByIdAsync(value.SubCategoryId); nonCatalog.Requestor = await company.GetEmployeeAsync(value.RequestorId); nonCatalog.CreatedBy = createdby; nonCatalog.Approver = await company.GetPositionByIdAsync(PurchaserHead); for (var line = 0; line < nonCatalog.Lines.Count; line++) { if (!value.Lines.Any(x => x.Id == nonCatalog.Lines.ElementAt(line).Id)) { nonCatalog.Lines.ElementAt(line).DeleteTime = DateTime.UtcNow; } } foreach (var line in value.Lines) { if (nonCatalog.Lines.Any(x => x.Id == line.Id) && line.Id != 0) { continue; } var supplier = await supplierStore.FindSupplierByIdAsync(line.SupplierId); string tempSupplier = null; if (supplier == null) { tempSupplier = line.TempSupplier; } var nonCatalogLine = new NonCatalogItemLinesModel { Selected = line.Selected, Supplier = supplier, Price = line.Price, Description = line.Description, Quantity = line.Quantity, UOM = line.UOM, Discount = line.Discount, TotalAnount = line.TotalAnount, Availability = line.Availability, Terms = line.Terms, Brand = await supplierStore.FindBrandByIdAsync(line.BrandId), CreatedBy = createdby, TempSupplier = tempSupplier }; nonCatalog.Lines.Add(nonCatalogLine); } if (value.Approved) { nonCatalog.ApprovedBy = createdby; nonCatalog.DateApproved = DateTime.UtcNow; } return(await nnc.CreateNonCatalogHeadAsync(nonCatalog)); }