public ActionResult Create(Inventory inventory) { if (ModelState.IsValid) { inventory.CompanyId = CurrentUser.CompanyId; inventory.AddedBy = CurrentUser.UserId; inventory.RemainingQuantity = inventory.OriginalQuantity; inventory.CreationDate = DateTime.Now; using (InventoryRepository inventoryRepository = new InventoryRepository(CurrentUser.CompanyId)) { if(inventoryRepository.Create(inventory)) return RedirectToAction("Index"); return Error(Loc.Dic.Error_DatabaseError); } } //using (OrderItemsRepository orderItemsRepository = new OrderItemsRepository()) using (LocationsRepository locationsRepository = new LocationsRepository(CurrentUser.CompanyId)) //using (InventoryRepository inventoryRepository = new InventoryRepository()) { //ViewBag.RelatedInventoryItem = new SelectList(orderItemsRepository.GetList(), "Id", "Title" + "SubTitle"); ViewBag.LocationId = new SelectList(locationsRepository.GetList().Where(x => x.CompanyId == CurrentUser.CompanyId), "Id", "Name"); } return View(inventory); }
public SaleProcessor(Database database, IOutgoingCommandEnvelopeRouter envelopeRouter, SaleRepository saleRepository, InventoryRepository inventoryRepository) { this.database = database; this.envelopeRouter = envelopeRouter; this.saleRepository = saleRepository; this.inventoryRepository = inventoryRepository; }
public void DoSomething_WhenInvoked_ShouldSubmitCorrectStubs() { var mockUnitOfWork = MockRepository.GenerateMock<IUnitOfWork>(); mockUnitOfWork.Stub(uow => uow.GetTable<Inventory>()).Return(new List<Inventory>(){new Inventory(){Quantity = 1}, new Inventory(){Quantity = 2}}.AsQueryable()); var rep = new InventoryRepository(mockUnitOfWork); rep.DoSomething(); Assert.Inconclusive(); }
public ActionResult AddInventory(InventoryViewModel model) { if (ModelState.IsValid) { InventoryRepository inventoryRepository = new InventoryRepository(new ApplicationDbContext()); inventoryRepository.Create(model); return RedirectToAction("Inventories"); } return View(model); }
public ActionResult Create() { using (SuppliersRepository suppliersRepository = new SuppliersRepository(CurrentUser.CompanyId)) using (LocationsRepository locationsRepository = new LocationsRepository(CurrentUser.CompanyId)) using (InventoryRepository inventoryRepository = new InventoryRepository(CurrentUser.CompanyId)) { ViewBag.RelatedInventoryItem = new SelectList(inventoryRepository.GetList("Orders_Items") .Select( x => new { Id = x.Id, InventarNumber = x.InventarNumber, Title = x.Orders_Items.Title, SubTitle = x.Orders_Items.SubTitle }) .ToList() .Select(x => new SelectListItemDB() { Id = x.Id, Name = x.InventarNumber + " - " + x.Title + " " + x.SubTitle }) .OrderBy(x => x.Name) .ToList(), "Id", "Name"); if (locationsRepository.GetList().Where(x => x.CompanyId == CurrentUser.CompanyId).Count() == 0) return Error(Loc.Dic.error_no_location_exist); ViewBag.LocationId = new SelectList(locationsRepository.GetList().Where(x => x.CompanyId == CurrentUser.CompanyId).OrderBy(x => x.Name).ToList(), "Id", "Name"); ViewBag.Suppliers = new SelectList(suppliersRepository.GetList().Where(x => x.CompanyId == CurrentUser.CompanyId).OrderBy(x=>x.Name).ToList(), "Id", "Name"); } return View(); }
public ContractorAppController(AccountantsRepository accountant, CarRepository car, ChequesRepository cheaque, CompaniesRepository companies, ContactsLoanRepository contactLoans, ExpensesRepository expenses, ExpensesTypes expensesTypes, FinancialcustodyRepository finacialCustody, InventoryprojectreleaseRepository inventoryprojectrelease, InventoryRepository inventory, InvoicesitemsRepository invoiceItem, InvoicesRepository invoice, LoansItemsRepository loanItems, LoansRepository loans, ProjectItemsRepository projectItems, UsersRepository userRepository ) { _userRepository = userRepository; _accountant = accountant; _car = car; _cheaque = cheaque; _companies = companies; _contactLoans = contactLoans; _expenses = expenses; _expensesTypes = expensesTypes; _finacialCustody = finacialCustody; _inventoryprojectrelease = inventoryprojectrelease; _inventory = inventory; _invoiceItem = invoiceItem; _invoice = invoice; _loanItems = loanItems; _loans = loans; _projectItems = projectItems; }
public JsonResult FindGroupNameByTenanId(int id) { var list = new InventoryRepository().FindPartGroupByTenanId(id); return Json(list, JsonRequestBehavior.AllowGet); }
public void CommonCategory() { var categoryList = InventoryRepository.GetAllCategories(); ViewBag.CategoryList = categoryList; }
public void Setup() { tenanId = 4178; pgId = 697; invRepo = new InventoryRepository(); }
public ActionResult EmployeeDelete(int employeeId) { InventoryRepository.DeleteEmployee(employeeId); CommonEmployee(); return(RedirectToAction("index", "Inventory", new { p = "Employee" })); }
public ActionResult OrderDelete(int orderId) { InventoryRepository.DeleteOrder(orderId); CommonOrder(); return(RedirectToAction("index", "Inventory", new { p = "Order" })); }
public ActionResult Edit(int id = 0) { Inventory inventory; List<Inventory> relatedInventoryItemList; List<Location> locationsList; using (InventoryRepository inventoryRep = new InventoryRepository(CurrentUser.CompanyId)) using (LocationsRepository locationsRep = new LocationsRepository(CurrentUser.CompanyId)) { inventory = inventoryRep.GetEntity(id); if (inventory == null) return Error(Loc.Dic.error_inventory_item_not_found); locationsList = locationsRep.GetList().ToList(); relatedInventoryItemList = inventoryRep.GetList("Orders_Items").ToList(); } ViewBag.RelatedInventoryItem = new SelectList(relatedInventoryItemList, "Id", "Orders_Items.Title", inventory.RelatedInventoryItem); ViewBag.LocationId = new SelectList(locationsList, "Id", "Name", inventory.LocationId); return View(inventory); }
public ICollection <InventoryCaptureProperties> GetAllCaptureUnitsByCritieriaString(IUnitOfWork uow, string criteria) { return(InventoryRepository.GetAllCaptureUnitsByCriteriaString(uow, criteria)); }
public InventoryItem GetItemBySN(IUnitOfWork uow, string sn) { return(InventoryRepository.GetItemBySN(uow, sn)); }
public SerializedUnit GetSerializedUnitById(IUnitOfWork uow, string lotId) { return(InventoryRepository.GetSerializedUnitById(uow, lotId)); }
public InventorysController(InventoryRepository repo) { _repo = repo; }
private void ShipOrderbtn_Click(object sender, EventArgs e) { ShipmentR i = new ShipmentR(); i.OrderId = this.orderIdTxt.Text; i.ShipmentProgress = 0; i.Status = ""; ShipmentRepository shipRepo = new ShipmentRepository(); //insert into shipment table if the product is sufficient in inventory if (Convert.ToInt32(this.quantityTxt.Text) <= Convert.ToInt32(this.textBox7.Text)) { if (shipRepo.Insert(i)) { //---------------update the volume in inventory after successful shipment-----------------// int latestVolume = Convert.ToInt32(this.textBox7.Text) - Convert.ToInt32(this.quantityTxt.Text); InventoryRepository ir = new InventoryRepository(); if (ir.updateInventory(this.productIdTxt.Text, latestVolume)) { MessageBox.Show("One Row Updated in Inventory"); } else { MessageBox.Show("Can't update inventory", "Update Error"); } //---------------Update and hide From Order Tabel after Shipment-----------------// OrderRepository or = new OrderRepository(); if (or.updateStatus(this.orderIdTxt.Text)) { MessageBox.Show("Order Updated"); } else { MessageBox.Show("unSuccessfull order update", "Update Error"); } MessageBox.Show("Succsfull ", "Shipment"); //---------------refresh the order Grid-----------------// List <OrderR> order = new List <OrderR>(); order = or.GetAllOrder(); this.dataGrid2.DataSource = order; this.orderIdTxt.Text = ""; this.productIdTxt.Text = ""; this.productNameTxt.Text = ""; this.quantityTxt.Text = ""; this.addressTxt.Text = ""; this.employeeNameTxt.Text = ""; } else { MessageBox.Show("Can Not Ship Order", "Ship Error"); } } else { MessageBox.Show("Unsufficient amount of Product", "Available Error"); } }
public int AddDirectTransfer(DirectTransferModel directTransferModel) { try { #region "1# DirectTransfer Master and DirectTransfer Details Add" var directTransferMaster = directTransferModel.DirectTransferMasterData; var directTransferDetailsList = directTransferModel.DirectTransferDetailsList; var imeiList = directTransferModel.ReceiveSerialNoDetails; // generate Requisition No int dtSerial = _entities.direct_transfer_master.Max(rq => (int?)rq.direct_transfer_master_id) ?? 0; if (dtSerial != 0) { dtSerial++; } else { dtSerial++; } var dtStr = dtSerial.ToString().PadLeft(7, '0'); string dtCode = "TRN-" + dtStr; directTransferMaster.direct_transfer_code = dtCode; directTransferMaster.from_warehouse_id = directTransferModel.DirectTransferMasterData.from_warehouse_id; directTransferMaster.to_warehouse_id = directTransferModel.DirectTransferMasterData.to_warehouse_id; directTransferMaster.transfer_date = directTransferModel.DirectTransferMasterData.transfer_date; directTransferMaster.remarks = directTransferModel.DirectTransferMasterData.remarks; directTransferMaster.created_by = directTransferModel.DirectTransferMasterData.created_by; _entities.direct_transfer_master.Add(directTransferMaster); _entities.SaveChanges(); long directTransferMasterId = directTransferMaster.direct_transfer_master_id; foreach (var item in directTransferDetailsList) { var directTransferDetails = new direct_transfer_details { direct_transfer_master_id = directTransferMasterId, product_id = item.product_id, color_id = item.color_id, product_version_id = item.product_version_id, quantity = item.quantity }; _entities.direct_transfer_details.Add(directTransferDetails); _entities.SaveChanges(); } #endregion #region "2# Update current_warehouse_id in receive_serial_no_details table" foreach (var item in imeiList) { var imeiNo = item.imei_no; var imaiDetails = _entities.receive_serial_no_details.FirstOrDefault(r => r.imei_no == imeiNo || r.imei_no2 == imeiNo); if (imaiDetails != null) { imaiDetails.current_warehouse_id = directTransferModel.DirectTransferMasterData.to_warehouse_id; } _entities.SaveChanges(); } #endregion #region "3# Update inventory" // update inventory InventoryRepository updateInventoty = new InventoryRepository(); foreach (var item in directTransferDetailsList) { updateInventoty.UpdateInventory("TRANSFER", dtCode, (int)directTransferMaster.from_warehouse_id, directTransferMaster.to_warehouse_id ?? 0, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 3, (int)item.quantity, directTransferMaster.created_by ?? 0); } #endregion return(1); } catch (Exception ex) { return(0); } }
public InventoryService(InventoryRepository inventoryRepository, InventoryItemRepository inventoryItemRepository, MedicineRepository medicineRepository) { _inventoryRepository = inventoryRepository; _inventoryItemRepository = inventoryItemRepository; _medicineRepository = medicineRepository; }
public AdminDashboard() { InitializeComponent(); //marketing Info MarketingRepository mr = new MarketingRepository(); // this.totalCampaigns.Text = "Total Campaigns : " + Convert.ToString(mr.countAllCampaigns()); // this.appCampaign.Text = "Approved Campaigns : " + Convert.ToString(mr.countAllApprovedCampaigns("Approved")); //Hr Info EmployeeRepository m = new EmployeeRepository(); /* * EmployeeRepository m = new EmployeeRepository(); * this.label123.Text += Convert.ToString(m.countAllEmployee()); * this.label129.Text += Convert.ToString(m.countEmployee("Admin")); * this.label125.Text += Convert.ToString(m.countEmployee("Sales")); * this.label127.Text += Convert.ToString(m.countEmployee("Marketing")); * this.label124.Text += Convert.ToString(m.countEmployee("Human Resource")); * this.label126.Text += Convert.ToString(m.countEmployee("Accounting")); * this.label128.Text += Convert.ToString(m.countEmployee("Finance")); * * this.label120.Text += Convert.ToString(m.countAllStatus("Full Time")); * this.label119.Text += Convert.ToString(m.countAllStatus("Probationary")); * this.label118.Text += Convert.ToString(m.countAllStatus("Intern")); * * * this.label120.Text += Convert.ToString(m.countAllStatus("Full Time")); * this.label119.Text += Convert.ToString(m.countAllStatus("Probationary")); * this.label118.Text += Convert.ToString(m.countAllStatus("Intern"));*/ this.hrGraph2.Visible = false; this.hrGraph.Series["emp"].Points.AddXY("Admin", m.countEmployee("Admin")); this.hrGraph.Series["emp"].Points.AddXY("Sales", m.countEmployee("Sales")); this.hrGraph.Series["emp"].Points.AddXY("HR", m.countEmployee("Human Resource")); this.hrGraph.Series["emp"].Points.AddXY("IT", m.countEmployee("IT")); this.hrGraph.Series["emp"].Points.AddXY("Accounts", m.countEmployee("Accounting")); this.hrGraph.Series["emp"].Points.AddXY("Finance", m.countEmployee("Finance")); this.hrGraph.Series["emp"].Points.AddXY("Marketing", m.countEmployee("Marketing")); this.hrGraph2.Series["Status"].Points.AddXY("Full Time", m.countAllStatus("Full Time")); this.hrGraph2.Series["Status"].Points.AddXY("Probationary", m.countAllStatus("Probationary")); this.hrGraph2.Series["Status"].Points.AddXY("Intern", m.countAllStatus("Intern")); //sales Info //get all the data // count the total order in groupBox3 OrderRepository or = new OrderRepository(); /* this.label117.Text = "Total Order : " + Convert.ToString(or.countAllOrder()); * this.label114.Text = "Bike : " + Convert.ToString(or.countOrder("Bike")); * this.label108.Text = "Car : " + Convert.ToString(or.countOrder("Car")); * this.label111.Text = "Cng : " + Convert.ToString(or.countOrder("Cng")); * this.label112.Text = "Microbus : " + Convert.ToString(or.countOrder("Microbus")); * this.label92.Text = "Pickup : " + Convert.ToString(or.countOrder("Pickup")); * this.label90.Text = "Truck : " + Convert.ToString(or.countOrder("Truck")); */ /* this.orderGraph.Series["Order"].Points.AddXY("Bike:" + Convert.ToString(or.countOrder("Bike")), or.countOrder("Bike")); * this.orderGraph.Series["Order"].Points.AddXY("Car:" + Convert.ToString(or.countOrder("Car")), or.countOrder("Car") ); * this.orderGraph.Series["Order"].Points.AddXY("Cng:" + Convert.ToString(or.countOrder("Cng")), or.countOrder("Cng")); * this.orderGraph.Series["Order"].Points.AddXY("Microbus:" + Convert.ToString(or.countOrder("Microbus")), or.countOrder("Microbus")); * this.orderGraph.Series["Order"].Points.AddXY("Pickup:" + Convert.ToString(or.countOrder("Pickup")), or.countOrder("Pickup")); * this.orderGraph.Series["Order"].Points.AddXY("Truck:"+ Convert.ToString(or.countOrder("Truck")), or.countOrder("Truck"));*/ this.orderGraph.Series["Order"].Points.AddXY("Bike", or.countOrder("Bike")); this.orderGraph.Series["Order"].Points.AddXY("Car", or.countOrder("Car")); this.orderGraph.Series["Order"].Points.AddXY("Cng", or.countOrder("Cng")); this.orderGraph.Series["Order"].Points.AddXY("Microbus", or.countOrder("Microbus")); this.orderGraph.Series["Order"].Points.AddXY("Pickup", or.countOrder("Pickup")); this.orderGraph.Series["Order"].Points.AddXY("Truck", or.countOrder("Truck")); //count the total Inventory in groupBox4 InventoryRepository ir = new InventoryRepository(); /* this.label73.Text = "Total Inventory : " + Convert.ToString(ir.countAllInventory()); * this.label138.Text = "Bike :" + Convert.ToString(ir.countInventory("Bike")); * this.label135.Text = "Car :" + Convert.ToString(ir.countInventory("Car")); * this.label136.Text = "Cng :" + Convert.ToString(ir.countInventory("Cng")); * this.label137.Text = "Microbus :" + Convert.ToString(ir.countInventory("Microbus")); * this.label134.Text = "Pickup :" + Convert.ToString(ir.countInventory("Pickup")); * this.label133.Text = "Truck :" + Convert.ToString(ir.countInventory("Truck")); */ this.inventoryGraph.Series["Inventory"].Points.AddXY("Bike", ir.countInventory("Bike")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Car", ir.countInventory("Car")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Cng", ir.countInventory("Cng")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Microbus", ir.countInventory("Microbus")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Pickup", ir.countInventory("Pickup")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Truck", ir.countInventory("Truck")); //count all shipment ShipmentRepository sr = new ShipmentRepository(); /* this.label52.Text = "Total Shipment : " + Convert.ToString(sr.countAllShipment()); * this.label72.Text = "At Origin : " + Convert.ToString(sr.countShipment("At Origin")); * this.label66.Text = "On the Way : " + Convert.ToString(sr.countShipment("On the Way")); * this.label70.Text = "Stucked : " + Convert.ToString(sr.countShipment("Stuked")); * this.label71.Text = "At Destination : " + Convert.ToString(sr.countShipment("At Destination")); * this.label68.Text = "Shipped : " + Convert.ToString(sr.countShipment("Shipped")); */ this.shipmentGraph.Series["Shipment"].Points.AddXY("At Origin", sr.countShipment("At Origin")); this.shipmentGraph.Series["Shipment"].Points.AddXY("On the Way", sr.countShipment("On the Way")); this.shipmentGraph.Series["Shipment"].Points.AddXY("Stucked", sr.countShipment("Stuked")); this.shipmentGraph.Series["Shipment"].Points.AddXY("At Destination", sr.countShipment("At Destination")); this.shipmentGraph.Series["Shipment"].Points.AddXY("Shipped", sr.countShipment("Shipped")); //accounting AccountingRepository ar = new AccountingRepository(); // this.totalCashLabel.Text = "totalCash : " + Convert.ToString(ar.countTotalCash()); }
public ActionResult Inventories() { InventoryRepository inventoryRepository = new InventoryRepository(new ApplicationDbContext()); var model = inventoryRepository.GetAll(); return View(model); }
public NSLotIdSerial GetNSLotBySerialNumber(IUnitOfWork uow, string serialNumber) { return(InventoryRepository.GetNSLotBySerialNumber(uow, serialNumber)); }
public long CreateMrr(MrrModel objMrrModel) { try { var mrrMaster = objMrrModel.MrrMasterData; var mrrDetailsList = objMrrModel.MrrDetailsList; var fromWarehouseId = mrrMaster.from_warehouse_id; long saleableWarehouseId = 1; long mrrSerial = _entities.mrr_master.Max(mr => (long?)mr.mrr_master_id) ?? 0; mrrSerial++; var mrrStr = mrrSerial.ToString(CultureInfo.InvariantCulture).PadLeft(7, '0'); //Insert Mrr Master Table string mrrNo = "MRR-" + mrrStr; mrrMaster.mrr_no = mrrNo; mrrMaster.grn_master_id = objMrrModel.MrrMasterData.grn_master_id; mrrMaster.lost_comment = objMrrModel.MrrMasterData.lost_comment; mrrMaster.created_by = objMrrModel.MrrMasterData.created_by; mrrMaster.created_date = DateTime.Now; _entities.mrr_master.Add(mrrMaster); _entities.SaveChanges(); long mrrMasterId = mrrMaster.mrr_master_id; // at first updating all imeis a saleable //var receiveSerialNoDetails = // _entities.receive_serial_no_details.Where(m => m.grn_master_id == mrrMaster.grn_master_id).ToList(); //foreach (var serialObj in receiveSerialNoDetails) //{ // serialObj.received_warehouse_id = saleableWarehouseId; // serialObj.current_warehouse_id = saleableWarehouseId; // serialObj.mrr_status = true; // serialObj.mrr_saleable = true; // serialObj.mrr_box_damage = false; // serialObj.mrr_physical_damage = false; // serialObj.customs_lost = false; // _entities.SaveChanges(); //} int updatingReceiveSerials = _entities.Database.ExecuteSqlCommand("UPDATE receive_serial_no_details SET mrr_status=1 , mrr_saleable=1,mrr_box_damage=0 ,mrr_physical_damage=0,customs_lost=0, received_warehouse_id='" + saleableWarehouseId + "', current_warehouse_id='" + saleableWarehouseId + "' WHERE grn_master_id='" + mrrMaster.grn_master_id + "'"); _entities.SaveChanges(); // Insert Mrr Details Table with damaged/lost products foreach (var item in mrrDetailsList) { var mrrDetail = new mrr_details { mrr_master_id = mrrMasterId, product_id = item.product_id, color_id = item.color_id, product_version_id = item.product_version_id, grn_quantity = item.grn_quantity, saleable_quantity = item.saleable_quantity, physical_damaged_quantity = item.physical_damaged_quantity, box_damage_quantity = item.box_damage_quantity, customs_lost_quantity = item.customs_lost_quantity, total_received_quantity = item.total_received_quantity }; _entities.mrr_details.Add(mrrDetail); int save = _entities.SaveChanges(); //updateInventoty.UpdateInventory() if (save > 0) { var updateInventoty = new InventoryRepository(); if (item.saleable_quantity > 0) { updateInventoty.UpdateInventory("MRR-Saleable", mrrMaster.mrr_no, fromWarehouseId ?? 0, saleableWarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 1, item.saleable_quantity ?? 0, mrrMaster.created_by ?? 0); } if (item.physical_damaged_quantity > 0) { var physicalwarehouseId = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Physical Damage Warehouse") .warehouse_id; updateInventoty.UpdateInventory("MRR-Physical Damage", mrrMaster.mrr_no, fromWarehouseId ?? 0, physicalwarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 1, item.physical_damaged_quantity ?? 0, mrrMaster.created_by ?? 0); } if (item.box_damage_quantity > 0) { var boxDamagewarehouseId = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Box Damage Warehouse") .warehouse_id; updateInventoty.UpdateInventory("MRR-Box Damage", mrrMaster.mrr_no, fromWarehouseId ?? 0, boxDamagewarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 1, item.box_damage_quantity ?? 0, mrrMaster.created_by ?? 0); } if (item.customs_lost_quantity > 0) { var customLostwarehouseId = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Customs Lost") .warehouse_id; updateInventoty.UpdateInventory("MRR-Customs Lost", mrrMaster.mrr_no, fromWarehouseId ?? 0, customLostwarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 1, item.customs_lost_quantity ?? 0, mrrMaster.created_by ?? 0); } } } //Update Receive Serial No Details var receiveSerialDetails = objMrrModel.ReceiveSerialNoDetails; foreach (var item in receiveSerialDetails) { var receiveSerialNo = _entities.receive_serial_no_details.SingleOrDefault(mrr => mrr.receive_serial_no_details_id == item.receive_serial_no_details_id); if (item.damage_type_name == "Box Damage") { var singleOrDefault = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Box Damage Warehouse"); if (singleOrDefault != null) { var warehouseId = singleOrDefault .warehouse_id; receiveSerialNo.mrr_box_damage = true; receiveSerialNo.mrr_status = true; receiveSerialNo.mrr_saleable = false; receiveSerialNo.current_warehouse_id = warehouseId; _entities.SaveChanges(); } } if (item.damage_type_name == "Physical Damage") { var warehouseId = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Physical Damage Warehouse") .warehouse_id; receiveSerialNo.mrr_physical_damage = true; receiveSerialNo.mrr_status = true; receiveSerialNo.mrr_saleable = false; receiveSerialNo.current_warehouse_id = warehouseId; _entities.SaveChanges(); } if (item.damage_type_name == "Customs Lost") { var warehouseId = _entities.warehouses.SingleOrDefault(w => w.warehouse_name == "Customs Lost") .warehouse_id; receiveSerialNo.customs_lost = true; receiveSerialNo.mrr_status = true; receiveSerialNo.mrr_saleable = false; receiveSerialNo.current_warehouse_id = warehouseId; _entities.SaveChanges(); } } //Update Mrr Status in Grn Master var mrrStatus = _entities.grn_master.Find(mrrMaster.grn_master_id); mrrStatus.mrr_status = true; //Get Mail Data int counter = 0; var rEmail = ""; var dataSmtp = _entities.notifier_mail_account.FirstOrDefault(s => s.is_active == true); var dataReceiver = (from mrs in _entities.mail_receiver_setting join spm in _entities.software_process_module on mrs.process_code_id equals spm.process_code_id select new { mail_receiver_setting_id = mrs.mail_receiver_setting_id, process_code_name = spm.process_code_name, process_code_id = spm.process_code_id, receiver_name = mrs.receiver_name, receiver_email = mrs.receiver_email, is_active = mrs.is_active, is_deleted = mrs.is_deleted, created_by = mrs.created_by, created_date = mrs.created_date, updated_by = mrs.updated_by, updated_date = mrs.updated_date }).Where(c => c.is_deleted != true && c.process_code_name == "MRR").OrderByDescending(c => c.mail_receiver_setting_id).ToList(); var dataProcess = (from mrs in _entities.process_wise_mail_setting join spm in _entities.software_process_module on mrs.process_code_id equals spm.process_code_id select new { process_wise_mail_setting_id = mrs.process_wise_mail_setting_id, process_code_name = spm.process_code_name, process_code_id = spm.process_code_id, email_body = mrs.email_body, email_subject = mrs.email_subject, is_active = mrs.is_active, is_deleted = mrs.is_deleted, created_by = mrs.created_by, created_date = mrs.created_date, updated_by = mrs.updated_by, updated_date = mrs.updated_date }).FirstOrDefault(c => c.is_deleted != true && c.process_code_name == "MRR"); //get current Mrr information------------------------ var mrrInformation = this.GetMrrInformationById(mrrMasterId); StringBuilder sb = new StringBuilder(); sb.Append("<h4 style='color: red'>" + dataProcess.email_body + "</h4>"); sb.Append("<table>"); sb.Append("<tr>"); sb.Append("<td><b>MRR No</b></td>"); sb.Append("<td><b>: <span style='color: red'>" + mrrInformation[0].mrr_no + "</span></b></td>"); sb.Append("</tr>"); sb.Append("<tr>"); sb.Append("<td><b>GRN No</b></td>"); sb.Append("<td><b>: " + mrrInformation[0].grn_no + "</b></td>"); sb.Append("</tr>"); sb.Append("<tr>"); sb.Append("<td><b>MRR Date</b></td>"); sb.Append("<td><b>: " + mrrInformation[0].created_date + "</b></td>"); sb.Append("</tr>"); sb.Append("<tr>"); sb.Append("<td><b>Created By</b></td>"); sb.Append("<td><b>: " + mrrInformation[0].created_by + "</b></td>"); sb.Append("</tr>"); sb.Append("</table>"); sb.Append("<br/>"); sb.Append("<table border='1px' cellpadding='7'>"); sb.Append("<tr>"); sb.Append("<th>Product Name</th>"); sb.Append("<th>Color</th>"); sb.Append("<th>Version</th>"); sb.Append("<th>GRN Qty</th>"); sb.Append("<th>Saleable</th>"); sb.Append("<th>Custom Lost</th>"); sb.Append("<th>Box Damage</th>"); sb.Append("<th>Physical Damage</th>"); sb.Append("<th>Total Received</th>"); sb.Append("</tr>"); foreach (var item in mrrInformation) { sb.Append("<tr align='center'>"); sb.Append("<td>" + item.product_name + "</td>"); sb.Append("<td>" + item.color_name + "</td>"); sb.Append("<td>" + item.product_version_name + "</td>"); sb.Append("<td>" + item.grn_quantity + "</td>"); sb.Append("<td>" + item.saleable_quantity + "</td>"); sb.Append("<td>" + item.customs_lost_quantity + "</td>"); sb.Append("<td>" + item.box_damage_quantity + "</td>"); sb.Append("<td>" + item.physical_damaged_quantity + "</td>"); sb.Append("<td>" + item.total_received_quantity + "</td>"); sb.Append("</tr>"); } sb.Append("</table>"); string mrrNumberEmailBody = sb.ToString(); foreach (var item in dataReceiver) { if (counter == 0) { rEmail = item.receiver_email; } rEmail += "," + item.receiver_email; counter++; } //Send Confirmation Mail mailRepository.SendMail(dataSmtp.account_email, rEmail, dataProcess.email_subject, mrrNumberEmailBody, dataSmtp.account_email, dataSmtp.accoutn_password, ""); _entities.SaveChanges(); return(1); } catch (Exception) { return(0); } }
public ActionResult Index(int page = FIRST_PAGE, string sortby = DEFAULT_SORT, string order = DEFAULT_DESC_ORDER) { IEnumerable<Inventory> inventories; using (InventoryRepository inventoryRepository = new InventoryRepository(CurrentUser.CompanyId)) { inventories = inventoryRepository.GetList("Orders_Items", "Location").Where(x => x.CompanyId == CurrentUser.CompanyId); inventories = Pagination(inventories, page, sortby, order); ViewBag.CurrentUser = CurrentUser; return View(inventories.ToList()); } }
public InventoryItem GetItemRecordById(IUnitOfWork uow, string lotid) { return(InventoryRepository.GetItemRecordById(uow, lotid)); }
public InventoryController(ILogger <InventoryController> logger, InventoryRepository repo) { _logger = logger; _repo = repo; }
public SerializedUnit GetSerializedUnitBySN(string sn) { return(InventoryRepository.GetSerializedUnitBySN(sn)); }
// Create New Internal Requisition Cash public long AddInternalRequisition(InternalRequisitionModel objInternalRequisitionModel) { try { var intReqMaster = objInternalRequisitionModel.InternalRequisitionMaster; var internalRequisitionDetailsList = objInternalRequisitionModel.InternalRequisitionDetails; int save = 0; //Auto Number Creator long internalRequisitionSerial = _entities.internal_requisition_master.Max(re => (long?)re.internal_requisition_master_id) ?? 0; internalRequisitionSerial++; var internalRequisitionSerialNo = internalRequisitionSerial.ToString().PadLeft(7, '0'); string intReqNo = "INT-REQ-" + internalRequisitionSerialNo; //Master Table intReqMaster.internal_requisition_no = intReqNo; intReqMaster.from_warehouse_id = objInternalRequisitionModel.InternalRequisitionMaster.from_warehouse_id; intReqMaster.to_department = objInternalRequisitionModel.InternalRequisitionMaster.to_department; intReqMaster.customar_name = objInternalRequisitionModel.InternalRequisitionMaster.customar_name; intReqMaster.mobile_no = objInternalRequisitionModel.InternalRequisitionMaster.mobile_no; intReqMaster.requisition_date = DateTime.Now; intReqMaster.payment_type = objInternalRequisitionModel.InternalRequisitionMaster.payment_type; intReqMaster.pricing = objInternalRequisitionModel.InternalRequisitionMaster.pricing; intReqMaster.remarks = objInternalRequisitionModel.InternalRequisitionMaster.remarks; intReqMaster.requisition_status = "Created"; intReqMaster.total_incentive_amount = internalRequisitionDetailsList.Sum(tin => tin.incentive_amount); intReqMaster.total_amount = objInternalRequisitionModel.InternalRequisitionMaster.total_amount; intReqMaster.created_by = objInternalRequisitionModel.InternalRequisitionMaster.created_by; intReqMaster.created_date = DateTime.Now; _entities.internal_requisition_master.Add(intReqMaster); _entities.SaveChanges(); //Details Table long intReqMasterId = intReqMaster.internal_requisition_master_id; foreach (var item in internalRequisitionDetailsList) { var internalRequisitionDetails = new internal_requisition_details { internal_requisition_master_id = intReqMasterId, product_id = item.product_id, color_id = item.color_id, product_version_id = item.product_version_id, quantity = item.quantity, price = item.price, amount = item.amount, is_gift = item.is_gift, gift_type = item.gift_type, incentive_amount = item.incentive_amount, promotion_master_id = item.promotion_master_id, }; _entities.internal_requisition_details.Add(internalRequisitionDetails); save = _entities.SaveChanges(); } // Delivery Master Table if (save > 0) { var deliveryMaster = new delivery_master(); //Get To Warehouse Id var toWarehouseId = _entities.warehouses.SingleOrDefault( a => a.warehouse_name == "Internal (Cash) Warehouse").warehouse_id; //Get Delivery Party Id var partyId = _entities.warehouses.SingleOrDefault( a => a.warehouse_name == "Internal (Cash) Warehouse").party_id; //Get Party Address var partyAddress = _entities.parties.SingleOrDefault( a => a.party_name == "Internal (Cash)").address; long deliverySerial = _entities.delivery_master.Max(po => (long?)po.delivery_master_id) ?? 0; deliverySerial++; var deliveryStr = deliverySerial.ToString().PadLeft(7, '0'); string deliveryNo = "DN-INT-REQ" + "-" + deliveryStr; deliveryMaster.delivery_no = deliveryNo; deliveryMaster.delivery_date = DateTime.Now; deliveryMaster.party_id = partyId; deliveryMaster.requisition_master_id = intReqMasterId; deliveryMaster.courier_id = 0; deliveryMaster.courier_slip_no = ""; deliveryMaster.delivery_address = partyAddress; deliveryMaster.created_by = objInternalRequisitionModel.InternalRequisitionMaster.created_by; deliveryMaster.created_date = DateTime.Now; deliveryMaster.from_warehouse_id = objInternalRequisitionModel.InternalRequisitionMaster.from_warehouse_id; deliveryMaster.to_warehouse_id = toWarehouseId; deliveryMaster.status = "CASH-RFD"; deliveryMaster.remarks = "DN-INT-REQ"; deliveryMaster.total_amount = objInternalRequisitionModel.InternalRequisitionMaster.total_amount; deliveryMaster.lot_no = ""; deliveryMaster.vehicle_no = "DN-INT-REQ"; deliveryMaster.truck_driver_name = "DN-INT-REQ"; deliveryMaster.truck_driver_mobile = "DN-INT-REQ"; _entities.delivery_master.Add(deliveryMaster); _entities.SaveChanges(); long deliveryMasterId = deliveryMaster.delivery_master_id; // Delivery Details Table foreach (var item in internalRequisitionDetailsList) { var deliveryDetails = new delivery_details() { delivery_master_id = deliveryMasterId, product_id = item.product_id, color_id = item.color_id, product_version_id = item.product_version_id, delivered_quantity = item.quantity, is_gift = item.is_gift, requisition_quantity = item.quantity, unit_price = item.product_id, line_total = item.amount, party_id = partyId, gift_type = item.gift_type, is_live_dummy = false }; _entities.delivery_details.Add(deliveryDetails); int saved = _entities.SaveChanges(); if (saved > 0) { // update inventory InventoryRepository updateInventoty = new InventoryRepository(); var intransitWarehouseId = _entities.warehouses.SingleOrDefault(k => k.warehouse_name == "In Transit").warehouse_id; var masterDelivery = _entities.delivery_master.Find(deliveryMasterId); //'39' virtual in-transit warehouse updateInventoty.UpdateInventory("INT-REQ-DELIVERY", masterDelivery.delivery_no, masterDelivery.from_warehouse_id ?? 0, intransitWarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, 1, item.quantity ?? 0, objInternalRequisitionModel.InternalRequisitionMaster.created_by ?? 0); } } //For Party Journal //Get Party Account Balance var partyJournal = _entities.party_journal.Where(pj => pj.party_id == partyId) .OrderByDescending(p => p.party_journal_id) .FirstOrDefault(); decimal partyAccountBalance = 0; if (partyJournal != null) { partyAccountBalance = partyJournal.closing_balance ?? 0; } //Find Invoice Total decimal invoiceTotal = 0; invoiceTotal = objInternalRequisitionModel.InternalRequisitionMaster.total_amount ?? 0; //insert in both invoice master and party journal table //Account Balance decimal accountBalance = 0; accountBalance = invoiceTotal + partyAccountBalance; //Invoice Master Table long InvoiceSerial = _entities.invoice_master.Max(po => (long?)po.invoice_master_id) ?? 0; InvoiceSerial++; var invStr = InvoiceSerial.ToString().PadLeft(7, '0'); string invoiceNo = "INV-" + "INT-REQ" + "-" + invStr; invoice_master insert_invoice = new invoice_master { invoice_no = invoiceNo, invoice_date = System.DateTime.Now, party_id = partyId, requisition_master_id = intReqMasterId, party_type_id = 8, company_id = 0, remarks = objInternalRequisitionModel.InternalRequisitionMaster.remarks, created_by = objInternalRequisitionModel.InternalRequisitionMaster.created_by, created_date = DateTime.Now, incentive_amount = internalRequisitionDetailsList.Sum(tin => tin.incentive_amount), item_total = objInternalRequisitionModel.InternalRequisitionMaster.total_amount, rebate_total = 0, invoice_total = invoiceTotal, account_balance = accountBalance, }; _entities.invoice_master.Add(insert_invoice); _entities.SaveChanges(); long InvoiceMasterId = insert_invoice.invoice_master_id; //Invoice Details Table foreach (var item in internalRequisitionDetailsList) { var getProductCategory = _entities.products.SingleOrDefault(p => p.product_id == item.product_id).product_category_id; var getProductUnit = _entities.products.SingleOrDefault(p => p.product_id == item.product_id).unit_id; var invoiceDetails_insert = new invoice_details { invoice_master_id = InvoiceMasterId, product_category_id = getProductCategory, product_id = item.product_id, color_id = item.color_id, product_version_id = item.product_version_id, unit_id = getProductUnit, price = item.price, quantity = item.quantity, line_total = item.amount, is_gift = item.is_gift, gift_type = item.gift_type, is_live_dummy = false }; _entities.invoice_details.Add(invoiceDetails_insert); _entities.SaveChanges(); } //Party Journal partyJournalRepository.PartyJournalEntry("INVOICE", partyId ?? 0, invoiceTotal, "Invoice", objInternalRequisitionModel.InternalRequisitionMaster.created_by ?? 0, invoiceNo); //Receive Serial Table var serialNumber = objInternalRequisitionModel.ReceiveSerialNoDetails; var intransitWarehouse = _entities.warehouses.SingleOrDefault(k => k.warehouse_name == "In Transit").warehouse_id; //Get Delivery Party Id var partyIdForDelivery = _entities.warehouses.SingleOrDefault( a => a.warehouse_name == "Internal (Cash) Warehouse").party_id; foreach (var item in serialNumber) { receive_serial_no_details receiveSerialNoDetails = _entities.receive_serial_no_details.FirstOrDefault( r => r.imei_no == item.imei_no || r.imei_no2 == item.imei_no2); receiveSerialNoDetails.current_warehouse_id = intransitWarehouse; receiveSerialNoDetails.party_id = partyIdForDelivery; receiveSerialNoDetails.deliver_date = DateTime.Now; receiveSerialNoDetails.requisition_id = intReqMasterId; receiveSerialNoDetails.deliver_master_id = deliveryMasterId; receiveSerialNoDetails.is_gift = item.is_gift; receiveSerialNoDetails.gift_type = item.gift_type; receiveSerialNoDetails.is_live_dummy = false; _entities.SaveChanges(); } } return(1); } catch (Exception ex) { return(0); } }
public InventoryItem GetItemByLotIdOrSerialNumber(IUnitOfWork uow, string identifier) { return(InventoryRepository.GetItemByLotIdOrSerialNumber(uow, identifier)); }
public bool ConfirmDelivery(long delivery_master_id, long user_id) { try { //Update Delivery Master var deliveryMaster = _entities.delivery_master.SingleOrDefault(dm => dm.delivery_master_id == delivery_master_id); deliveryMaster.status = "CASH-Delivered"; deliveryMaster.delivered_by = user_id; deliveryMaster.delivery_date = DateTime.Now; deliveryMaster.receive_by = user_id; deliveryMaster.receive_date = DateTime.Now; _entities.SaveChanges(); var detailsList = _entities.delivery_details.Where(d => d.delivery_master_id == delivery_master_id).ToList(); //Update internal Requisition Master var intReqMaster = _entities.internal_requisition_master.SingleOrDefault( irm => irm.internal_requisition_master_id == deliveryMaster.requisition_master_id); intReqMaster.requisition_status = "Delivered"; // Get Intransit Warehouse var intransitWarehouseId = _entities.warehouses.SingleOrDefault(k => k.warehouse_name == "In Transit").warehouse_id; //Get To Warehouse Id var toWarehouseId = _entities.warehouses.SingleOrDefault( a => a.warehouse_name == "Internal (Cash) Warehouse").warehouse_id; // Update inventory InventoryRepository updateInventoty = new InventoryRepository(); foreach (var item in detailsList) { //'39' virtual in-transit warehouse To Internal Cash updateInventoty.UpdateInventory("INT-REQ-CONFIRM", deliveryMaster.delivery_no, intransitWarehouseId, toWarehouseId, item.product_id ?? 0, item.color_id ?? 0, item.product_version_id ?? 0, item.unit_id ?? 0, item.delivered_quantity ?? 0, user_id); } //Get Delivery Master Id In receive Serial table var receiveSerialList = _entities.receive_serial_no_details.Where(rsd => rsd.deliver_master_id == delivery_master_id) .ToList(); // Update Receive Serial foreach (var item in receiveSerialList) { receive_serial_no_details receiveSerial = _entities.receive_serial_no_details.FirstOrDefault( rsd => rsd.receive_serial_no_details_id == item.receive_serial_no_details_id); receiveSerial.current_warehouse_id = deliveryMaster.to_warehouse_id; receiveSerial.deliver_date = DateTime.Now; receiveSerial.sales_status = true; receiveSerial.sales_date = DateTime.Now; _entities.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public InventoryServiceProperties GetServicePropertiesForItem(IUnitOfWork uow, InventoryItem item) { return(InventoryRepository.GetServicePropertiesForItem(uow, item)); }
public bool CancelDelivery(long delivery_master_id, long user_id) { try { //Cancel Delivery Master var deliveryMaster = _entities.delivery_master.SingleOrDefault(dm => dm.delivery_master_id == delivery_master_id); deliveryMaster.status = "Cancel"; deliveryMaster.updated_by = user_id; deliveryMaster.updated_date = DateTime.Now; _entities.SaveChanges(); //Cancel Internal Requisition Master var intReqMaster = _entities.internal_requisition_master.SingleOrDefault( inrm => inrm.internal_requisition_master_id == deliveryMaster.requisition_master_id); intReqMaster.requisition_status = "Cancel"; _entities.SaveChanges(); //Cancel Invoice Master var invoiceMaster = _entities.invoice_master.SingleOrDefault( im => im.requisition_master_id == intReqMaster.internal_requisition_master_id); invoiceMaster.is_active = false; invoiceMaster.is_deleted = true; invoiceMaster.updated_by = user_id; invoiceMaster.updated_date = DateTime.Now; _entities.SaveChanges(); // Get Intransit Warehouse var intransitWarehouseId = _entities.warehouses.SingleOrDefault(k => k.warehouse_name == "In Transit").warehouse_id; //Cancel Inventory var details = _entities.delivery_details.Where(a => a.delivery_master_id == delivery_master_id).ToList(); foreach (var deliveryDetails in details) { var updateInventoty = new InventoryRepository(); //From warehouse== Internal Requisition To warehouse=Central updateInventoty.UpdateInventory("INT-REQ-CANCEL", deliveryMaster.delivery_no, intransitWarehouseId, deliveryMaster.from_warehouse_id ?? 0, deliveryDetails.product_id ?? 0, deliveryDetails.color_id ?? 0, deliveryDetails.product_version_id ?? 0, 1, deliveryDetails.delivered_quantity ?? 0, user_id); } //Cancel Party Journal var partyJournal = _entities.party_journal.Where(pj => pj.party_id == deliveryMaster.party_id) .OrderByDescending(p => p.party_journal_id) .FirstOrDefault(); decimal partyAccountBalance = 0; if (partyJournal != null) { partyAccountBalance = partyJournal.closing_balance ?? 0; } //calculate Invoice total decimal?invoiceTotal = _entities.internal_requisition_master.SingleOrDefault(a => a.internal_requisition_master_id == deliveryMaster.requisition_master_id).total_amount; partyJournalRepository.PartyJournalEntry("RETURN_INVOICE", deliveryMaster.party_id ?? 0, invoiceTotal ?? 0, "Cancel", user_id, intReqMaster.internal_requisition_no); //Cancel Receive Serial Details var serialNo = _entities.receive_serial_no_details.Where(a => a.deliver_master_id == deliveryMaster.delivery_master_id) .ToList(); //Get Delivery From Warehouse var deliveryMasterFromWarehouse = _entities.delivery_master.SingleOrDefault(dm => dm.delivery_master_id == delivery_master_id) .from_warehouse_id; //Get Central warehouse //var centralWarehouseId = // _entities.warehouses.SingleOrDefault(k => k.warehouse_name == "WE Central Warehouse").warehouse_id; foreach (var receiveSerialNo in serialNo) { receive_serial_no_details receiveSerial = _entities.receive_serial_no_details.FirstOrDefault(r => r.receive_serial_no_details_id == receiveSerialNo.receive_serial_no_details_id); receiveSerial.current_warehouse_id = deliveryMasterFromWarehouse; receiveSerial.party_id = 0; receiveSerial.deliver_date = null; receiveSerial.sales_status = false; receiveSerial.sales_date = null; receiveSerial.is_gift = false; receiveSerial.gift_type = ""; receiveSerial.deliver_master_id = 0; receiveSerial.requisition_id = 0; _entities.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public void CommonEmployee() { var employeeList = InventoryRepository.GetAllSuppliers(); ViewBag.EmployeeList = employeeList; }
public async Task <SearchQueryViewModel> GetSearchQueryViewModelAsync(GetSearchQueryViewModelParams param) { SearchQueryViewModel viewModel; Debug.Assert(param.CultureInfo != null, "param.CultureInfo != null"); var searchQueryProducts = await SearchQueryRepository.SearchQueryProductAsync(new SearchQueryProductParams() { CultureName = param.CultureInfo.Name, QueryName = param.QueryName, QueryType = param.QueryType, ScopeId = param.Scope, Criteria = param.Criteria }).ConfigureAwait(false); var documents = searchQueryProducts.Result.Documents.Select(ToProductDocument).ToList(); var inventoryLocations = await InventoryRepository.GetInventoryLocationStatusesBySkus( new GetInventoryLocationStatuseParam() { Skus = documents.Select(d => d.Sku).ToList(), ScopeId = param.Scope, InventoryLocationIds = param.InventoryLocationIds }).ConfigureAwait(false); FixInventories(documents, inventoryLocations); documents = await FixInventoryFilter(documents, param.Scope).ConfigureAwait(false); var getImageParam = new GetProductMainImagesParam { ImageSize = SearchConfiguration.DefaultImageSize, ProductImageRequests = documents .Select(document => new ProductImageRequest { ProductId = document.ProductId, Variant = document.PropertyBag.ContainsKey(VariantPropertyBagKey) ? new VariantKey { Id = document.PropertyBag[VariantPropertyBagKey].ToString() } : VariantKey.Empty, ProductDefinitionName = document.PropertyBag.ContainsKey("DefinitionName") ? document.PropertyBag["DefinitionName"].ToString() : string.Empty, PropertyBag = document.PropertyBag }).ToList() }; var imageUrls = await DamProvider.GetProductMainImagesAsync(getImageParam).ConfigureAwait(false); Debug.Assert(param.Criteria != null, "param.Criteria != null"); var newCriteria = param.Criteria.Clone(); var createSearchViewModelParam = new CreateProductSearchResultsViewModelParam <SearchParam> { SearchParam = new SearchParam() { Criteria = newCriteria }, ImageUrls = imageUrls, SearchResult = new ProductSearchResult() { Documents = documents, TotalCount = searchQueryProducts.Result.TotalCount, Facets = searchQueryProducts.Result.Facets } }; viewModel = new SearchQueryViewModel { SelectedFacets = await GetSelectedFacetsAsync(createSearchViewModelParam.SearchParam).ConfigureAwait(false), ProductSearchResults = await CreateProductSearchResultsViewModelAsync(createSearchViewModelParam).ConfigureAwait(false), }; if (searchQueryProducts.SelectedFacets != null) { foreach (var facet in searchQueryProducts.SelectedFacets) { foreach (var value in facet.Values) { if (viewModel.SelectedFacets.Facets.All(f => f.Value != value)) { viewModel.SelectedFacets.Facets.Add(new SelectedFacet() { Value = value, FieldName = facet.FacetName, DisplayName = value, IsRemovable = false }); } } } foreach (var selectedFacet in searchQueryProducts.SelectedFacets) { foreach (var facet in viewModel.ProductSearchResults.Facets.Where(d => d.FieldName == selectedFacet.FacetName)) { foreach (var facetValue in selectedFacet.Values.Select(value => facet.FacetValues.FirstOrDefault(f => f.Value == value)).Where(facetValue => facetValue != null)) { facetValue.IsSelected = true; } } } } viewModel.Context[nameof(viewModel.ProductSearchResults.SearchResults)] = viewModel.ProductSearchResults.SearchResults; viewModel.Context[nameof(SearchConfiguration.MaxItemsPerPage)] = SearchConfiguration.MaxItemsPerPage; viewModel.Context["ListName"] = "Search Query"; return(viewModel); }
public void CommonOrder() { var orderList = InventoryRepository.GetAllOrders(); ViewBag.OrderList = orderList; }
private void LoadRepositories() { userRepository = new UserRepository(new CSVStream <User>(userFile, new UserConverter()), new ComplexSequencer()); // USER OK roomRepository = new RoomRepository(new CSVStream <Room>(roomFile, new RoomConverter()), new LongSequencer()); // ROOM OK inventoryItemRepository = new InventoryItemRepository(new CSVStream <InventoryItem>(inventoryItemFile, new InventoryItemConverter()), new LongSequencer(), roomRepository); timeTableRepository = new TimeTableRepository(new CSVStream <TimeTable>(timeTableFile, new TimeTableConverter()), new LongSequencer()); // TIMETABLE OK hospitalRepository = new HospitalRepository(new CSVStream <Hospital>(hospitalFile, new HospitalConverter()), new LongSequencer(), roomRepository); // HOSPITAL OK secretaryRepository = new SecretaryRepository(new CSVStream <Secretary>(secretaryFile, new SecretaryConverter()), new ComplexSequencer(), timeTableRepository, hospitalRepository, userRepository); // SECRETARY OK managerRepository = new ManagerRepository(new CSVStream <Manager>(managerFile, new ManagerConverter()), new ComplexSequencer(), timeTableRepository, hospitalRepository, userRepository); // MANAGER OK doctorRepository = new DoctorRepository(new CSVStream <Doctor>(doctorFile, new DoctorConverter()), new ComplexSequencer(), timeTableRepository, hospitalRepository, roomRepository, userRepository); // DOCTOR OK patientRepository = new PatientRepository(new CSVStream <Patient>(patientFile, new PatientConverter()), new ComplexSequencer(), doctorRepository, userRepository); // PATIENT OK hospitalRepository.DoctorRepository = doctorRepository; hospitalRepository.ManagerRepository = managerRepository; hospitalRepository.SecretaryRepository = secretaryRepository; //Misc repositories locationRepository = new LocationRepository(new CSVStream <Location>(locationFile, new LocationConverter()), new LongSequencer()); // LOCATION OK notificationRepository = new NotificationRepository(new CSVStream <Notification>(notificationFile, new NotificationConverter()), new LongSequencer(), patientRepository, doctorRepository, managerRepository, secretaryRepository); // NOTIFICATION OK messageRepository = new MessageRepository(new CSVStream <Message>(messageFile, new MessageConverter()), new LongSequencer(), patientRepository, doctorRepository, managerRepository, secretaryRepository); // MESSAGE OK articleRepository = new ArticleRepository(new CSVStream <Article>(articleFile, new ArticleConverter()), new LongSequencer(), doctorRepository, managerRepository, secretaryRepository); //ARTICLE OK questionRepository = new QuestionRepository(new CSVStream <Question>(questionFile, new QuestionConverter()), new LongSequencer()); // QUESTION OK doctorQuestionRepository = new QuestionRepository(new CSVStream <Question>(doctorQuestionFile, new QuestionConverter()), new LongSequencer()); //DOCTOR QUESTION OK feedbackRepository = new FeedbackRepository(new CSVStream <Feedback>(feedbackFile, new FeedbackConverter()), new LongSequencer(), questionRepository, patientRepository, doctorRepository, managerRepository, secretaryRepository); doctorFeedbackRepository = new DoctorFeedbackRepository(new CSVStream <DoctorFeedback>(doctorFeedbackFile, new DoctorFeedbackConverter()), new LongSequencer(), doctorQuestionRepository, patientRepository, doctorRepository); //Hospital management repositories symptomRepository = new SymptomRepository(new CSVStream <Symptom>(symptomsFile, new SymptomConverter()), new LongSequencer()); //SYMPTOM REPO OK diseaseRepository = new DiseaseRepository(new CSVStream <Disease>(diseaseFile, new DiseaseConverter()), new LongSequencer(), medicineRepository, symptomRepository); //DISEASE REPO OK ingredientRepository = new IngredientRepository(new CSVStream <Ingredient>(ingredientFile, new IngredientConverter()), new LongSequencer()); //INGREDIENT REPO OK medicineRepository = new MedicineRepository(new CSVStream <Medicine>(medicineFile, new MedicineConverter()), new LongSequencer(), ingredientRepository, diseaseRepository); //MEDICINE REPO OK prescriptionRepository = new PrescriptionRepository(new CSVStream <Prescription>(prescriptionFile, new PrescriptionConverter()), new LongSequencer(), doctorRepository, medicineRepository); //PRESCRIPTION REPO OK //Medical repositories allergyRepository = new AllergyRepository(new CSVStream <Allergy>(allergyFile, new AllergyConverter()), new LongSequencer(), ingredientRepository, symptomRepository); //ALLERGY REPO OK appointmentRepository = new AppointmentRepository(new CSVStream <Appointment>(appointmentsFile, new AppointmentConverter()), new LongSequencer(), patientRepository, doctorRepository, roomRepository); //GERGO REPO OK? therapyRepository = new TherapyRepository(new CSVStream <Therapy>(therapyFile, new TherapyConverter()), new LongSequencer(), medicalRecordRepository, medicalRecordRepository, prescriptionRepository, diagnosisRepository); //med record medicalRecordRepository = new MedicalRecordRepository(new CSVStream <MedicalRecord>(medicalRecordFile, new MedicalRecordConverter()), new LongSequencer(), patientRepository, diagnosisRepository, allergyRepository); //u medical record moras da set diagnosis repo diagnosisRepository = new DiagnosisRepository(new CSVStream <Diagnosis>(diagnosisFile, new DiagnosisConverter()), new LongSequencer(), therapyRepository, diseaseRepository, medicalRecordRepository); //therapy // therapyRepository = new TherapyRepository(new CSVStream<Therapy>(therapyFile,new TherapyConverter()),new LongSequencer(),medicalRecordRepository, ) diseaseRepository.MedicineEagerCSVRepository = medicineRepository; medicineRepository.DiseaseRepository = diseaseRepository; medicalRecordRepository.DiagnosisRepository = diagnosisRepository; diagnosisRepository.MedicalRecordRepository = medicalRecordRepository; diagnosisRepository.TherapyEagerCSVRepository = therapyRepository; therapyRepository.DiagnosisCSVRepository = diagnosisRepository; therapyRepository.MedicalRecordRepository = medicalRecordRepository; therapyRepository.MedicalRecordEagerCSVRepository = medicalRecordRepository; //ODAVDDE RADITI OSTALE doctorStatisticRepository = new DoctorStatisticRepository(new CSVStream <StatsDoctor>(doctorStatisticsFile, new DoctorStatisticsConverter(",")), new LongSequencer(), doctorRepository); // Doc Stats OK inventoryStatisticRepository = new InventoryStatisticsRepository(new CSVStream <StatsInventory>(inventoryStatisticsFile, new InventoryStatisticsConverter(",")), new LongSequencer(), medicineRepository, inventoryItemRepository); // InventoryStats OK roomStatisticRepository = new RoomStatisticsRepository(new CSVStream <StatsRoom>(roomStatisticsFile, new RoomStatisticsConverter(",")), new LongSequencer(), roomRepository); // RoomStats OK inventoryRepository = new InventoryRepository(new CSVStream <Inventory>(inventoryFile, new InventoryConverter(",", ";")), new LongSequencer(), inventoryItemRepository, medicineRepository); }
public void CommonOrderDetail() { var orderDetailList = InventoryRepository.GetAllOrderDetails(); ViewBag.OrderDetailList = orderDetailList; }
public InventoryService(InventoryRepository inventoryRepository) { this.inventoryRepository = inventoryRepository; }
public ActionResult AddToInventory(AddToInventoryModel model) { if (!Authorized(RoleType.InventoryManager)) return Error(Loc.Dic.error_no_permission); Order order; List<Inventory> createdItems = new List<Inventory>(); List<Location> locations; bool noCreationErrors = true; using (InventoryRepository inventoryRep = new InventoryRepository(CurrentUser.CompanyId)) using (LocationsRepository locationsRep = new LocationsRepository(CurrentUser.CompanyId)) using (OrdersRepository ordersRep = new OrdersRepository(CurrentUser.CompanyId)) { order = ordersRep.GetEntity(model.OrderId, "Supplier", "Orders_OrderToItem", "Orders_OrderToItem.Orders_Items"); if (order == null) return Error(Loc.Dic.error_order_get_error); if (order.WasAddedToInventory) return Error(Loc.Dic.error_order_was_added_to_inventory); if (order.StatusId < (int)StatusType.InvoiceApprovedByOrderCreatorPendingFileExport) return Error(Loc.Dic.error_invoice_not_scanned_and_approved); locations = locationsRep.GetList().ToList(); if (locations == null || locations.Count == 0) return Error(Loc.Dic.error_no_locations_found); foreach (SplittedInventoryItem splitedItem in model.InventoryItems) { if (!noCreationErrors) break; if (!splitedItem.AddToInventory) continue; int? itemId = splitedItem.ItemsToAdd[0].ItemId; Orders_OrderToItem originalItem = order.Orders_OrderToItem.FirstOrDefault(x => x.Id == itemId); bool isValidList = originalItem != null && splitedItem.ItemsToAdd.All(x => x.ItemId == itemId); if (!isValidList) { noCreationErrors = false; break; } if (splitedItem.ItemsToAdd.Count == 1) { Inventory listItem = splitedItem.ItemsToAdd[0]; if (!locations.Any(x => x.Id == listItem.LocationId)) return Error(Loc.Dic.error_invalid_form); Inventory newItem = new Inventory() { AssignedTo = listItem.AssignedTo, LocationId = listItem.LocationId, Notes = listItem.Notes, SerialNumber = listItem.SerialNumber, Status = listItem.Status, WarrentyPeriodStart = listItem.WarrentyPeriodStart, WarrentyPeriodEnd = listItem.WarrentyPeriodEnd, ItemId = originalItem.ItemId, OrderId = order.Id, CompanyId = CurrentUser.CompanyId, IsOutOfInventory = false, OriginalQuantity = originalItem.Quantity, RemainingQuantity = originalItem.Quantity }; if (!inventoryRep.Create(newItem)) { noCreationErrors = false; break; } createdItems.Add(newItem); } else if (originalItem.Quantity == splitedItem.ItemsToAdd.Count) { foreach (var item in splitedItem.ItemsToAdd) { if (!locations.Any(x => x.Id == item.LocationId)) { noCreationErrors = false; break; } item.ItemId = originalItem.ItemId; item.OrderId = order.Id; item.CompanyId = CurrentUser.CompanyId; item.IsOutOfInventory = false; if (!inventoryRep.Create(item)) { noCreationErrors = false; break; } createdItems.Add(item); } } else { noCreationErrors = false; break; } } if (!noCreationErrors) { foreach (var item in createdItems) { inventoryRep.Delete(item.Id); } return Error(Loc.Dic.error_inventory_create_error); } order.WasAddedToInventory = true; order.LastStatusChangeDate = DateTime.Now; if (ordersRep.Update(order) == null) return Error(Loc.Dic.error_database_error); bool hasInventoryItems = model.InventoryItems.Any(x => x.AddToInventory); string notes = hasInventoryItems ? Loc.Dic.AddToInventory_with_inventory_items : Loc.Dic.AddToInventory_no_inventory_items; int? historyActionId = null; historyActionId = (int)HistoryActions.AddedToInventory; Orders_History orderHistory = new Orders_History(); using (OrdersHistoryRepository ordersHistoryRep = new OrdersHistoryRepository(CurrentUser.CompanyId, CurrentUser.UserId, order.Id)) if (historyActionId.HasValue) ordersHistoryRep.Create(orderHistory, historyActionId.Value, notes); return RedirectToAction("PendingInventory"); } }
public InventoryController() { _repo = new InventoryRepository(); }
public JsonResult CountPagination(dynamic tenantid, dynamic groupid) { var list = new InventoryRepository().FindPageNumber(Int32.Parse(tenantid[0]), Int32.Parse(groupid[0])); return Json(list, JsonRequestBehavior.AllowGet); }
public void Setup() { _inventoryRepository = new InventoryRepository(); }
public JsonResult FindPartNameByGroupId(dynamic tenantid, dynamic groupid, dynamic starts, dynamic limits) { var list = new InventoryRepository().FindProductByGroupAndTenanId(Int32.Parse(tenantid[0]), Int32.Parse(groupid[0]), Int32.Parse(starts[0]), Int32.Parse(limits[0])); return Json(list, JsonRequestBehavior.AllowGet); }
public InventoryService() { inventoryRepo = new InventoryRepository(); }
public Sales() { InitializeComponent(); this.dataGrid2.Visible = false; this.dataGrid3.Visible = false; this.dataGrid4.Visible = false; this.groupBox1.Visible = false; this.groupBox2.Visible = false; //dashBoard text this.groupBox3.Visible = true; this.groupBox4.Visible = true; this.groupBox5.Visible = true; // init the ID from inventory table in this combobox InventoryRepository m = new InventoryRepository(); List <string> allId = m.GetAllId(); foreach (string id in allId) { this.comboBox1.Items.Add(id); } OrderRepository or = new OrderRepository(); this.totalOrderLabel.Text = "Total Order : " + Convert.ToString(or.countAllOrder()); this.totalBikeLabel.Text = "Bike : " + Convert.ToString(or.countOrder("Bike")); this.totalCarLabel.Text = "Car : " + Convert.ToString(or.countOrder("Car")); this.totalAutoLabel.Text = "Cng : " + Convert.ToString(or.countOrder("Cng")); this.totalMicroLabel.Text = "Microbus : " + Convert.ToString(or.countOrder("Microbus")); this.totalPickupLabel.Text = "Pickup : " + Convert.ToString(or.countOrder("Pickup")); this.totalTruckLabel.Text = "Truck : " + Convert.ToString(or.countOrder("Truck")); //count the total Inventory in groupBox4 InventoryRepository ir = new InventoryRepository(); this.totalInventoryLabel.Text = "Total Inventory : " + Convert.ToString(ir.countAllInventory()); this.totalBikeILabel.Text = "Bike :" + Convert.ToString(ir.countInventory("Bike")); this.totalCarILabel.Text = "Car :" + Convert.ToString(ir.countInventory("Car")); this.totalAutoILabel.Text = "Cng :" + Convert.ToString(ir.countInventory("Cng")); this.totalMicroILabel.Text = "Microbus :" + Convert.ToString(ir.countInventory("Microbus")); this.totalPickupILabel.Text = "Pickup :" + Convert.ToString(ir.countInventory("Pickup")); this.totalTruckILabel.Text = "Truck :" + Convert.ToString(ir.countInventory("Truck")); //count all shipment ShipmentRepository sr = new ShipmentRepository(); this.totalShipmentLabel.Text = "Total Shipment : " + Convert.ToString(sr.countAllShipment()); this.atOriginLabel.Text = "At Origin : " + Convert.ToString(sr.countShipment("At Origin")); this.onTheWayLabel.Text = "On the Way : " + Convert.ToString(sr.countShipment("On the Way")); this.stuckedLabel.Text = "Stucked : " + Convert.ToString(sr.countShipment("Stuked")); this.atDestinationLabel.Text = "At Destination : " + Convert.ToString(sr.countShipment("At Destination")); this.shippedLabel.Text = "Shipped : " + Convert.ToString(sr.countShipment("Shipped")); }
/// <summary> /// The inventory controller constructor /// </summary> /// <param name="repository"> /// The repository /// </param> public InventoryController(InventoryRepository repository) { this.repository = repository; }