Пример #1
0
        public static FamilyNeedByLister GetFamilyNeedByListerByID(int id)
        {
            FamilyNeedByLister x   = new FamilyNeedByLister();
            SqlConnection      con = new SqlConnection(BaseDataBase.ConnectionString);
            SqlCommand         com = new SqlCommand("sp_GetFamilyNeedByListerByID", con);

            com.CommandType = System.Data.CommandType.StoredProcedure;
            com.Parameters.Add(new SqlParameter("ID", id));
            try
            {
                con.Open();
                SqlDataReader rd = com.ExecuteReader();
                if (rd.Read())
                {
                    if (!(rd["ID"] is DBNull))
                    {
                        x.ID = System.Int32.Parse(rd["ID"].ToString());
                    }
                    x.Name = rd["Name"].ToString();
                }
                rd.Close();
            }
            catch
            {
                x = new FamilyNeedByLister();
            }
            finally
            {
                con.Close();
            }
            return(x);
        }
Пример #2
0
        public static List <FamilyNeed_ListerGroup> GetFamilyNeed_ListerGroupBySupportGroupID(int?OrderID, int FamilyID)
        {
            List <FamilyNeed_ListerGroup> lgfns = new List <FamilyNeed_ListerGroup>();

            SqlConnection con = new SqlConnection(BaseDataBase.ConnectionString);
            SqlCommand    com = new SqlCommand("sp_GetFamilyNeed_ListerGroupBySupportGroupID", con);

            com.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter pr1 = new SqlParameter("@OrderID", OrderID);

            com.Parameters.Add(pr1);
            SqlParameter pr2 = new SqlParameter("@FamilyID", FamilyID);

            com.Parameters.Add(pr2);
            try
            {
                con.Open();
                SqlDataReader rd = com.ExecuteReader();
                while (rd.Read())
                {
                    FamilyNeed_ListerGroup x = new FamilyNeed_ListerGroup();

                    if (!(rd["ID"] is DBNull))
                    {
                        x.ID = System.Int32.Parse(rd["ID"].ToString());
                    }
                    if (!(rd["FamilyNeedListerID"] is DBNull))
                    {
                        x.FamilyNeedByLister = FamilyNeedByLister.GetFamilyNeedByListerByID(System.Int32.Parse(rd["FamilyNeedListerID"].ToString()));
                    }
                    if (!(rd["ListerGroupID"] is DBNull))
                    {
                        x.ListerGroupID = System.Int32.Parse(rd["ListerGroupID"].ToString());
                    }
                    if (!(rd["OrderID"] is DBNull))
                    {
                        x.OrderID = System.Int32.Parse(rd["OrderID"].ToString());
                    }
                    if (!(rd["Count"] is DBNull))
                    {
                        x.Count = System.Int32.Parse(rd["Count"].ToString());
                    }
                    x.IsEnsured = x.OrderID.HasValue;

                    lgfns.Add(x);
                }
                rd.Close();
            }
            catch
            {
                lgfns = new List <FamilyNeed_ListerGroup>();
            }
            finally
            {
                con.Close();
            }
            return(lgfns);
        }
Пример #3
0
        public static FamilyNeed_ListerGroup GetFamilyNeed_ListerGroupByID(int id)
        {
            FamilyNeed_ListerGroup x = new FamilyNeed_ListerGroup();

            SqlConnection con = new SqlConnection(BaseDataBase.ConnectionString);
            SqlCommand    com = new SqlCommand("sp_GetFamilyNeed_ListerGroupByID", con);

            com.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter pr = new SqlParameter("@ID", id);

            com.Parameters.Add(pr);
            try
            {
                con.Open();
                SqlDataReader rd = com.ExecuteReader();
                if (rd.Read())
                {
                    if (!(rd["ID"] is DBNull))
                    {
                        x.ID = System.Int32.Parse(rd["ID"].ToString());
                    }
                    if (!(rd["FamilyNeedListerID"] is DBNull))
                    {
                        x.FamilyNeedByLister = FamilyNeedByLister.GetFamilyNeedByListerByID(System.Int32.Parse(rd["FamilyNeedListerID"].ToString()));
                    }
                    if (!(rd["ListerGroupID"] is DBNull))
                    {
                        x.ListerGroupID = System.Int32.Parse(rd["ListerGroupID"].ToString());
                    }
                    if (!(rd["OrderID"] is DBNull))
                    {
                        x.OrderID = System.Int32.Parse(rd["OrderID"].ToString());
                    }
                    if (!(rd["Count"] is DBNull))
                    {
                        x.Count = System.Int32.Parse(rd["Count"].ToString());
                    }
                    x.IsEnsured = x.OrderID.HasValue;
                }
                rd.Close();
            }
            catch
            {
                x = new FamilyNeed_ListerGroup();
            }
            finally
            {
                con.Close();
            }
            return(x);
        }