Beispiel #1
0
        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            RackCableManager.RemoveRack(this);
            ContainingPanel.Children.Remove(this);

            RackItem?.CleanUp();
        }
Beispiel #2
0
        public static List <RackItem> GetRackContents(string rackID)
        {
            string _err = string.Empty;
            //string sql = "[Production].[dbo].[GetRackDetails]";
            string sql = "SELECT * FROM [RackRecords].[dbo].[Paint_Rack_XRef] WHERE RACK_ID = @rackID order by ID desc";

            List <RackItem> rackItems = new List <RackItem>();

            try
            {
                using (SqlConnection conn = new SqlConnection(DECOSQL))
                {
                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        //cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@rackID", rackID);
                        cmd.Connection = conn;
                        conn.Open();

                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                var rackItem = new RackItem();

                                rackItem.RackItemID    = reader.GetInt64(reader.GetOrdinal("ID"));
                                rackItem.RackID        = reader.GetInt32(reader.GetOrdinal("rack_id"));
                                rackItem.DateTimeAdded = reader.GetDateTime(reader.GetOrdinal("date"));
                                rackItem.PaintScan     = reader.GetString(reader.GetOrdinal("paintscan"));
                                if (!reader.IsDBNull(reader.GetOrdinal("moldscan")))
                                {
                                    rackItem.MoldScan = reader.GetString(reader.GetOrdinal("moldscan"));
                                }
                                rackItems.Add(rackItem);
                            }
                        }

                        reader.Close();
                        conn.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                _err = ex.Message;
            }

            return(rackItems);
        }
Beispiel #3
0
 public void Close()
 {
     RackItem?.CleanUp();
 }
Beispiel #4
0
 public IEnumerable <RackItemOutput> GetOutputs()
 {
     return(RackItem.GetOutputs());
 }
Beispiel #5
0
 public IEnumerable <RackItemInput> GetInputs()
 {
     return(RackItem.GetInputs());
 }