private void ShowProduct(OwnProduct ownProduct) { SetInformation(ownProduct); FindPictureProduct(ownProduct.Id); GrDescription.Visibility = Visibility.Hidden; GrImagees.Visibility = Visibility.Hidden; GrSearch.Visibility = Visibility.Hidden; GrTotalInformation.Visibility = Visibility.Visible; GrInformation.Visibility = Visibility.Visible; btnDescription.Content = "Description"; btnImages.Content = "Images"; }
private void lvProducts_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } SelectedProduct = (OwnProduct)lvProducts.ItemContainerGenerator.ItemFromContainer(dep); ShowProduct(SelectedProduct); }
void SetInformation(OwnProduct t) { lblProductTittle.Content = "Product Tittel : " + t.ProductTittle; lblCompany.Content = "Company : " + t.Company.CompanyName; lblCategory.Content = "Category : " + t.ProductType.CategoriesSubCategory.Category.Name; lblSubCat.Content = "Sub Category : " + t.ProductType.CategoriesSubCategory.SubCategory.Name; lblProductType.Content = "Product Type : " + t.ProductType.Name; lblBrand.Content = "Brand : " + t.Brand.Name; lblCountryOfOrgin.Content = "Country Of Orgin : " + t.Country.Name; lblColor.Content = "Color : " + t.Color.Name.Trim(); lblMeterial.Content = "Meterial : " + t.Material.MaterialName; lblSku.Content = "SKU : " + t.Sku; lblStyleNumber.Content = "Style Number :" + t.StyleNumber; if (t.Barcode_Id_fk != null) { lblUPC.Content = "UPC : " + t.Barcode.BarcodeNumber; } lblPrice.Content = "Price : " + t.Price.ToString(); lblSize.Content = "Size : " + t.Width.ToString() + " * " + t.length.ToString(); lblGsm.Content = "GSM : " + t.Gsm.ToString(); lblHeader.Content = t.StyleNumber; GrSearch.Visibility = Visibility.Hidden; lblDescription.Content = string.Format("{0}", t.DescribeMaterial); }
public void AddProduct(OwnProduct ownProduct) { db.OwnProducts.Add(ownProduct); }
private void PeriveweAndPrepareForAdd() { if (cmbProductType.SelectedValue == null || cmbSubCategory.SelectedValue == null) { lblReview1.Content = "Check Category - Sub Category or Product Type"; lblReview2.Content = ""; lblReview1.Foreground = Brushes.DarkRed; YesForAdd.IsEnabled = false; } else { lblReview1.Foreground = Brushes.Black; YesForAdd.IsEnabled = true; string mac = GetMACAddress().ToString(); int categoryId = Convert.ToInt16(cmbCategory.SelectedValue.ToString()); int SubCategoryId = Convert.ToInt16(cmbSubCategory.SelectedValue.ToString()); int ProducttypeId = Convert.ToInt16(cmbProductType.SelectedValue.ToString()); int colorId = Convert.ToInt16(cmbColors.SelectedValue.ToString()); if (!IsExistCompany) { Company company = new Company(); company.Id = db.GiveMeCompanyId(mac); company.CompanyName = txtCompany.Text; company.Manufacture = txtManufacture.Text; company.Website = txtWebSite.Text; company.Email = txtEmail.Text; company.StreetAddress = txtStreetAddress.Text; company.AddressLine2 = txtAddressLine2.Text; company.City = txtCity.Text; company.StateProvinceRegion = txtStateProvineRegion.Text; company.ZipPostlCode = txtZipPostalCode.Text; company.Country_Id_fk = Convert.ToInt16(cmbCountry.SelectedValue.ToString()); company.Phone = txtPhone.Text; company.FAX = txtFax.Text; db.AddCompany(company); //if (ttt) // MessageBox.Show("Sucsess Save " + company.CompanyName); //else // MessageBox.Show("Error Db Save Company"); } string lastSku = db.LastSku(); string LastStyleNumber = db.LastStyleNumber(); GenerateSkuStyle cd = new GenerateSkuStyle(); var tt = cd.Generate(categoryId, SubCategoryId, ProducttypeId, colorId, lastSku, LastStyleNumber); product = new OwnProduct(); product.Id = db.GiveMeProductId(mac); product.ProductType_Id_fk = ProducttypeId; product.Sku = tt["Sku"]; product.StyleNumber = tt["StyleNumber"]; product.ProductTittle = txtProductTittle.Text; product.Color_Id_fk = Convert.ToInt16(colorId); product.Material_Id_fk = Convert.ToInt16(cmbMaterial.SelectedValue.ToString()); product.Brand_Id_fk = Convert.ToInt16(cmbBrand.SelectedValue.ToString()); product.CountryofOrgin_Id_fk = Convert.ToInt16(cmbCountryOfOrgin.SelectedValue.ToString()); product.Box = chkBox.IsChecked; product.Bag = chkBag.IsChecked; product.Wrap = chkWrap.IsChecked; product.NoPackaging = chkNoPacking.IsChecked; product.AirTransportation = chkAirTransportation.IsChecked; product.ShipTransportation = chkShipTransportation.IsChecked; product.Train = chkTrain.IsChecked; product.Truck = chkTruck.IsChecked; if (txtGsm.Text.Trim() != "") { product.Gsm = Int16.Parse(txtGsm.Text); } //if (txtWidth.Text.Trim() != "") // product.Width = float.Parse(txtWidth.Text); //if (txtLenght.Text.Trim() != "") // product.length = float.Parse(txtLenght.Text); //if (txtDepth.Text.Trim() != "") // product.Depth = float.Parse(txtDepth.Text); //if (txtHeight.Text.Trim() != "") // product.Height = float.Parse(txtHeight.Text); //if (txtWeight.Text.Trim() != "") // product.Weight = float.Parse(txtWeight.Text); product.SpecialPackingInstructions = txtSpecialPackaing.Text; if (txtPrice.Text.Trim() != "") { product.Price = float.Parse(txtPrice.Text); } product.Width = float.Parse(cvrt.WidthI.ToString()); product.length = float.Parse(cvrt.LenghtI.ToString()); product.Depth = float.Parse(cvrt.DepthI.ToString()); product.Height = float.Parse(cvrt.HeightI.ToString()); product.Weight = float.Parse(cvrt.WeightI.ToString()); product.Company_Id_fk = newCompanyId; product.DescribeMaterial = txtDescribeMaterial.Text; lblReview1.Content = String.Format(" Category : {0} \n\n SubCategory : {1} \n\n Product Type: {2} \n\n StyleNumber : {3} \n\n SKU :{4} \n\n Color :{5}\n\n GSM : {6} \n\n Price:{7} ", cmbCategory.Text, cmbSubCategory.Text, cmbProductType.Text, product.StyleNumber, product.Sku, cmbColors.Text, product.Gsm, product.Price); lblReview2.Foreground = Brushes.Black; lblReview2.Content = String.Format("Descibe Material : \n\n{0}", product.DescribeMaterial); // product.RFIDProtected = chkRFID.Checked; //product.TSAApprovedLock = chkTSA.Checked; //product.Expandable = chkExpandable.Checked; //product.WaterResistance = chkWaterResistance.Checked; //product.RetractableHandle = chkRestractable.Checked; //product.CheckPointFriendly = chkCheckPoint.Checked; } }