コード例 #1
0
 public NewSupplierOrder(GetProductClassListDelegate getProductClassListDelegate, GetSuppliersListDelegate getSuppliersListDelegate)
 {
     productsMetaData = getProductClassListDelegate();
     suppliersList    = getSuppliersListDelegate();
     InitializeComponent();
     ProductsNameList = getProductsNames();
 }
コード例 #2
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     if (SuppliersList.SelectedItem != null)
     {
         deleteSupplier(SuppliersList.GetItemText(SuppliersList.SelectedItem));
         SuppliersList.Items.Remove(SuppliersList.SelectedItem);
         clearFields();
     }
 }
コード例 #3
0
        public async Task LoadSuppliersList()
        {
            var col = await _supplierLookupDataService.GetSupplierLookupAsync();

            SuppliersList.Clear();
            foreach (var item in col)
            {
                SuppliersList.Add(item);
            }
        }
コード例 #4
0
        public void UpdateList()
        {
            List <Supplier> suppliersList = SuppliersController.GetInstance().GetSuppliers();

            suppliersList.Sort((x, y) => x.Name.CompareTo(y.Name));
            suppliers = new ObservableCollection <Supplier>(suppliersList);

            SuppliersList.ItemsSource = suppliers;
            SuppliersList.Items.Refresh();
            SuppliersList.UpdateLayout();
        }
コード例 #5
0
        private void SuppliersList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var supplierName = SuppliersList.GetItemText(SuppliersList.SelectedItem);

            using (var dbCtx = new POSApplication.Model.posdbEntities())
            {
                var item = dbCtx.suppliers.SingleOrDefault(x => x.SupplierName == supplierName);
                if (item != null)
                {
                    SupplierContactLabel.Text = item.ContactNumber;
                }
            }
        }
コード例 #6
0
        private void DefaultParametrs(SupplierOrderEF supplierOrder = null, bool refresh = false)
        {
            IsDropDown = false;

            if (!refresh)
            {
                SuppliersListStorage = dataManager.GetSuppliersWithContract();  //DataBaseClient.GetSuppliersWithContract();
                SuppliersList        = SuppliersListStorage;

                BrokersList = DataBaseClient.ReadBrokers();
            }

            if (supplierOrder == null)
            {
                SupplierOrder           = new SupplierOrderEF();
                SupplierOrder.auctionid = auctionId;
                SupplierOrder.date      = DateTime.Now;
                UpdateLotsList();
            }
            else
            {
                try
                {
                    /*if(SupplierOrder.auction.siteid == 4) {
                     *  RequestDocsList = new ObservableCollection<string>();
                     *  RequestDocsList.Add("Документы (лицензия, патент, свидетельство) и (или) документы, подтверждающие право потенциального поставщика на производство, переработку, поставку и реализацию закупаемых товаров или письма об отсутствии необходимости наличия документов, подтверждающих право потенциального поставщика на производство, переработку, поставку и реализацию закупаемых товаров.");
                     *  RequestDocsList.Add("Сертификат представителя завода производителя либо Сертификат CТ-KZ, Сертификаты, в случае, если предмет закупа подлежит обязательной сертификации на соответствие требованиям стандарта или иного нормативного документа в соответствии с законодательством Республики Казахстан о сертификации.");
                     *  RequestDocsList.Add("Завод-производитель.");
                     *  RequestDocsList.Add("Официальный представитель завода-производителя.");
                     *  RequestDocsList.Add("Завод-производитель. Официальный представитель завода-производителя.");
                     *  RequestDocsList.Add("Дилер.");
                     *
                     *  DocsList = new ObservableCollection<RequestedDocEF>(DataBaseClient.ReadRequestedDocs(SupplierOrder.id));
                     *  RequestedListVis = System.Windows.Visibility.Visible;
                     * } else {
                     *  RequestedListVis = System.Windows.Visibility.Hidden;
                     * }*/

                    UpdateLotsList(false);

                    SelectedSupplier = SuppliersList.FirstOrDefault(x => x.companyId == supplierOrder.supplier.companyid);
                    SearchTxt        = SelectedSupplier.companyName;
                    if (supplierOrder.contract != null)
                    {
                        SelectedBroker = BrokersList.FirstOrDefault(x => x.id == supplierOrder.contract.brokerid);
                    }
                }
                catch (Exception) { }
            }
        }
コード例 #7
0
        private void SuppliersList_DoubleClick(object sender, EventArgs e)
        {
            string supplierName = SuppliersList.GetItemText(SuppliersList.SelectedItem);

            using (var dbCtx = new POSApplication.Model.posdbEntities())
            {
                var item = dbCtx.suppliers.First(x => x.SupplierName == supplierName);
                if (item != null)
                {
                    SupplierNameField.Text        = item.SupplierName;
                    ContactPersonNameField.Text   = item.ContactName;
                    ContactPersonNumberField.Text = item.ContactNumber;
                    SupplierAddressField.Text     = item.SupplierAddress;
                    //setting global field
                    selectedSupplierName = item.SupplierName;
                }
            }
        }
