void BackEnd(bool isOwnerControl = false) { lbl_DiscountPrice.Visible = (ProductDiscountPercentage == 0) ? false : true; //Fill Variables lbl_ProductName.Text = ProductName; lbl_ProductTag.Text = ProductTag; pic_ProductImage.ImageLocation = ProductImagePath; lbl_ProductQuantity.Text = lbl_ProductQuantity_RS.Text = ProductQuantity.ToString(); lbl_ProductPrice.Text = lbl_DiscountPrice.Text = lbl_ProductPrice_RS.Text = Currency + " " + (ProductUnitPrice * ProductQuantity).ToString(); txt_DiscountPtg.Text = ProductDiscountPercentage.ToString(); double ProductAmount = (ProductUnitPrice * ProductQuantity); if (ProductDiscountPercentage != 0) { lbl_DiscountPrice.Text = Currency + " " + ProductAmount.ToString(); ProductTotalPrice = ProductAmount - (ProductDiscountPercentage / 100 * ProductAmount); } else { ProductTotalPrice = ProductAmount; } //Finally Update Price & % txt_DiscountPtg.Text = ProductDiscountPercentage.ToString(); lbl_ProductPrice.Text = lbl_ProductPrice_RS.Text = Currency + " " + ProductTotalPrice.ToString(); //Update Checkout Price Sell frmSell = (Sell)Application.OpenForms[FormName]; frmSell.UpdateCheckout(); }
public EditProductViewModel() { var types = Enum.GetValues(typeof(ProductType)); ProductTypes = new List <string>(); foreach (var item in types) { ProductTypes.Add(item.ToString()); } //Verificar bug al no seleccionar imagen por segunda vez IPickPhotoCommand = new Command(async() => { try { await CrossMedia.Current.Initialize(); files.Clear(); if (!CrossMedia.Current.IsPickPhotoSupported) { await Shell.Current.DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK"); return; } var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions { PhotoSize = PhotoSize.Full, }); if (file == null) { ProductImg = ImageSource.FromFile("imgPlaceholder.jpg"); return; } else { ImgArray = ConvertToByteArray(file.GetStream()); ProductImg = ImageSource.FromStream(() => file.GetStream()); } //files.Add(file); } catch (Exception e) { Console.WriteLine(e); } }); UpdateCommand = new Command(async() => { List <string> values = new List <string>(); values.Add(ProductName); values.Add(ProductDescription); values.Add(ProductPrice); values.Add(ProductQuantity.ToString()); values.Add(SelectedType); if (GlobalValidator.CheckNullOrEmptyPropertiesOfListValues(values)) { ProductType productType = (ProductType)Enum.Parse(typeof(ProductType), SelectedType); var toupdate = new Product() { InventoryQuantity = ProductQuantity, Price = Convert.ToDouble(ProductPrice), ProductDescription = ProductDescription, ProductId = ToEditProduct.ProductId, ProductImage = ImgArray, ProductName = ProductName, StoreId = ToEditProduct.StoreId, Type = productType }; var itemUpdateResult = await productDataStore.UpdateItemAsync(toupdate); if (itemUpdateResult) { await Shell.Current.DisplayAlert("Notification", "Item Update.", "OK"); MessagingCenter.Send <Product>(toupdate, "InventoryItemUpdated"); } } else { await Shell.Current.DisplayAlert("Notification", "Some values are empty", "OK"); } }); }
public StoreControlPanelViewModel() { ProductTypes = new List <string>(Enum.GetNames(typeof(ProductType)).ToList()); EmpWorkHour = new ObservableCollection <EmployeeWorkHour>(); Store = new Store(); ProductImg = ImageSource.FromFile("imgPlaceholder.jpg"); GoAddProduct = new Command(async() => { await Shell.Current.GoToAsync($"AddProductRoute", animate: true); }); ProductPickPhotoCommand = new Command(async() => { await CrossMedia.Current.Initialize(); files.Clear(); if (!CrossMedia.Current.IsPickPhotoSupported) { await Shell.Current.DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK"); return; } var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions { PhotoSize = PhotoSize.Full, }); if (file == null) { return; } ImgArray = ConvertToByteArray(file.GetStream()); ProductImg = ImageSource.FromStream(() => file.GetStream()); }); CompleteCommand = new Command(async() => { List <string> Values = new List <string>(); Values.Add(ProductName); Values.Add(Description); Values.Add(ProductPrice); Values.Add(ProductQuantity.ToString()); if (GlobalValidator.CheckNullOrEmptyPropertiesOfListValues(Values)) { ProductType _productType = (ProductType)Enum.Parse(typeof(ProductType), SelectedType); var newStoreProduct = new Product() { ProductId = Guid.NewGuid(), InventoryQuantity = ProductQuantity, Price = Convert.ToDouble(ProductPrice), ProductImage = ImgArray, ProductName = ProductName, Type = _productType, StoreId = YourSelectedStore.StoreId, ProductDescription = ProductDescription }; var productAddedResult = await productDataStore.AddItemAsync(newStoreProduct); if (productAddedResult) { await Shell.Current.DisplayAlert("Notification", "Product Added", "OK"); } } else { await Shell.Current.DisplayAlert("Notification", "Some fields are empty", "OK"); } }); GoDashboards = new Command(async() => { await Shell.Current.DisplayAlert("Notification", "Is not developed yet. Coming Soon.", "OK"); }); GoOrdersCommand = new Command(async() => { await Shell.Current.GoToAsync($"EmployeeOrderControl?Id={YourSelectedStore.StoreId.ToString()}", animate: true); }); GoOrdersEmployeeCommand = new Command(async() => { await EmployeeShell.Current.GoToAsync($"EmployeeOrderControl?Id={Store.StoreId.ToString()}", animate: true); }); GoEmployeesCommand = new Command(async() => { await Shell.Current.GoToAsync($"StoreEmployeeRoute?Id={YourSelectedStore.StoreId.ToString()}", animate: true); //await Shell.Current.GoToAsync($"OrderPageRoute", animate: true); }); GoInventory = new Command(async() => { await Shell.Current.GoToAsync($"InventoryRoute", animate: true); }); GoSearchEmployeeCommand = new Command(async() => { await Shell.Current.GoToAsync($"{SearchEmployeePage.Route}?id={StoreId}", animate: true); }); GoOrderScanner = new Command(async() => { await Shell.Current.GoToAsync($"{OrderScannerPage.Route}"); }); MessagingCenter.Subscribe <Store>(this, "UpdatedStore", (sender) => { Store = sender; }); }
private void metroButton1_Click(object sender, EventArgs e) { //variables; string ProductName; int ProductQuantity; string SupplierName; int ReceivedStatus; decimal OrderCost; string ReceivedDate; string Received; SqlConnection sqlcon = new SqlConnection(Globals_Class.ConnectionString); sqlcon.Open(); string cmd = "Select ProductName, ProductQuantity, SupplierName, ReceivedStatus, OrderCost, ReceivedDate FROM ReceiveSupplierOrder"; SqlCommand sqlcom = new SqlCommand(cmd, sqlcon); SqlDataReader reader; reader = sqlcom.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { ProductName = (reader["ProductName"].ToString()); ProductQuantity = Convert.ToInt32((reader["ProductQuantity"])); SupplierName = (reader["SupplierName"].ToString()); ReceivedStatus = Convert.ToInt32((reader["ReceivedStatus"])); OrderCost = Convert.ToDecimal((reader["OrderCost"])); ReceivedDate = (reader["ReceivedDate"].ToString()); if (ReceivedStatus == 1) { Received = "Yes"; } else { Received = "No"; } Details += "\n" + "Product Name:" + " " + ProductName + "\n" + "Quantity Ordered:" + " " + ProductQuantity.ToString() + "\n" + "Supplier Name:" + " " + SupplierName + "\n" + "Received Status:" + " " + Received + "\n" + "Order Cost:" + " " + OrderCost.ToString() + "\n" + "Received Date:" + " " + ReceivedDate.ToString() + "\n"; } } reader.Close(); sqlcon.Close(); documentWriter(); }