Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public static ListerGroup GetListerGroupByID(int?id)
        {
            ListerGroup   x   = new ListerGroup();
            SqlConnection con = new SqlConnection(BaseDataBase.ConnectionString);
            SqlCommand    com = new SqlCommand("sp_GetListerGroupByID", con);

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

            com.Parameters.Add(pr);
            try
            {
                con.Open();
                SqlDataReader rd = com.ExecuteReader();
                if (rd.Read())
                {
                    if (!(rd["GroupID"] is DBNull))
                    {
                        x.GroupID = System.Int32.Parse(rd["GroupID"].ToString());
                    }
                    if (!(rd["OrphanID"] is DBNull))
                    {
                        x.OrphanID = System.Int32.Parse(rd["OrphanID"].ToString());
                    }
                    if (!(rd["Date"] is DBNull))
                    {
                        x.Date = System.DateTime.Parse(rd["Date"].ToString());
                    }
                    x.Evaluation   = rd["Evaluation"].ToString();
                    x.Notes        = rd["Notes"].ToString();
                    x.CreatePerson = rd["CreatePerson"].ToString();
                    if (!(rd["CreateDate"] is DBNull))
                    {
                        x.CreateDate = System.DateTime.Parse(rd["CreateDate"].ToString());
                    }
                    x.LastModifiedPerson = rd["LastModifiedPerson"].ToString();
                    x.Notes = rd["Notes"].ToString();
                    if (!(rd["FamilyID"] is DBNull))
                    {
                        x.FamilyID = System.Int32.Parse(rd["FamilyID"].ToString());
                    }

                    x.Listers     = ListerGroup.GetListersAllByGroupID(x.GroupID);
                    x.FamilyNeeds = FamilyNeed_ListerGroup.GetFamilyNeed_ListerGroupByListerGroupID(x.GroupID.Value);
                }
                rd.Close();
            }
            catch
            {
                x = new ListerGroup();
            }
            finally
            {
                con.Close();
            }
            return(x);
        }
Exemplo n.º 3
0
 public static bool UpdateData(FamilyNeed_ListerGroup x)
 {
     return(BaseDataBase._StoredProcedure("sp_UpdateFamilyNeed_ListerGroup"
                                          , new SqlParameter("@ID", x.ID)
                                          , new SqlParameter("@FamilyNeedListerID", x.FamilyNeedByLister.ID)
                                          , new SqlParameter("@ListerGroupID", x.ListerGroupID)
                                          , new SqlParameter("@OrderID", x.OrderID)
                                          , new SqlParameter("@Count", x.Count)));
 }
Exemplo n.º 4
0
        public static bool InsertData(FamilyNeed_ListerGroup x)
        {
            x.ID = BaseDataBase._StoredProcedureReturnable("sp_Add2FamilyNeed_ListerGroup"
                                                           , new SqlParameter("@ID", System.Data.SqlDbType.Int)
                                                           , new SqlParameter("@FamilyNeedListerID", x.FamilyNeedByLister.ID)
                                                           , new SqlParameter("@ListerGroupID", x.ListerGroupID)
                                                           , new SqlParameter("@OrderID", x.OrderID)
                                                           , new SqlParameter("@Count", x.Count));

            return(x.ID.HasValue);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 public static bool DeleteData(FamilyNeed_ListerGroup x)
 {
     return(BaseDataBase._StoredProcedure("sp_DeleteFromFamilyNeed_ListerGroup"
                                          , new SqlParameter("@ID", x.ID)));
 }