コード例 #1
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            ManufacturerPart manufacturerPart_value = new ManufacturerPart();

            manufacturerPart_value.ItemNumber   = tbItemNumber.Text;
            manufacturerPart_value.Name         = tbName.Text;
            manufacturerPart_value.Description  = tbdescription.Text;
            manufacturerPart_value.Manufacturer = tbManufacturer.Text;

            importer.Test_CreateManufacturerPart(manufacturerPart_value);
        }
コード例 #2
0
        public void AnalyzeLine(string[] values)
        {
            try
            {
                string PartDescription  = values[partDescriptionPos];
                string ManufacturerName = values[manufacturerPos];
                string ParentPart       = values[ParentPartPos];

                int PartCountInParent = 0;
                if (values[PartCountInParentPos].Length > 0)
                {
                    Convert.ToInt32(values[PartCountInParentPos]);
                }

                if (!ManufacturerExists(ManufacturerName) && ManufacturerName.Length > 0)
                {
                    Log.Write("add new manufacturer " + ManufacturerName);
                    Manufacturer newManufacturer = new Manufacturer();
                    newManufacturer.Name  = ManufacturerName;
                    newManufacturer.State = "released";

                    Manufacturers.Add(newManufacturer);
                }

                string ManufacturerPart = values[manufacturerPartPos];
                if (!ManufacturerPartExists(ManufacturerPart) && ManufacturerPart.Length > 0)
                {
                    Log.Write("add new manufacturer part " + ManufacturerPart);
                    ManufacturerPart newManufacturerPart = new ManufacturerPart();
                    newManufacturerPart.ItemNumber   = ManufacturerPart;
                    newManufacturerPart.Name         = PartDescription.Split('/')[0];
                    newManufacturerPart.Manufacturer = ManufacturerName;
                    newManufacturerPart.Description  = PartDescription;
                    newManufacturerPart.State        = values[StatePos];

                    ManufacturerParts.Add(newManufacturerPart);
                }


                string PartNumber = values[PartNumberPos];
                if (!PartExists(PartNumber) && PartNumber.Length > 0)
                {
                    Log.Write("add new part " + PartNumber);
                    Part newPart = new Part();

                    newPart.ItemNumber  = PartNumber;
                    newPart.Description = PartDescription;
                    newPart.Name        = PartDescription.Split('/')[0];

                    Parts.Add(newPart);

                    AddManufacturerPart(PartNumber, ManufacturerPart, ManufacturerName);

                    AddPartToParent(ParentPart, PartNumber, PartCountInParent);
                }
                else
                {
                    //just add another manufacturer part to part
                    AddManufacturerPart(PartNumber, ManufacturerPart, ManufacturerName);
                }
            }
            catch (Exception ex)
            {
                Log.Write("exception in AnalyzeLine " + ex.ToString());
            }
        }