public Product(FamilyName family, ProductName prod, byte swwai = 0x00, int c = 2047) { this.deviceFamily = family; this.product = prod; this.swWhoAmI = swwai; this.continuity = c; }
public LicenseClass(DateTime created, DateTime goodTill, bool demo, string firstName, string lastName, string email, ProductName product) { CreatedOn = created; GoodTill = goodTill; Demo = demo; FirstName = firstName; LastName = lastName; Email = email; Product = product; }
public bool Equals(Product prod) { return(ProductCategory.Equals(prod.ProductCategory) && ProductGroup.Equals(prod.ProductGroup) && ProductName.Equals(prod.ProductName)); }
/// <summary> /// Register service factory /// </summary> /// <typeparam name="TFactory">factory of services</typeparam> /// <typeparam name="TService">type of services</typeparam> /// <param name="container">container of dependencies</param> /// <param name="lifestyle">Lifestyle</param> /// <param name="patternSuffix">pattern suffix</param> /// <param name="callback">callback for product key</param> /// <returns></returns> public static TFactory RegisterFactory <TFactory, TService>(Container container, Lifestyle lifestyle, string patternSuffix, ProductName callback) where TService : class where TFactory : Dictionary <string, Func <TService> > { var factory = Activator.CreateInstance <TFactory>(); var registrationsServiceFacade = from type in typeof(TFactory).Assembly.GetExportedTypes() where type.Name.EndsWith(patternSuffix) where !type.IsInterface where type.GetInterfaces().Any() where type.GetInterfaces().Contains(typeof(TService)) select new { Implementation = type, ProductName = callback != null?callback.Invoke(type) : type.Name }; foreach (var reg in registrationsServiceFacade) { factory.Add(reg.ProductName, () => (TService)container.GetInstance(reg.Implementation)); } return(factory); }
private void ProductNameChangedEventHandler(HandlerEvent <ProductNameChanged> handlerEvent) { LastUpdate = handlerEvent.EventDateTime; ProductName = handlerEvent.Event.ProductName; }
public override int GetHashCode() => HomeId.GetHashCode() ^ Name.GetHashCode() ^ ProductName.GetHashCode() ^ Id.GetHashCode();
private void SetNamesAndVersion(Assembly exeAssembly, bool isHttp) { Type mainType = null; // Get CompanyName, ProductName, and ProductVersion // First try custom attributes on the assembly. if (exeAssembly != null) { object[] attrs = exeAssembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); if ((attrs != null) && (attrs.Length > 0)) { _companyName = ((AssemblyCompanyAttribute)attrs[0]).Company?.Trim(); } attrs = exeAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false); if ((attrs != null) && (attrs.Length > 0)) { ProductName = ((AssemblyProductAttribute)attrs[0]).Product?.Trim(); } ProductVersion = exeAssembly.GetName().Version.ToString().Trim(); } // If we couldn't get custom attributes, fall back on the entry type namespace if (!isHttp && (string.IsNullOrEmpty(_companyName) || string.IsNullOrEmpty(ProductName) || string.IsNullOrEmpty(ProductVersion))) { if (exeAssembly != null) { MethodInfo entryPoint = exeAssembly.EntryPoint; if (entryPoint != null) { mainType = entryPoint.ReflectedType; } } string ns = null; if (mainType != null) { ns = mainType.Namespace; } if (string.IsNullOrEmpty(ProductName)) { // Try the remainder of the namespace if (ns != null) { int lastDot = ns.LastIndexOf('.'); if ((lastDot != -1) && (lastDot < ns.Length - 1)) { ProductName = ns.Substring(lastDot + 1); } else { ProductName = ns; } ProductName = ProductName.Trim(); } // Try the type of the entry assembly if (string.IsNullOrEmpty(ProductName) && (mainType != null)) { ProductName = mainType.Name.Trim(); } // give up, return empty string if (ProductName == null) { ProductName = string.Empty; } } if (string.IsNullOrEmpty(_companyName)) { // Try the first part of the namespace if (ns != null) { int firstDot = ns.IndexOf('.'); _companyName = firstDot != -1 ? ns.Substring(0, firstDot) : ns; _companyName = _companyName.Trim(); } // If that doesn't work, use the product name if (string.IsNullOrEmpty(_companyName)) { _companyName = ProductName; } } } // Desperate measures for product version - assume 1.0 if (string.IsNullOrEmpty(ProductVersion)) { ProductVersion = "1.0.0.0"; } }
public Product(ProductName productName) { ProductName = productName; }
public void ClickProductName() { ProductName.Click(); }
public XmlDocument CreateXml() { if (!IsValid()) { throw new Exception("Product Is not valid, XML will not be created"); } //http://help.webcomcpq.com/doku.php?id=appendixd:simple_product_administration:input_xml_example XmlDocument retVal = new XmlDocument(); XmlNode userProducts = retVal.CreateElement("Products"); retVal.AppendChild(userProducts); ////These are attributes of Products, still WIP://// if (SkipCategoriesOnProductUpdate != false) { XmlAttribute scopu = retVal.CreateAttribute("SkipCategoriesOnProductUpdate"); scopu.InnerText = SkipCategoriesOnProductUpdate.ToString().ToUpper(); userProducts.Attributes.Append(scopu); } if (SkipPermissionsOnProductUpdate != false) { XmlAttribute spopu = retVal.CreateAttribute("SkipPermissionsOnProductUpdate"); spopu.InnerText = SkipPermissionsOnProductUpdate.ToString().ToUpper(); userProducts.Attributes.Append(spopu); } //Product Tag: <PRODUCTS><PRODUCT> XmlNode userProduct = retVal.CreateElement("Product"); userProducts.AppendChild(userProduct); Utility.AddIfNotEmptyOrNull(userProduct, "Identificator", Identificator); Utility.AddIfNotEmptyOrNull(userProduct, "DisplayType", DisplayType); Utility.AddIfNotEmptyOrNull(userProduct, "ProductType", ProductType); if (ProductName != null) { ProductName.AddToXML(userProduct); } if (Categories != null) { Categories.AddToXML(userProduct); } Utility.AddIfNotEmptyOrNull(userProduct, "PartNumber", PartNumber); if (StartDate.HasValue) { Utility.AddIfNotEmptyOrNull(userProduct, "StartDate", StartDate); } if (EndDate.HasValue) { Utility.AddIfNotEmptyOrNull(userProduct, "EndDate", EndDate); } //Utility.AddIfNotEmptyOrNull(userProduct, "CATEGORIES", CategoryListString); Utility.AddIfNotEmptyOrNull(userProduct, "ShippingCosts", ShippingCosts); Utility.AddIfNotEmptyOrNull(userProduct, "Permissions", Permissions); Utility.AddIfNotEmptyOrNull(userProduct, "CPQProductId", CPQProductId); Utility.AddIfNotEmptyOrNull(userProduct, "UPC", UPC); Utility.AddIfNotEmptyOrNull(userProduct, "MPN", MPN); Utility.AddIfNotEmptyOrNull(userProduct, "ProductFamilyCode", ProductFamilyCode); Utility.AddIfNotEmptyOrNull(userProduct, "RecurringPriceFormula", RecurringPriceFormula); Utility.AddIfNotEmptyOrNull(userProduct, "RecurringCostFormula", RecurringCostFormula); Utility.AddIfNotEmptyOrNull(userProduct, "Inventory", Inventory); Utility.AddIfNotEmptyOrNull(userProduct, "LeadTime", LeadTime); Utility.AddIfNotEmptyOrNull(userProduct, "ProductVersion", ProductVersion); Utility.AddIfNotEmptyOrNull(userProduct, "ExternalId", ExternalId); Utility.AddIfNotEmptyOrNull(userProduct, "Active", Active); Utility.AddIfNotEmptyOrNull(userProduct, "IsSAPProduct", IsSAPProduct); Utility.AddIfNotEmptyOrNull(userProduct, "Weight", Weight); Utility.AddIfNotEmptyOrNull(userProduct, "Image", Image); Utility.AddIfNotEmptyOrNull(userProduct, "UserCanEnterQuantity", UserCanEnterQuantity); Utility.AddIfNotEmptyOrNull(userProduct, "UnitOfMeasure", UnitOfMeasure); Utility.AddIfNotEmptyOrNull(userProduct, "PricingMechanism", PricingMechanism); Utility.AddIfNotEmptyOrNull(userProduct, "PricingCode", PricingCode); Utility.AddIfNotEmptyOrNull(userProduct, "BaseRecurringPrice", BaseRecurringPrice); Utility.AddIfNotEmptyOrNull(userProduct, "Price", Price); Utility.AddIfNotEmptyOrNull(userProduct, "PriceFormula", PriceFormula); Utility.AddIfNotEmptyOrNull(userProduct, "CostFormula", CostFormula); Utility.AddIfNotEmptyOrNull(userProduct, "Description", Description); Utility.AddIfNotEmptyOrNull(userProduct, "LongDescription", LongDescription); Utility.AddIfNotEmptyOrNull(userProduct, "CartDescription", CartDescription); //The Attribute Input Parameters conflict with Input XML Examples. Some Parameters show up in Examples that are not part of the Input Parameters list. //see: http://help.webcomcpq.com/doku.php?id=appendixd:simple_product_administration:input_xml_example vs http://help.webcomcpq.com/doku.php?id=appendixd:simple_product_administration:product_admin_webmethod_inputxml if (AttributeName != null) { //<Attributes></Attributes> XmlNode userProductAttributes = retVal.CreateElement("Attributes"); userProduct.AppendChild(userProductAttributes); //<Attributes><Attribute></Attribute></Attributes> XmlNode userProductAttribute = retVal.CreateElement("Attribute"); userProductAttributes.AppendChild(userProductAttribute); AttributeName.AddToXML(userProductAttribute); XmlNode userProductAttributeValues = retVal.CreateElement("Values"); userProductAttribute.AppendChild(userProductAttributeValues); if (AttributeValue != null) { AttributeValue.AddToXML(userProductAttributeValues); } //Attributes is a parent container, nested within Products, that may contain additional child products; need to rethink this one: //XmlNode userAttributes = Utility.AddIfNotEmptyOrNull(userProducts, "Attributes", Attributes); ////Attribute Child nodes, still WIP://// Utility.AddIfNotEmptyOrNull(userProductAttributes, "Type", AttributeType); Utility.AddIfNotEmptyOrNull(userProductAttributes, "DisplayType", AttributeDisplayType); Utility.AddIfNotEmptyOrNull(userProductAttributes, "MeasurementType", AttributeMeasurementType); Utility.AddIfNotEmptyOrNull(userProductAttributes, "Rank", AttributeRank); Utility.AddIfNotEmptyOrNull(userProductAttributes, "LineItem", AttributeLineItem); Utility.AddIfNotEmptyOrNull(userProductAttributes, "LineItemDescription", AttributeLineItemDescription); Utility.AddIfNotEmptyOrNull(userProductAttributes, "RankWithinCart", AttributeRankWithinCart); Utility.AddIfNotEmptyOrNull(userProductAttributes, "SpansAcrossEntireRow", AttributeSpansAcrossEntireRow); Utility.AddIfNotEmptyOrNull(userProductAttributes, "Required", AttributeRequired); Utility.AddIfNotEmptyOrNull(userProductAttributes, "Label", AttributeLabel); Utility.AddIfNotEmptyOrNull(userProductAttributes, "Hint", AttributeHint); Utility.AddIfNotEmptyOrNull(userProductAttributes, "ShowOneTimePrice", AttributeShowOneTimePrice); Utility.AddIfNotEmptyOrNull(userProductAttributes, "ShowRecurringPrice", AttributeShowRecurringPrice); Utility.AddIfNotEmptyOrNull(userProductAttributes, "ButtonText", AttributeButtonText); Utility.AddIfNotEmptyOrNull(userProductAttributes, "AttachScriptButton", AttributeAttachScriptButton); Utility.AddIfNotEmptyOrNull(userProductAttributes, "ValuesPreselected", AttributeValuesPreselected); //Buttons is child of Attributes; Utility.AddIfNotEmptyOrNull(userProductAttributes, "ButtonScriptsAttached", AttributeButtonScriptsAttached); ////ButtonScriptsAttached Child Nodes, still WIP://// Utility.AddIfNotEmptyOrNull(userProductAttributes, "ButtonScript", AttributeButtonScript); Utility.AddIfNotEmptyOrNull(userProductAttributes, "ButtonScriptAttachedRank", ButtonScriptAttachedRank); } //tabs node is not allowed with Simple products; //Utility.AddIfNotEmptyOrNull(userProduct, "Tabs", Tabs); ////Tabs Child Nodes, still WIP://// Utility.AddIfNotEmptyOrNull(userProduct, "TabsSystemId", TabsSystemId); Utility.AddIfNotEmptyOrNull(userProduct, "TabsName", TabsName); Utility.AddIfNotEmptyOrNull(userProduct, "TabsProductTabRank", TabsProductTabRank); Utility.AddIfNotEmptyOrNull(userProduct, "TabsLayoutTemplate", TabsLayoutTemplate); Utility.AddIfNotEmptyOrNull(userProduct, "TabsVisibilityPermission", TabsVisibilityPermission); Utility.AddIfNotEmptyOrNull(userProduct, "TabsVisibilityCondition", TabsVisibilityCondition); Utility.AddIfNotEmptyOrNull(userProduct, "TabsShowTabHeader", TabsShowTabHeader); Utility.AddIfNotEmptyOrNull(userProduct, "TabsAttributes", TabsAttributes); Utility.AddIfNotEmptyOrNull(userProduct, "TabsAttributesName", TabsAttributesName); Utility.AddIfNotEmptyOrNull(userProduct, "TabsAttributesRank", TabsAttributesRank); //Utility.AddIfNotEmptyOrNull(userProduct, "GlobalScripts", GlobalScripts); ////GlobalScripts Child Nodes, still WIP://// Utility.AddIfNotEmptyOrNull(userProduct, "GlobalScriptsName", GlobalScriptsName); Utility.AddIfNotEmptyOrNull(userProduct, "GlobalScriptsRank", GlobalScriptsRank); Utility.AddIfNotEmptyOrNull(userProduct, "GlobalScriptsEvents", GlobalScriptsEvents); Utility.AddIfNotEmptyOrNull(userProduct, "GlobalScriptsEventsEvent", GlobalScriptsEventsEvent); return(retVal); }
public EditProductCommand(int supplierId, int productId, ProductCode productCode, ProductName productName, int?categoryId, decimal price) { SupplierId = supplierId; ProductId = productId; ProdCode = productCode; ProdName = productName; CategoryId = categoryId; Price = price; }
public Product(ProductName name, Upc upc, Price price) { _name = name; _upc = upc; _price = price; }
public override int GetHashCode() { return(ProductName.GetHashCode() * Number.GetHashCode()); }
public async Task Dispatch(CreateProductCommand productCommand, CancellationToken cancellationToken) { var id = new ProductId(productCommand.Id); var name = new ProductName(productCommand.Name); await productCreator.Execute(id, name).ConfigureAwait(false); }
/// <summary> /// Returns true if OrderLineDetails instances are equal /// </summary> /// <param name="other">Instance of OrderLineDetails to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrderLineDetails other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DiscountAmount == other.DiscountAmount || DiscountAmount != null && DiscountAmount.Equals(other.DiscountAmount) ) && ( GoogleProductCategoryId == other.GoogleProductCategoryId || GoogleProductCategoryId != null && GoogleProductCategoryId.Equals(other.GoogleProductCategoryId) ) && ( LineAmountTotal == other.LineAmountTotal || LineAmountTotal != null && LineAmountTotal.Equals(other.LineAmountTotal) ) && ( ProductCategory == other.ProductCategory || ProductCategory != null && ProductCategory.Equals(other.ProductCategory) ) && ( ProductCode == other.ProductCode || ProductCode != null && ProductCode.Equals(other.ProductCode) ) && ( ProductName == other.ProductName || ProductName != null && ProductName.Equals(other.ProductName) ) && ( ProductPrice == other.ProductPrice || ProductPrice != null && ProductPrice.Equals(other.ProductPrice) ) && ( ProductType == other.ProductType || ProductType != null && ProductType.Equals(other.ProductType) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( TaxAmount == other.TaxAmount || TaxAmount != null && TaxAmount.Equals(other.TaxAmount) ) && ( Unit == other.Unit || Unit != null && Unit.Equals(other.Unit) )); }
public static ProductImageName New(TemporaryImageName imageName, ProductName productName) => new ProductImageName(imageName.Number, imageName.Timestamp, productName.Slug);
public bool IsValid() { return(!ProductName.IsNullOrEmpty() && !Quantity.IsNullOrEmpty() && !Price.IsNullOrEmpty()); }
public override int GetHashCode() { return(ProductName != null?ProductName.GetHashCode() : 0); }
public override string ToString() { return($"{Slot.PadRight(1)} - {ProductName.PadRight(20)} - {Quantity.ToString().PadRight(8)} - {Price:C} "); }
public static ProductName CreateProductName(long productNameID, string name) { ProductName productName = new ProductName(); productName.ProductNameID = productNameID; productName.Name = name; return productName; }
public TrolleyQuantity(string name, int amount) { Name = new ProductName(name); Quantity = new Quantity(amount); }
private string GetGlobalIdentificationForThisProduct() { return(ProductName.Replace(" ", "-").ToLower()); }
public AddStock() { InitializeComponent(); this.PreviewKeyDown += new KeyEventHandler(HandleEsc); ProductName.Focus(); }
public async static Task <string> CreateProducts(ProductName productName, ModelCustomerProduct customerProduct) { try //ServicesCeltaWare.Tools.CommandWin32.WriteLog(err.Message); { string msgCreateSite = null; string directory = @"C:\Celta Business Solutions\" + customerProduct.Customer.RootDirectory + @"\" + customerProduct.InstallDirectory; DirectoryInfo dir = new DirectoryInfo(directory); switch (productName) { case ProductName.BSF: { if (!dir.Exists) { await ServicesCeltaWare.Tools.CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\BSF", dir.ToString(), true, true); } msgCreateSite = await ServicesCeltaWare.Tools.CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", // /physicalPath:" + "\"" + DefaultDir + " \"" + $" add app /site.name:{customerProduct.Customer.RootDirectory}-CeltaBS /path:/{customerProduct.InstallDirectory} /physicalPath:" + "\"" + dir + "\""); ChangeDefaultHtm(customerProduct.Customer.RootDirectory, customerProduct.Port, ServicesCeltaWare.Model.Enum.ProductName.BSF); break; } case ProductName.CCS: { if (!dir.Exists) { await ServicesCeltaWare.Tools.CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\CCS", dir.ToString(), true, true); } msgCreateSite = await ServicesCeltaWare.Tools.CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add app /site.name:{customerProduct.Customer.RootDirectory}-CeltaBS /path:/{customerProduct.InstallDirectory} /physicalPath:" + "\"" + dir + "\""); ChangeDefaultHtm(customerProduct.Customer.RootDirectory, customerProduct.Port, ProductName.CCS); break; } case ProductName.CSS: { if (!dir.Exists) { await ServicesCeltaWare.Tools.CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\CSS\WebService", dir.ToString(), true, true); } msgCreateSite = await ServicesCeltaWare.Tools.CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add app /site.name:{customerProduct.Customer.RootDirectory}-CeltaBS /path:/{ValidateNameForPathSite(customerProduct.InstallDirectory)} /physicalPath:" + "\"" + dir + " \""); break; } case ProductName.Concentrador: { break; } case ProductName.SynchronizerService: { break; } case ProductName.Database: { break; } case ProductName.CertificadoA1: { if (!dir.Exists) { dir.Create(); } await ServicesCeltaWare.Tools.CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\bsf\certificados", dir.ToString(), true, true); break; } default: break; } return(msgCreateSite); } catch (Exception err) { // error = err.Message; return(err.Message); } }
public static IProduct GetProduct(ProductName productName, double productCost) { return(new Product(productName, productCost)); }
public override string ToString() { return($"{Id}: {ProductName.PadRight(35)}Quantity: {Quanity}\tPrice: {PriceInDollars:C}\tTheme: {Theme}"); }
public async static Task <string> CreateProducts(ProductName productName, IApps _apps) { try { string msgCreateSite = null; string directory = @"C:\Celta Business Solutions\" + _apps.CustomerProduct.Customer.RootDirectory + @"\" + _apps.InstallDirectory; DirectoryInfo dir = new DirectoryInfo(directory); switch (productName) { case ProductName.BSF: { if (!dir.Exists) { CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\BSF", dir.ToString(), true, true); } msgCreateSite = await CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add app /site.name:{_apps.CustomerProduct.Customer.RootDirectory}-CeltaBS /path:/{_apps.InstallDirectory} /physicalPath:" + "\"" + dir + "\""); ChangeDefaultHtm(_apps.CustomerProduct.Customer.RootDirectory, _apps.Port, ServicesCeltaWare.Model.Enum.ProductName.BSF); break; } case ProductName.CCS: { if (!dir.Exists) { CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\CCS", dir.ToString(), true, true); } msgCreateSite = await CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add app /site.name:{_apps.CustomerProduct.Customer.RootDirectory}-CeltaBS /path:/{_apps.InstallDirectory} /physicalPath:" + "\"" + dir + "\""); ChangeDefaultHtm(_apps.CustomerProduct.Customer.RootDirectory, _apps.Port, ProductName.CCS); break; } case ProductName.CSS: { if (!dir.Exists) { CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\CSS\WebService", dir.ToString(), true, true); } msgCreateSite = await CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add app /site.name:{_apps.CustomerProduct.Customer.RootDirectory}-CeltaBS /path:/{ValidateNameForPathSite(_apps.InstallDirectory)} /physicalPath:" + "\"" + dir + " \""); break; } case ProductName.Concentrador: { try { if (!dir.Exists) { CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\Concentrador", dir.ToString(), true, true); } msgCreateSite = await CommandWin32.Execute(@"C:\Windows\System32\inetsrv\", "appcmd.exe", $" add site /name:{_apps.CustomerProduct.Customer.RootDirectory}-Concentrador /physicalPath:" + "\"" + @"C:\Celta Business Solutions\" + _apps.CustomerProduct.Customer.RootDirectory + "\"" + $" /bindings:http/*:{_apps.Port}:"); string messagePool = await CreatePool(_apps.CustomerProduct.Customer, ProductName.Concentrador); string messageChangePool = await ChangePool(_apps.CustomerProduct.Customer, ProductName.Concentrador); break; } catch (Exception err) { msgCreateSite = err.Message; break; } } case ProductName.SynchronizerService: { try { if (!dir.Exists) { CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\CSS\WindowsService", dir.ToString(), true, true); } msgCreateSite = await CommandWin32.Execute(dir.ToString(), @"\InstallUtil.exe ", _apps.CustomerProduct.Customer.RootDirectory); break; } catch (Exception err) { msgCreateSite = err.Message; break; } } case ProductName.Database: { break; } case ProductName.CertificadoA1: { if (!dir.Exists) { dir.Create(); } CommandWin32.Copy(@"c:\Celta Business Solutions\Empty\bsf\certificados", dir.ToString(), true, true); break; } default: break; } return(msgCreateSite); } catch (Exception err) { return(err.Message); } }
public override int GetHashCode() { return(ProductName.GetHashCode() ^ Price.GetHashCode()); }
public void RefreshGridViewProductNames() { ProductName entity = new ProductName(); SearchParam searchParam = new SearchParam(); searchParam.Start = DEFAULT_START; searchParam.Limit = DEFAULT_LIMIT; searchParam.SortBy = DEFAULT_SORT_BY; searchParam.SortDir = DEFAULT_SORT_DIR; this.BindingDataToFormProductName(entity, searchParam, 0); bindingNavigatorProductName.BindingSource.PositionChanged += new EventHandler(BindingSource_PositionChanged); }
public override Core.OrderManagement.Products.Events.ProductCreated ConvertToIntern(ProductCreated e) { return(new Core.OrderManagement.Products.Events.ProductCreated( ProductIdentifier.Parse(e.ProductIdentifier), ProductName.Create(e.ProductName))); }
/* private string DieuKienTimKiem() { string dk = ""; if (chkTatCaTimKiemQuanLy.Checked) dk = " where SanPham.MaSanPham like '%" + textBoxSearch.Text + "%' or SanPham.TenSanPham like N'%" + textBoxSearch.Text + "%' or LoaiSanPham.LoaiSanPham like N'%" + textBoxSearch.Text + "%' or DonVi.DonVi like N'%" + textBoxSearch.Text + "%' or QuocGia.QuocGia like N'%" + textBoxSearch.Text + "%' or NhaSanXuat.TenNhaSanXuat like N'%" + textBoxSearch.Text + "%' or NhaCungCap.NhaCungCap like N'%" + textBoxSearch.Text + "%' or SanPham.MoTa like N'%" + textBoxSearch.Text + "%'"; else { if (chkMaSanPhamTimKiemQuanLy.Checked) dk += " or SanPham.MaSanPham like '%" + textBoxSearch.Text+"%'"; if (chkTenSanPhamTimKiemQuanLy.Checked) dk += " or SanPham.TenSanPham like N'%" + textBoxSearch.Text+"%'"; if (chkLoaiSanPhamTimKiemQuanLy.Checked) dk += " or LoaiSanPham.LoaiSanPham like N'%" + textBoxSearch.Text+"%'"; if (chkDonViTimKiemQuanLy.Checked) dk += " or DonVi.DonVi like N'%" + textBoxSearch.Text + "%'"; if (chkNguonGocTimKiemQuanLy.Checked) dk += " or QuocGia.QuocGia like N'%"+ textBoxSearch.Text+"%'"; if (chkNhaSanXuatTimKiemQuanLy.Checked) dk += "or NhaSanXuat.TenNhaSanXuat like N'%" + textBoxSearch.Text + "%'"; if (chkNhaCungCapTimKiemQuanLy.Checked) dk += " or NhaCungCap.NhaCungCap like N'%" + textBoxSearch.Text + "%'"; if (chkMoTaTimKiemQuanLy.Checked) dk += " or SanPham.MoTa like N'%" + textBoxSearch.Text+"%'"; if (dk.Trim().Length > 0) dk = " where "+dk.Substring(4); } return dk; } */ private void frmDanhMucSanPham_Load(object sender, EventArgs e) { this.Location = new Point((this.MdiParent.ClientSize.Width-this.Width)/2,(this.MdiParent.ClientSize.Height-this.Height)/2-50); try { //Create column of gridview ContructGridViewColumn(); //Get all product searchParam = new SearchParam(); searchParam.Start = DEFAULT_START; searchParam.Limit = DEFAULT_LIMIT; searchParam.SortBy = DEFAULT_SORT_BY; searchParam.SortDir = DEFAULT_SORT_DIR; searchParamProductName = new SearchParam(); searchParamProductName.Start = DEFAULT_START; searchParamProductName.Limit = DEFAULT_LIMIT; searchParamProductName.SortBy = DEFAULT_SORT_BY; searchParamProductName.SortDir = DEFAULT_SORT_DIR; searchEntity = new Product(); searchEntityProductName = new ProductName(); SearchResult<Product> searchResult = productManager.GetProductListByParam(searchEntity, searchParam); SearchResult<ProductName> searchResultProductName = productNameManager.GetProductNameListByParam(searchEntityProductName, searchParamProductName); currentListProduct = searchResult.SearchList; currentListProductName = searchResultProductName.SearchList; //Binding list product to gridview IList2DataTable(currentListProduct, dataSetProduct.Tables["Product"]); IList2DataTableProductName(currentListProductName, dataSetProductName.Tables["ProductName"]); listPages = new List<Int32>(); listPagesProductName = new List<Int32>(); BindingDataToBindingNagivator(searchResult.SearchSize, 0); BindingDataToBindingNagivatorProductName(searchResultProductName.SearchSize, 0); //Binding value for combobox //comboBoxTenSanPham.DataSource = productNameManager.GetAll(); //comboBoxTenSanPham.DisplayMember = "ProdName"; //comboBoxTenSanPham.ValueMember = "ID"; comboBoxLoaiSanPham.DataSource = categoryManager.GetAll(); comboBoxLoaiSanPham.DisplayMember = "CategoryName"; comboBoxLoaiSanPham.ValueMember = "ID"; comboBoxNhasx.DataSource = manufacturerManager.GetAll(); comboBoxNhasx.DisplayMember = "ManName"; comboBoxNhasx.ValueMember = "ID"; cboTenSanPham.DataSource = productNameManager.GetAll(); cboTenSanPham.DisplayMember = "ProdName"; cboTenSanPham.ValueMember = "ID"; cboLoaiSanPham.DataSource = categoryManager.GetAll(); cboLoaiSanPham.DisplayMember = "CategoryName"; cboLoaiSanPham.ValueMember = "ID"; cboNguonGoc.DataSource = countryManager.GetAll(); cboNguonGoc.DisplayMember = "CountryName"; cboNguonGoc.ValueMember = "ID"; cboNhaSanXuat.DataSource = manufacturerManager.GetAll(); cboNhaSanXuat.DisplayMember = "ManName"; cboNhaSanXuat.ValueMember = "ID"; cboDonVi.DataSource = unitManager.GetAll(); cboDonVi.DisplayMember = "UnitName"; cboDonVi.ValueMember = "ID"; cboTrangThai.DataSource = productStatusManager.GetAll(); cboTrangThai.DisplayMember = "StatusName"; cboTrangThai.ValueMember = "ID"; ResetFormProductName(); SetFormProductNameReadOnly(true); SetFormProductReadOnly(true); //int khoa = Int32.Parse(cboTenSanPham.SelectedValue.ToString()); //ProductName productName = productNameManager.GetById(khoa, true); //cboLoaiSanPham.SelectedValue = productName.CategoryIdLookup.ID; //cboNhaSanXuat.SelectedValue = productName.ManIdLookup.ID; //Manufacturer man = manufacturerManager.GetById(productName.ManIdLookup.ID, true); //cboNguonGoc.SelectedValue = man.CountryIdLookup.ID; //xoaTrang(); //Display all column in gridview DisplayAll(); //BindingProductToForm(0); //updateProductId = (Int64)gvSanPhamDanhMuc.Rows[0].Cells["ProductId"].Value; //BindingProductNameToForm(0); //updateProductNameId = (Int32)gvTenSanPham.Rows[0].Cells["ProductNameId"].Value; } catch (Exception ex) { logger.Debug(ex.Message); logger.Debug(ex.StackTrace); MessageBox.Show(ex.StackTrace); } }
/// <inheritdoc /> public override string ToString() { return(string.Format(CultureInfo.InvariantCulture, "{0} ({1}VID {2:X4}, PID {3:X4}, version {4})", Manufacturer.Length > 0 || ProductName.Length > 0 ? Manufacturer.Trim() + " " + ProductName.Trim() : "(unnamed)", SerialNumber.Length > 0 ? "serial " + SerialNumber.Trim() + ", " : "", VendorID, ProductID, ProductVersion)); }
private void RefreshGridViewProductName(ProductName searchEntity) { //Get all user searchParam = new SearchParam(); searchParam.Start = DEFAULT_START; searchParam.Limit = DEFAULT_LIMIT; searchParam.SortBy = DEFAULT_SORT_BY; searchParam.SortDir = DEFAULT_SORT_DIR; // this.searchEntityProductName = searchEntity; // SearchResult<ProductName> searchResult = productNameManager.GetProductNameListByParam(searchEntity, searchParam); currentListProductName = searchResult.SearchList; //Binding list userrole to gridview IList2DataTableProductName(searchResult.SearchList, dataSetProductName.Tables["ProductName"]); //Binding list to navigator listPagesProductName = new List<Int32>(); BindingDataToBindingNagivatorProductName(searchResult.SearchSize, 0); }
// override object.GetHashCode public override int GetHashCode() { return(ProductName.GetHashCode() + ItemId.GetHashCode()); }
private void BindingDataToFormProductName(ProductName entity, SearchParam searchParam, int position) { SearchResult<ProductName> searchResult = productNameManager.GetProductNameListByParam(entity, searchParam); if (searchResult != null) { DataTable dataTableProductName = new DataTable("ProductName"); dataTableProductName.Columns.Add("ProductNameId", typeof(Int32)); dataTableProductName.Columns.Add("ProdName", typeof(string)); dataTableProductName.Columns.Add("CategoryId", typeof(int)); dataTableProductName.Columns.Add("CategoryName", typeof(string)); dataTableProductName.Columns.Add("ManId", typeof(int)); dataTableProductName.Columns.Add("ManName", typeof(string)); foreach (ProductName objProduct in searchResult.SearchList) { DataRow rowTemp = dataTableProductName.NewRow(); rowTemp["ProductNameId"] = objProduct.ID; rowTemp["ProdName"] = objProduct.ProdName; rowTemp["CategoryId"] = objProduct.CategoryId; if (objProduct.CategoryIdLookup != null) { rowTemp["CategoryName"] = objProduct.CategoryIdLookup.CategoryName; } else { Category temp = categoryManager.GetById(objProduct.CategoryId, false); if (temp != null) { rowTemp["CategoryName"] = temp.CategoryName; } else { rowTemp["CategoryName"] = string.Empty; } } rowTemp["ManId"] = objProduct.ManId; if (objProduct.ManIdLookup != null) { rowTemp["ManName"] = objProduct.ManIdLookup.ManName; } else { Manufacturer temp = manufacturerManager.GetById(objProduct.ManId, false); if (temp != null) { rowTemp["ManName"] = temp.ManName; } else { rowTemp["ManName"] = string.Empty; } } dataTableProductName.Rows.Add(rowTemp); } dataSetProductName = new DataSet(); dataSetProductName.Tables.Add(dataTableProductName); gvTenSanPham.DataSource = dataSetProductName; gvTenSanPham.DataSource = dataSetProductName; gvTenSanPham.DataMember = "ProductName"; gvTenSanPham.Columns["ProductNameId"].HeaderText = "Mã tên sản phẩm"; gvTenSanPham.Columns["ProdName"].HeaderText = "Tên sản phẩm"; gvTenSanPham.Columns["CategoryId"].Visible = false; gvTenSanPham.Columns["CategoryName"].HeaderText = "Loại sản phẩm"; gvTenSanPham.Columns["ManId"].Visible = false; gvTenSanPham.Columns["ManName"].HeaderText = "Nhà sản xuất"; currentListProductName = searchResult.SearchList; logger.Debug("searchList size = " + searchResult.SearchList.Count); List<Int32> listPages = new List<Int32>(); int totalPage = 0; if (searchResult.SearchSize % DEFAULT_LIMIT > 0) { totalPage = (int)searchResult.SearchSize / DEFAULT_LIMIT + 1; } else { totalPage = (int)searchResult.SearchSize / DEFAULT_LIMIT; } logger.Debug("searchSize = " + searchResult.SearchSize); logger.Debug("totalPage = " + totalPage); for (int i = 0; i < totalPage; i++) { listPages.Add(i); } bindingNavigatorProductName.BindingSource = new BindingSource(listPages, ""); bindingNavigatorProductName.BindingSource.Position = position; bindingNavigatorProductName.BindingSource.PositionChanged += new EventHandler(BindingSource_PositionChangedProductName); toolStripLblTotal.Text = "Tổng số tên sản phẩm: " + searchResult.SearchSize; } }
private void eliminarToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dgvDepartamento.CurrentRow != null) { int Id = int.Parse(dgvDepartamento.CurrentRow.Cells[0].Value.ToString()); if (MessageBox.Show("Desea eliminar el depatartamento", ProductName.ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.departamentoTableAdapter.Delete(Id); MessageBox.Show("Se ha eliminado correctamente el departamento", ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information); this.departamentoTableAdapter.Fill(dsCatalagos.Departamento); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnTaiLaiQuanLySanPham_Click(object sender, EventArgs e) { searchEntityProductName = new ProductName(); SearchResult<ProductName> searchResult = productNameManager.GetProductNameListByParam(searchEntityProductName, searchParamProductName); currentListProductName = searchResult.SearchList; //Binding list product name to gridview dataSetProductName.Clear(); IList2DataTableProductName(currentListProductName, dataSetProductName.Tables["ProductName"]); listPagesProductName = new List<Int32>(); BindingDataToBindingNagivatorProductName(searchResult.SearchSize, 0); }
private void btnThemQuanLySanPham_Click(object sender, EventArgs e) { // validate if (txtTenSp.Text.Length == 0) { HoTro.baoLoi("Nhập tên sản phẩm"); return; } if (!HoTro.IsWholeNumber(txtGiaban.Text)) { HoTro.baoLoi("Giá bán nhập không đúng"); return; } try { if (txtGiamGia.Text.Length != 0) Int32.Parse(txtGiamGia.Text); } catch (Exception ex) { HoTro.baoLoi("Giảm giá nhập không đúng"); return; } try { ProductName productNameEntity; if (MODE == Constants.MODE.ADD) { productNameEntity = new ProductName(); } else if (MODE == Constants.MODE.UPDATE) { int idxInList = -1; foreach (ProductName objProductName in currentListProductName) { if (objProductName.ID == updateProductNameId) { idxInList = currentListProductName.IndexOf(objProductName); } } productNameEntity = currentListProductName[idxInList]; } else { productNameEntity = new ProductName(); } string tenSp = txtTenSp.Text; int loaiSp = (int)comboBoxLoaiSanPham.SelectedValue; int nhasx = (int)comboBoxNhasx.SelectedValue; string giaban = txtGiaban.Text; //if (strPassword != strPasswordConfirm) //{ // MessageBox.Show("Mật khẩu không trùng nhau. Vui lòng nhập lại", Constants.INFO, MessageBoxButtons.OK, MessageBoxIcon.Information); //} productNameEntity.ProdName = tenSp; productNameEntity.CategoryId = loaiSp; productNameEntity.ManId = nhasx; //Do save new entity productNameManager.SaveOrUpdate(productNameEntity); //Show message success if (MODE == Constants.MODE.ADD) { MessageBox.Show("Tạo mới tên sản phẩm [" + productNameEntity.ID + " ] thành công", Constants.INFO, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MODE == Constants.MODE.UPDATE) { ht = new HoTro(); int maTenSP = productNameEntity.ID; if (txtGiaban.Text.Length != 0) { SqlCommand command = new SqlCommand("update Product set salePrice= @Giaban where ProductNameId=@ProductNameId"); command.Parameters.Add("@ProductNameId", maTenSP); command.Parameters.Add("@Giaban", giaban); ht.CapNhatDuLieu(command); } if (txtGiamGia.Text.Length != 0) { SqlCommand command = new SqlCommand("update Product set discount= @GiamGia where ProductNameId=@ProductNameId"); command.Parameters.Add("@ProductNameId", maTenSP); command.Parameters.Add("@GiamGia", Int32.Parse(txtGiamGia.Text)); ht.CapNhatDuLieu(command); } MessageBox.Show("Cập nhật tên sản phẩm [" + productNameEntity.ID + " ] thành công", Constants.INFO, MessageBoxButtons.OK, MessageBoxIcon.Information); MODE = Constants.MODE.ADD; btnProductNameSave.Text = "&Thêm mới"; this.ResetForm(); } //Refresh grid view after insert successfully this.RefreshGridViewProductNames(); } catch (Exception ex) { logger.Debug(ex.Message); logger.Debug(ex.StackTrace); MessageBox.Show(ex.StackTrace); MessageBox.Show(ex.Message); } }
private void btnTimKiemTenSanPham_Click(object sender, EventArgs e) { string strSearch = txtProductNameSearch.Text.Trim(); if (chkSearchMaTenSanPham.Checked) { int idSearch = 0; if (Int32.TryParse(strSearch, out idSearch)) { searchEntityProductName = new ProductName(idSearch); } else { searchEntityProductName = new ProductName(-1); } } else { searchEntityProductName = new ProductName(); } if (chkSearchTenSanPham.Checked) { searchEntityProductName.ProdName = strSearch; } RefreshGridViewProductName(searchEntityProductName); }
public override int GetHashCode() { return(ProductName.GetHashCode() + Quantity.GetHashCode() + Price.GetHashCode()); }
public void AddToProductNames(ProductName productName) { base.AddObject("ProductNames", productName); }