コード例 #8
0
        public static SuppliersList Parse(XmlNodeList suppliersNodeList, InitDataLoad initdataLoad)
        {
            ProductClassList productsList  = initdataLoad.MetaData.ProductsMetaData;
            SuppliersList    suppliersList = new SuppliersList();

            foreach (XmlNode supplierNode in suppliersNodeList)
            {
                Supplier supplier = new Supplier();

                foreach (XmlNode supplierParameter in supplierNode)
                {
                    XMLSuppliersListFields XMLSuppliersListField = (XMLSuppliersListFields)Enum.Parse(typeof(XMLSuppliersListFields), supplierParameter.Name, true);

                    switch (XMLSuppliersListField)
                    {
                    case XMLSuppliersListFields.SupplierID:
                        supplier.ID = supplierParameter.InnerText;
                        break;

                    case XMLSuppliersListFields.SupplierName:
                        supplier.Name = supplierParameter.InnerText;
                        break;

                    case XMLSuppliersListFields.SupplierReliability:
                        supplier.Reliability = double.Parse(supplierParameter.InnerText);
                        break;

                    case XMLSuppliersListFields.SupplierPriceMatrix:
                        supplier.PriceMatrix = getSupplierPriceMatrix(supplierParameter, productsList);
                        break;

                    default:
                        break;
                    }
                }
                suppliersList.AddSupplier(supplier);
            }
            return(suppliersList);
        }
コード例 #9
0
 public SuppliersFilterModel(SuppliersList suppliersList)
 {
     _supplierList = suppliersList;
 }
