Example #1
0
        public Component(int sourceID, string functionalName, SubAssemblyBase parent, int Quantity, decimal calculatedLength, decimal width)
        {
            if (sourceID == -1)
            {
                m_source = new SourceMaterial();
                m_ComponentSourceNumber = -1;
            }
            else
            {
                try
                {
                    this.m_source = FrameWorks.PartDictionary.PartSource[sourceID];
                }
                catch
                {
                    ComponentNotFoundException ex = new ComponentNotFoundException("Component ID = does not exist");
                    throw ex;
                }
            }


            this.FunctionalName    = functionalName;
            this.m_parentAssembly  = parent;
            this.m_ComponentLength = calculatedLength;
            this.Qnty           = Quantity;
            this.ComponentWidth = width;
        }
Example #2
0
 public Component(int sourceID)
 {
     if (sourceID == -1)
     {
         m_source = new SourceMaterial();
         m_ComponentSourceNumber = -1;
     }
     else
     {
         this.m_source = FrameWorks.PartDictionary.PartSource[sourceID];
         m_UOM         = m_source.UOM;
     }
 }
Example #3
0
        public static void Load(bool useComponentLibrary)
        {
            string ConString = @"Password=Kx09a32x;Persist Security Info=True;User ID=sa;Initial Catalog=Badger;Data Source=192.168.10.3";
            // string ConString = connectionString;
            SqlConnection con = new SqlConnection(ConString);

            SqlCommand cmd = con.CreateCommand();

            cmd.CommandText = @"select Componentid,
                                    itemname,
                                    itemdescription,
                                    cost,
                                    UID,
                                    Weight,
                                    Waste,
                                    Markup,
                                    SupplierID FROM Component";
            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                SourceMaterial material = new SourceMaterial();
                // ItemID-ComponentNum
                material.ItemID = reader.GetInt32(0);
                if (!reader.IsDBNull(1))
                {
                    material.MaterialName = reader.GetString(1);
                }
                else
                {
                    material.MaterialName = string.Empty;
                }
                // Material Description
                if (!reader.IsDBNull(2))
                {
                    material.MaterialDescription = reader.GetString(2);
                }
                else
                {
                    material.MaterialDescription = string.Empty;
                }
                // Cost
                if (!reader.IsDBNull(3))
                {
                    material.Cost = reader.GetDecimal(3);
                }
                // Materials UOM (unitof measure)
                if (!reader.IsDBNull(4))
                {
                    material.UOM = reader.GetInt32(4);
                }
                else
                {
                    material.UOM = 0;
                }
                // Wieght
                if (!reader.IsDBNull(5))
                {
                    material.Weight = reader.GetDecimal(5);
                }
                // Waster
                if (!reader.IsDBNull(6))
                {
                    material.Waste = reader.GetDecimal(6);
                }
                // Markup
                if (!reader.IsDBNull(7))
                {
                    material.MarkUp = reader.GetDecimal(7);
                }
                // SupplierID
                if (!reader.IsDBNull(8))
                {
                    material.SupplierID = reader.GetInt32(8);
                }

                m_ComponentSource.Add(reader.GetInt32(0), material);
            }
            con.Close();
        }