public ManagerMenu(LocationBL locationBL, OrderBL orderBL, InventoryBL inventoryBL, CustomerBL customerBL) { this.locationBL = locationBL; this.orderBL = orderBL; this.inventoryBL = inventoryBL; this.customerBL = customerBL; }
public static dynamic GetCategorys() { InventoryBL bl = new InventoryBL(); var result = bl.GetCategories(); return(result); }
public BookingResponse ReleaseItem(BookingDetailInfor bookingDetailInfor) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); ItemBooking itemBooking = inventoryBL.GetItemBooking(bookingDetailInfor.ItemBookingId); BookingResponse bookingResponse = new BookingResponse(); if (itemBooking != null) { if (itemBooking != null && (!(Utils.IsCompanyInventoryAdmin(itemBooking.Item.CompanyId.Value, bookingDetailInfor.UserId) || Utils.IsCompanyInventoryStaffMember(itemBooking.Item.CompanyId.Value, bookingDetailInfor.UserId, itemBooking.Item.LocationId, dataContext)))) { bookingResponse.Status = "NOTOK"; bookingResponse.ErrorCode = (int)ErrorCodes.NoEditPermissionForInventory; bookingResponse.Message = "Could not release the Item."; return(bookingResponse); } bool isSuccess = inventoryBL.RemoveInUseItemFromItemBrief(itemBooking.RelatedId, bookingDetailInfor.UserId); bookingResponse.Status = isSuccess ? "OK" : "NOTOK"; } else { bookingResponse.Status = "NOTOK"; } return(bookingResponse); } }
protected void btnSaveOrder_Click(object sender, EventArgs e) { InventoryBL bl = new InventoryBL(); tbl_Orders order = new tbl_Orders() { Order_Id = 0, Product_Id = Convert.ToInt32(ddlProducts.SelectedItem.Value), Items_Count = Convert.ToInt32(ddlNumberOfItems.SelectedItem.Value), Product_Cost = Convert.ToInt32(txtCost.Text), Amount = Convert.ToInt32(txtAmount.Text), Customer_Name = txtCustName.Text, Customer_Address = txtAddress.Text, Customer_Phone = txtCustPhone.Text, Gross_Amount = Convert.ToInt32(txtGrossAmount.Text), Service_Charge = Convert.ToInt32(txtServiceCharge.Text), Vat_Charge = Convert.ToInt32(txtVat.Text), NetAmount = Convert.ToInt32(txtNetAmount.Text) }; //if (!bl.ValidateProduct(product)) //{ bool result = bl.SaveOrder(order); if (result == true) { ScriptManager.RegisterStartupScript(this, GetType(), "product error", "alert('Order placed successfully!');", true); Response.Redirect("Orders.aspx"); } }
public static dynamic GetBrands() { InventoryBL bl = new InventoryBL(); var result = bl.GetBrands(); return(result); }
public void LoadProductPriceDetails() { int numberOfItems = Convert.ToInt32(ddlNumberOfItems.SelectedItem.Value); int productId = Convert.ToInt32(ddlProducts.SelectedItem.Value); if (productId > 0 && numberOfItems > 0) { InventoryBL bl = new InventoryBL(); var product = bl.GetProducts(productId).FirstOrDefault(); if (product != null) { if (product.Supplier_Id > 0) { var supplier = bl.GetSuppliers(product.Supplier_Id).FirstOrDefault(); if (supplier != null) { txtCost.Text = product.Price.ToString(); txtAmount.Text = (product.Price * numberOfItems).ToString(); txtGrossAmount.Text = (product.Price * numberOfItems).ToString(); txtServiceCharge.Text = supplier.Service_Charge_Value; txtVat.Text = supplier.Vat_Charge_Value; txtNetAmount.Text = ((product.Price * numberOfItems) + Convert.ToInt32(supplier.Service_Charge_Value) + Convert.ToInt32(supplier.Vat_Charge_Value)).ToString(); } } } } }
public static dynamic GetUsers() { InventoryBL bl = new InventoryBL(); var users = bl.GetUsers(); return(users); }
/// <summary> /// Gets all initialize data for user. /// </summary> /// <param name="userId">The user identifier.</param> /// <returns></returns> public static MobileInitialData GetAllInitializeDataForUser(int userId) { using (StageBitzDB dataContext = new StageBitzDB()) { MobileInitialData mobileInitialData = new MobileInitialData(); //Get the Companies that the user can access CompanyBL companyBL = new CompanyBL(dataContext); List <CompanyListInfo> companyList = companyBL.GetCompanyList(userId, false, false, true); var extractedcompanyList = (from cl in companyList select new CompanyListOfUser { Id = cl.CompanyId, Name = cl.CompanyName, IsCompanyUser = cl.IsInventoryStaff ? 1 : 0 }).ToList <CompanyListOfUser>(); mobileInitialData.CompanyList = extractedcompanyList; //Get all the system Item Types InventoryBL inventoryBL = new InventoryBL(dataContext); List <ItemTypeData> itemTypeList = inventoryBL.GetAllSystemItemTypes(); mobileInitialData.ItemTypeList = itemTypeList; return(mobileInitialData); } }
protected void btnRegiser_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtFirstName.Text) && !string.IsNullOrEmpty(txtLastName.Text) && !string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtConfirmPassword.Text)) { if (txtPassword.Text != txtConfirmPassword.Text) { ScriptManager.RegisterStartupScript(this, GetType(), "Login error", "alert('Password and confirm password should be same!');", true); return; } InventoryBL bl = new InventoryBL(); bool result = bl.SaveUser(new tbl_Users() { FirstName = txtFirstName.Text, LastName = txtLastName.Text, Email_Id = txtEmail.Text, Gender = "", Phone = "", Password = txtPassword.Text, Group_Id = 3, IsActive = true }); if (result == true) { ScriptManager.RegisterStartupScript(this, GetType(), "Login error", "alert('You have successfully register. Please login.');", true); Response.Redirect("Login.aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "Login error", "alert('Error registering user. This might because of duplicate email address.');", true); } } }
/// <summary> /// Generates the company inventory booking reports. /// </summary> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="bookingPath">The booking path.</param> private void GenerateCompanyInventoryBookingReports(int companyId, int userId, string bookingPath) { string fileName = "Booking List"; InventoryManageBookingListReportParameters parametersBookingList = new InventoryManageBookingListReportParameters { BookingStatus = null, CompanyId = companyId, CreatedByUserId = userId, IsInventoryManagerMode = true, SearchText = string.Empty, ShowArchived = false, SortExpression = string.Empty, UserId = userId }; string fileNameExtension; string encoding; string mimeType; List <Task> asyncTaskList = new List <Task>(); byte[] reportBytes = UserWebReportHandler.GenerateInventoryManageBookingListReport(parametersBookingList, ReportTypes.Excel, out fileNameExtension, out encoding, out mimeType); asyncTaskList.Add(FileHandler.SaveFileToDisk(reportBytes, string.Format("{0}.{1}", fileName, fileNameExtension), bookingPath)); InventoryBL inventoryBL = new InventoryBL(DataContext); var bookings = inventoryBL.GetBookingInfo(companyId, null, string.Empty, null, false); foreach (BookingInfo booking in bookings) { asyncTaskList.Add(SaveBookingDetailsReport(booking, companyId, userId, bookingPath)); } Task.WaitAll(asyncTaskList.ToArray()); }
/// <summary> /// Saves the booking details report. /// </summary> /// <param name="booking">The booking.</param> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="bookingPath">The booking path.</param> private Task SaveBookingDetailsReport(BookingInfo booking, int companyId, int userId, string bookingPath) { InventoryBL inventoryBL = new InventoryBL(DataContext); string bookingDetailsFileName = string.Format("{0} {1} details", booking.BookingNumber, Utils.Ellipsize(booking.BookingName, 50)); BookingDetailsReportParameters parametersBookingDetails = new BookingDetailsReportParameters { BookingId = booking.BookingId, BookingName = booking.BookingName, CompanyId = companyId, ContactPerson = null, DisplayMode = "Admin", ItemTypeId = 0, RelatedTable = booking.RelatedTable, SortExpression = string.Empty, UserId = userId }; string fileNameExtension; string encoding; string mimeType; byte[] reportBytes = UserWebReportHandler.GenerateBookingDetailsReport(parametersBookingDetails, ReportTypes.Excel, out fileNameExtension, out encoding, out mimeType, true); return(FileHandler.SaveFileToDisk(reportBytes, string.Format("{0}.{1}", bookingDetailsFileName, fileNameExtension), bookingPath)); }
protected void btnSaveProduct_Click(object sender, EventArgs e) { InventoryBL bl = new InventoryBL(); tbl_Products product = new tbl_Products() { Product_ID = Convert.ToInt32(hdnProductId.Value), Product_Name = txtProductName.Text, SKU = txtSKU.Text, Supplier_Id = Convert.ToInt32(ddlSupplier.SelectedValue), Category_Id = Convert.ToInt32(ddlCategory.SelectedValue), Brand_Id = Convert.ToInt32(ddlBrand.SelectedValue), Store_Id = Convert.ToInt32(ddlStore.SelectedValue), Product_Description = txtDescription.Text, Product_Quantity = Convert.ToInt32(txtQuantity.Text), Price = Convert.ToInt32(txtPrice.Text), ExpiryDate = !string.IsNullOrEmpty(txtExpiryDate.Text) ? Convert.ToDateTime(txtExpiryDate.Text) : DateTime.MaxValue, Availability = Convert.ToBoolean(ddlActive.SelectedValue) }; //if (!bl.ValidateProduct(product)) //{ bool result = bl.SaveProduct(product); if (result == true) { ScriptManager.RegisterStartupScript(this, GetType(), "product error", "alert('Product Saved successfully!');", true); Response.Redirect("products.aspx"); } // } }
public void LoadDropdowns() { InventoryBL bl = new InventoryBL(); var supplier = bl.GetSuppliers(0); var categories = bl.GetCategories(); var brands = bl.GetBrands(); var stores = bl.GetStores(); ddlSupplier.Items.Add(new ListItem("Select", "0")); ddlCategory.Items.Add(new ListItem("Select", "0")); ddlBrand.Items.Add(new ListItem("Select", "0")); ddlStore.Items.Add(new ListItem("Select", "0")); foreach (var sup in supplier) { ddlSupplier.Items.Add(new ListItem(sup.Supplier_Name, sup.Supplier_Id.ToString())); } foreach (var item in categories) { ddlCategory.Items.Add(new ListItem(item.Category_Name, item.Category_Id.ToString())); } foreach (var item in brands) { ddlBrand.Items.Add(new ListItem(item.Brand_Name, item.Brand_Id.ToString())); } foreach (var item in stores) { ddlStore.Items.Add(new ListItem(item.Store_Name, item.Store_Id.ToString())); } }
public static bool DeleteStore(string id) { InventoryBL bl = new InventoryBL(); bool result = bl.DeleteStore(Convert.ToInt32(id)); return(result); }
/// <summary> /// Sends the booking delayed emails. /// </summary> /// <param name="dateToConsider">The date to consider.</param> public static void SendBookingDelayedEmails(DateTime dateToConsider) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); int delayedEmailCodeId = Utils.GetCodeIdByCodeValue("EmailTemplateTypeCode", "BOOKINGDELAYED"); string userWebUrl = Utils.GetSystemValue("SBUserWebURL"); var delayedBookings = (from ibs in dataContext.ItemBookings.Where(ibs => dataContext.IsItemBookingDelayedByDate(ibs.ItemBookingId, dateToConsider)) from eh in dataContext.EmailHistories.Where(eh => ibs.ItemBookingId == eh.RelatedId && eh.RelatedTable == "ItemBooking" && eh.EmailTemplateTypeCodeId == delayedEmailCodeId).DefaultIfEmpty().Take(1) join b in dataContext.Bookings on ibs.BookingId equals b.BookingId from ib in dataContext.ItemBriefs.Where(ib => ib.ItemBriefId == ibs.RelatedId && b.RelatedTable == "Project").DefaultIfEmpty().Take(1) from npb in dataContext.NonProjectBookings.Where(npb => npb.NonProjectBookingId == b.RelatedId && b.RelatedTable == "NonProject").DefaultIfEmpty().Take(1) join i in dataContext.Items on ibs.ItemId equals i.ItemId join u in dataContext.Users on ibs.CreatedBy equals u.UserId where eh == null && ibs.IsActive && i.CompanyId.HasValue select new { ItemBrief = ib, NonProjectBooking = npb, CompanyId = i.CompanyId.Value, CreatedBy = u, ItemBooking = ibs, Item = i }).ToList(); foreach (var delayedBooking in delayedBookings) { User locationManager = inventoryBL.GetContactBookingManager(delayedBooking.Item.CompanyId.Value, delayedBooking.Item.LocationId); if (locationManager != null) { Data.EmailHistory emailHistory = new EmailHistory { EmailTemplateTypeCodeId = delayedEmailCodeId, RelatedId = delayedBooking.ItemBooking.ItemBookingId, RelatedTable = "ItemBooking", CreatedDate = Utils.Now }; dataContext.EmailHistories.AddObject(emailHistory); dataContext.SaveChanges(); string inventoryManagerName = string.Concat(locationManager.FirstName, " ", locationManager.LastName); if (delayedBooking.ItemBrief != null) { string url = string.Format("{0}/ItemBrief/ItemBriefDetails.aspx?ItemBriefId={1}&TabId=3", userWebUrl, delayedBooking.ItemBrief.ItemBriefId); EmailSender.SendBookingDelayedEmail(delayedBooking.CreatedBy.Email1, delayedBooking.CreatedBy.FirstName, delayedBooking.ItemBrief.Name, url, inventoryManagerName, locationManager.Email1); } else { EmailSender.SendBookingDelayedEmailForNonProject(delayedBooking.CreatedBy.Email1, delayedBooking.CreatedBy.FirstName, delayedBooking.NonProjectBooking.Name, inventoryManagerName, locationManager.Email1); } } } } }
public void LoadDashBoard() { InventoryBL bl = new InventoryBL(); var counts = bl.GetDashboardDetails(); spnBrandsCount.InnerHtml = Convert.ToString(counts.GetType().GetProperty("BrandsCount").GetValue(counts, null)); spnCategoriesCount.InnerHtml = Convert.ToString(counts.GetType().GetProperty("CategoriesCount").GetValue(counts, null)); }
public BookingResponse ReturnItem(BookingDetailInfor bookingDetailInfor) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); return(inventoryBL.ReturnItem(bookingDetailInfor.ItemBookingId, bookingDetailInfor.IsSelect, bookingDetailInfor.UserId)); } }
public List <string> GetCreatedForSearchItems(CreateForSearchRequest reqest) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); return(inventoryBL.GetCreatedForSearchItems(reqest.CompanyId, reqest.Keyword));; } }
public BookingDetailsSaveResult SaveBookingDetails(BookingDetailsEditedHeader bookingDetailsEditedHeader) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); BookingDetailsSaveResult bookingDetailsSaveResult = inventoryBL.SaveBookingDetails(bookingDetailsEditedHeader); return(bookingDetailsSaveResult); } }
public BookingResponse RejectBooking(BookingDetailInfor bookingDetailInfor) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); BookingResponse bookingResponse = inventoryBL.RejectBooking(bookingDetailInfor.ItemBookingId, bookingDetailInfor.UserId); return(bookingResponse); } }
public void SetInventory(int ID) { InventoryBL inventoryBL = new InventoryBL(); //table = inventoryBL.GetInventoryByID(ID); txtProductID.Text = table.Rows[0]["ProductID"].ToString(); txtQuantity.Text = table.Rows[0]["Quantity"].ToString(); txtUpdatedBy.Text = table.Rows[0]["UpdatedBy"].ToString(); dtpUpdatedDate.Value = DateTime.Parse(table.Rows[0]["UpdatedDate"].ToString()); }
public BookingEdit GetBookingDetails(BookingDetailsEditRequest bookingDetailsEditRequest) { using (StageBitzDB dataContext = new StageBitzDB()) { InventoryBL inventoryBL = new InventoryBL(dataContext); BookingEdit bookingEdit = inventoryBL.GetBookingDetails(bookingDetailsEditRequest); return(bookingEdit); } }
private void btnDelete_Click(object sender, EventArgs e) { InventoryBL inventoryBL = new InventoryBL(); if (dgvInventory.SelectedRows.Count > 0) { var id = (int)dgvInventory.SelectedRows[0].Cells["ID"].Value; //inventoryBL.DeleteInventory(id); //LoadInventory(); } }
public void LoadDropdowns() { InventoryBL bl = new InventoryBL(); var products = bl.GetProducts(0); ddlProducts.Items.Add(new ListItem("Select", "0")); foreach (var item in products) { ddlProducts.Items.Add(new ListItem(item.Product_Name, item.Product_ID.ToString())); } }
/// <summary> /// Handles the OnItemCommand event of the lvPinnedItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ListViewCommandEventArgs"/> instance containing the event data.</param> protected void lvPinnedItem_OnItemCommand(object sender, ListViewCommandEventArgs e) { if (!PageBase.StopProcessing) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; SelectedItemId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemId"]; int itemBookingId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemBookingId"]; switch (e.CommandName) { case "Remove": if (InformItemBriefDetailToGetCompleteItemDirtyStatus != null) { InformItemBriefDetailToGetCompleteItemDirtyStatus(); } if (IsCompleteItemTabDirty) { popupConfirmDirtySave.ShowPopup(); } else { ShowRemoveConfirmationMessage(); } break; case "Keep": InventoryBL inventoryBL = new InventoryBL(DataContext); Code bookingStatus = inventoryBL.GetItemBookingStatus(itemBookingId); if (bookingStatus != null && bookingStatus.CodeId == Utils.GetCodeIdByCodeValue("ItemBookingStatusCode", "PINNEDDELAYED")) { if (InformParentToShowDelayedPopup != null) { InformParentToShowDelayedPopup(SelectedItemId); } } else if (inventoryBL.CanKeepItem(ItemBriefId, SelectedItemId)) { popupBoxKeepItem.ShowPopup(); } else if (!GetBL <InventoryBL>().IsItemDeleted(SelectedItemId)) { //Needs to be provided by Mat popUpPinError.ShowPopup(); } break; } LoadData(); } }
public void LoadDropdowns() { InventoryBL bl = new InventoryBL(); var categories = bl.GetCategories(); ddlCategory.Items.Add(new ListItem("Select", "0")); foreach (var item in categories) { ddlCategory.Items.Add(new ListItem(bl.GetPropertyValue(item, "Category_Name"), bl.GetPropertyValue(item, "Category_Id"))); } }
public static dynamic GetStores() { InventoryBL bl = new InventoryBL(); var result = bl.GetStores().Select(x => new { Store_Id = x.Store_Id, Store_Name = x.Store_Name, Store_Status = x.Store_Status }).ToList(); return(result); }
public static dynamic GetBrands() { InventoryBL bl = new InventoryBL(); var result = bl.GetBrands().Select(x => new { Brand_Id = x.Brand_Id, Brand_Name = x.Brand_Name, Brand_Status = x.Brand_Status }).ToList(); return(result); }
/// <summary> /// Determines whether [has edit permission for inventory staff]. /// </summary> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> /// <returns></returns> public bool HasEditPermissionForInventoryStaff(int companyId, int userId, int?locationId) { FinanceBL financeBL = new FinanceBL(DataContext); InventoryBL inventoryBL = new InventoryBL(DataContext); bool hasPackageSelected = financeBL.HasPackageSelectedForFreeTrailEndedCompany(companyId); return((Utils.IsCompanyInventoryAdmin(companyId, userId) || (!locationId.HasValue && inventoryBL.IsCompanyInventoryStaffMemberAnyLocation(companyId, userId)) || (locationId.HasValue && Utils.IsCompanyInventoryStaffMember(companyId, userId, locationId, DataContext))) && !this.HasCompanySuspendedbySBAdmin(companyId) && hasPackageSelected && !IsCompanySuspended(companyId)); }
public static IMenu GetMenu(string menuType) { //configure var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); //connect string connectionString = configuration.GetConnectionString("StoreAppDB"); //Console.WriteLine(connectionString); //option DbContextOptions <StoreAppDBContext> options = new DbContextOptionsBuilder <StoreAppDBContext>() .UseSqlServer(connectionString) .Options; //context var context = new StoreAppDBContext(options); IRepository repo = new RepoDB(context); IValidationService inputValidation = new ValidationService(); ICustomerBL customerBL = new CustomerBL(repo); ILocationBL locationBL = new LocationBL(repo); IProductBL productBL = new ProductBL(repo); IInventoryBL inventoryBL = new InventoryBL(repo); IOrderBL orderBL = new OrderBL(repo); switch (menuType.ToLower()) { case "main": return(new MainMenu()); case "branch": return(new BranchMenu(locationBL, inputValidation)); case "product": return(new ProductMenu(productBL, inputValidation)); case "inventory": return(new InventoryMenu(locationBL, productBL, inventoryBL, orderBL, inputValidation)); case "customer": return(new CustomerMenu(customerBL)); case "order": return(new OrderMenu(customerBL, locationBL, productBL, inventoryBL, orderBL, inputValidation)); default: return(null); } }