コード例 #10
0
        public int SaveProduct()
        {
            using (var db = new POSApplication.Model.posdbEntities())
            {
                string selectedCategory = CategoryList.GetItemText(CategoryList.SelectedItem);
                string selectedSupplier = SuppliersList.GetItemText(SuppliersList.SelectedItem);

                string path      = System.Reflection.Assembly.GetExecutingAssembly().Location;
                var    directory = System.IO.Path.GetDirectoryName(path);

                if (selectedCategory.Length > 0)
                {
                    var query = (from d in db.categories
                                 where d.CategoryName == selectedCategory
                                 select new { CategoryID = d.CategoryID }).SingleOrDefault();

                    var supp = (from d in db.suppliers
                                where d.SupplierName == selectedSupplier
                                select new { SupplierID = d.SupplierID }).SingleOrDefault();

                    if (ProductNameField.Text.Length > 0)
                    {
                        if (selectedProductName == null)
                        {
                            Model.product p = new Model.product();

                            p.ProductName        = ProductNameField.Text;
                            p.ProductDescription = ProductDescriptionField.Text;
                            p.CategoryID         = query.CategoryID;
                            if (supp != null)
                            {
                                p.SupplierID = supp.SupplierID;
                            }
                            else
                            {
                                p.SupplierID = 0;
                            }
                            p.ImageFileName        = Path.GetFileName(filename);
                            p.Barcode              = ProductBarcodeField.Text;
                            p.WarrantyPeriodYears  = WarrantyField.Text;
                            p.GuaranteePeriodYears = GuaranteeField.Text;
                            p.ProductCode          = ProductCodeField.Text;
                            p.ProductSize          = SizeField.Text;
                            p.ProductWeight        = WeightField.Text;
                            p.ProductColor         = ColorField.Text;
                            p.ProductWidth         = WidthField.Text;
                            p.ProductHeight        = HeightField.Text;

                            db.products.Add(p);
                            db.SaveChanges();

                            //adding the same product in inventory with sum quantity 0
                            ///////////////////////////////////////////////////////////////////////////
                            var existprd = (from ep in db.products
                                            where
                                            ep.ProductName == p.ProductName &&
                                            ep.CategoryID == p.CategoryID &&
                                            ep.ProductCode == p.ProductCode
                                            select new { ProductID = ep.ProductID }
                                            ).SingleOrDefault();

                            if (existprd != null)
                            {
                                POSApplication.Model.inventory inv = new POSApplication.Model.inventory();
                                inv.ProductID     = existprd.ProductID;
                                inv.Quantity      = 0;
                                inv.PackingTypeID = 0;
                                inv.PurchasePrice = 0;
                                inv.SalePrice     = 0;
                                inv.PurchaseDate  = null;
                                inv.SaleDate      = null;
                                inv.CreateDt      = DateTime.Now;
                                inv.UpdateDt      = null;
                                inv.SumQuantity   = 0;
                                db.inventories.Add(inv);
                                db.SaveChanges();
                            }

                            ///////////////////////////////////////////////////////////////////////////

                            if (filename != null)
                            {
                                string destfile        = System.IO.Path.Combine(path + "\\images", filename);
                                string ImagesDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images");
                                destfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\" + Path.GetFileName(filename));
                                //MessageBox.Show(destfile);
                                var dir = new System.IO.DirectoryInfo(ImagesDirectory);
                                //foreach (var file in dir.EnumerateFiles(Path.GetFileNameWithoutExtension(filename)))
                                //{
                                //    file.Delete();
                                //}
                                try
                                {
                                    //File.Copy(filename.Replace("\\\\","\\"), destfile, true);
                                    File.Copy(filename, destfile, true);
                                }
                                catch (Exception e)
                                {
                                    MessageBox.Show(e.ToString());
                                }

                                //Model.AppConfig.imagefile = destfile;
                                //FileStream fs = new FileStream(Model.AppConfig.imagefile, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                                //ProductImage.Image = Image.FromStream(fs);
                                //fs.Close();
                            }
                            MessageBox.Show("New Product '" + ProductNameField.Text + "' has been added in the system.");
                            clearFields();
                            loadCategories();
                            return(1);
                        }
                        else
                        {
                            Model.product p = (from x in db.products
                                               where x.ProductName == selectedProductName
                                               select x).First();

                            p.ProductName        = ProductNameField.Text;
                            p.ProductDescription = ProductDescriptionField.Text;
                            p.CategoryID         = query.CategoryID;
                            if (supp != null)
                            {
                                p.SupplierID = supp.SupplierID;
                            }
                            else
                            {
                                p.SupplierID = 0;
                            }
                            if (ProductImage.Image != null)
                            {
                                p.ImageFileName = Path.GetFileName(filename);
                            }
                            else
                            {
                                p.ImageFileName = null;
                            }
                            p.Barcode              = ProductBarcodeField.Text;
                            p.WarrantyPeriodYears  = WarrantyField.Text;
                            p.GuaranteePeriodYears = GuaranteeField.Text;
                            p.ProductCode          = ProductCodeField.Text;
                            p.ProductSize          = SizeField.Text;
                            p.ProductWeight        = WeightField.Text;
                            p.ProductColor         = ColorField.Text;
                            p.ProductWidth         = WidthField.Text;
                            p.ProductHeight        = HeightField.Text;

                            db.SaveChanges();

                            if (filename != null)
                            {
                                string destfile        = System.IO.Path.Combine(path + "\\images", filename);
                                string ImagesDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images");
                                destfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\" + Path.GetFileName(filename));
                                //MessageBox.Show(destfile);
                                var dir = new System.IO.DirectoryInfo(ImagesDirectory);
                                //foreach (var file in dir.EnumerateFiles(Path.GetFileNameWithoutExtension(filename)))
                                //{
                                //    file.Delete();
                                //}
                                try
                                {
                                    //File.Copy(filename.Replace("\\\\","\\"), destfile, true);
                                    File.Copy(filename, destfile, true);
                                }
                                catch (Exception e)
                                {
                                    MessageBox.Show(e.ToString());
                                }
                                //Model.AppConfig.imagefile = destfile;
                                //FileStream fs = new FileStream(Model.AppConfig.imagefile, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                                //ProductImage.Image = Image.FromStream(fs);
                                //fs.Close();
                                //return 1;
                            }
                            else
                            {
                            }

                            MessageBox.Show("Product '" + selectedProductName + "' has been updated.");
                            clearFields();
                            return(1);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Enter name for the new Product.");
                        return(0);
                    }
                }
                else
                {
                    MessageBox.Show("Select a Category for the new Product.");
                    return(0);
                }
            }
        }
コード例 #11
0
ファイル: OrderParser.cs プロジェクト: eddiyur/FinalProject
        public static OrdersList Parse(XmlNodeList OrderNodeList, InitDataLoad initDataLoad, Order.OrderTypeEnum orderType)
        {
            ProductClassList productsList      = initDataLoad.MetaData.ProductsMetaData;
            SuppliersList    SuppliersMetaData = initDataLoad.MetaData.SuppliersMetaData;
            OrdersList       orderList         = new OrdersList();

            foreach (XmlNode customerOrderNode in OrderNodeList)//orders level
            {
                Order    order    = new Order(orderType);
                Customer customer = new Customer();

                foreach (XmlNode orderParameter in customerOrderNode)//order parts level
                {
                    XMLOrderFields XMLcustomerOrderField = (XMLOrderFields)Enum.Parse(typeof(XMLOrderFields), orderParameter.Name, true);

                    switch (XMLcustomerOrderField)
                    {
                    case XMLOrderFields.PersonName:
                        customer.Name = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.PersonID:
                        customer.ID = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.OrderID:
                        order.OrderID = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.OrderDate:
                        order.OrderDate = DateTime.Parse(orderParameter.InnerText);
                        break;

                    case XMLOrderFields.OrderDeliveryDate:
                        order.OrderDeliveryDate = DateTime.Parse(orderParameter.InnerText);
                        break;

                    case XMLOrderFields.Order_Status:
                        order.OrderStatus = (Order.OrderStatusEnum)Enum.Parse(typeof(Order.OrderStatusEnum), orderParameter.InnerText, true);
                        break;

                    case XMLOrderFields.OrderProductsList:
                        order.OrderProductsList = getOrderProductsList(orderParameter, productsList);
                        break;

                    default:
                        break;
                    } //end switch
                }     // end order parts level
                if (orderType == Order.OrderTypeEnum.CustomerOrder)
                {
                    order.Person = customer;
                }
                else
                {
                    order.Person = SuppliersMetaData.GetSupplier(customer.ID);
                }

                orderList.AddOrder(order);
            }//end orders level



            return(orderList);
        }