Beispiel #1
0
        public static UltrasonicControlProductModels Do(int id)
        {
            UltrasonicControlProductModels m = new UltrasonicControlProductModels();
            string query = "SELECT ,[Alloy],[DeliveryStatus],[NormativeDocument],[Gang],[ProductCodeNumber],[NumberPacket],[Standart]"
                           + " FROM  [StoredBase].[dbo].[ProtocolsTable]";

            return(m);
        }
Beispiel #2
0
        public static IEnumerable <UltrasonicControlProductModels> HeaderProtocol(int id, long numberProtocol, DateTime dteTme, int count, string Operator)
        {
            List <UltrasonicControlProductModels> res = new List <UltrasonicControlProductModels>();

            string queryString = "SELECT [Alloy],[DeliveryStatus],[NormativeDocument],[Gang]"
                                 + ",[ProductCodeNumber],[NumberPacket],[Standart]"
                                 + ", ProtocolNumber"
                                 + " FROM [ProtocolsTable]"
                                 + "WHERE [ID]= @id"
            ;

            using (SqlConnection connection = new SqlConnection(Properties.Settings.Default.StoredBaseConnectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);

                command.Parameters.Add("@id", SqlDbType.Int);
                command.Parameters["@id"].Value = id;

                command.Connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                try
                {
                    if (reader.Read())
                    {
                        UltrasonicControlProductModels t = new UltrasonicControlProductModels();

                        t.Alloy             = (string)reader[0];
                        t.DeliveryStatus    = (string)reader[1];
                        t.NormativeDocument = (string)reader[2];
                        t.Gang = (string)reader[3];
                        t.ProductCodeNumber = (string)reader[4];
                        t.NumberPacket      = (string)reader[5];
                        t.Standart          = (string)reader[6];
                        numberProtocol      = (int)((reader[7] is DBNull) ? 0 : reader[7]);

                        t.Count    = count;
                        t.TteTme   = dteTme;
                        t.Operator = Operator;
                        command.Connection.Close();
                        //(SqlConnection connection, int NumberProtocol, DateTime date_time, int ID)
                        numberProtocol   = GetProtocolNumber(connection, numberProtocol, dteTme, id);
                        t.NumberProtocol = numberProtocol.ToString();

                        res.Add(t);
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            return(res);
        }