Beispiel #1
0
        //---вызов ХП заполнение реестра
        public static List <cRD> lp_sel_RegistryData(int?ID, DateTime BeginDT, DateTime EndDT)
        {
            List <cRD> list = new List <cRD>();

            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_RegistryData");
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;


                cmd.Parameters.AddWithValue("@Contractor_ID", objectOrNull(ID));
                cmd.Parameters.AddWithValue("@BeginDT", BeginDT);
                cmd.Parameters.AddWithValue("@EndDT", EndDT);


                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    cRD item = new cRD();
                    if (!Reader.IsDBNull(Reader.GetOrdinal("Contractor")))
                    {
                        item.Contractor_Name = (string)Reader["Contractor"];
                    }
                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassType")))
                    {
                        item.MassType = (string)Reader["MassType"];
                    }
                    if (!Reader.IsDBNull(Reader.GetOrdinal("Sort")))
                    {
                        item.Sort_Name = (string)Reader["Sort"];
                    }
                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassValue")))
                    {
                        item.Val = (double)Reader["MassValue"];
                    }
                    list.Add(item);
                }
                Reader.Close();
                conn.Close();
            }

            return(list);
        }
Beispiel #2
0
        //---вызов ХП заполнение реестра
        public static List<cRD> lp_sel_RegistryData(int? ID, DateTime BeginDT, DateTime EndDT)
        {
            List<cRD> list = new List<cRD>();
            using (SqlConnection conn = new SqlConnection(CommManager.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_RegistryData");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;


                cmd.Parameters.AddWithValue("@Contractor_ID", objectOrNull(ID));
                cmd.Parameters.AddWithValue("@BeginDT", BeginDT);
                cmd.Parameters.AddWithValue("@EndDT", EndDT);


                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    cRD item = new cRD();
                    if (!Reader.IsDBNull(Reader.GetOrdinal("Contractor")))
                        item.Contractor_Name = (string)Reader["Contractor"];
                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassType")))
                        item.MassType = (string)Reader["MassType"];
                    if (!Reader.IsDBNull(Reader.GetOrdinal("Sort")))
                        item.Sort_Name = (string)Reader["Sort"];
                    if (!Reader.IsDBNull(Reader.GetOrdinal("MassValue")))
                        item.Val = (double)Reader["MassValue"];
                    list.Add(item);
                }
                Reader.Close();
                conn.Close();
            }

            return list;

        }