Example #1
0
        public List <DTO_CORE_GigAlert> FindAlertsByType(DTO_CORE_GigAlert request)
        {
            GigALoan_DAL.DB_connection context = new GigALoan_DAL.DB_connection();

            List <DTO_CORE_GigAlert> results = new List <DTO_CORE_GigAlert>();

            var alertList = context.CORE_GigAlerts.Where(ga => ga.SPRT_GigTypes.TypeID == request.TypeID);

            foreach (CORE_GigAlerts alert in alertList)
            {
                DTO_CORE_GigAlert result = new DTO_CORE_GigAlert
                {
                    AlertID     = alert.AlertID,
                    TypeID      = alert.TypeID,
                    Title       = alert.Title,
                    Comment     = alert.Comment,
                    Active      = (bool)alert.Active,
                    ClientID    = alert.ClientID,
                    DateCreated = alert.DateCreated,
                    Lat         = alert.Lat,
                    Long        = alert.Long,
                    PaymentAmt  = alert.PaymentAmt
                                  /*TODO: Get Alert images(or at least the first) loaded as well*/
                };
                results.Add(result);
            }

            return(results);
        }
Example #2
0
        public List <DTO_CORE_GigAlert> FindAlertByID(DTO_CORE_GigAlert request)
        {
            List <DTO_CORE_GigAlert> results = new List <DTO_CORE_GigAlert>();

            using (GigALoan_DAL.DB_connection context = new GigALoan_DAL.DB_connection())
            {
                if (request != null)
                {
                    var alertList = context.CORE_GigAlerts.Where(ga => ga.AlertID == request.AlertID).ToList();

                    foreach (var alert in alertList)
                    {
                        DTO_CORE_GigAlert result = new DTO_CORE_GigAlert
                        {
                            Active      = (bool)alert.Active,
                            AlertID     = alert.AlertID,
                            ClientID    = alert.ClientID,
                            Comment     = alert.Comment,
                            DateCreated = alert.DateCreated,
                            Lat         = alert.Lat,
                            Long        = alert.Long,
                            PaymentAmt  = alert.PaymentAmt,
                            Title       = alert.Title,
                            TypeID      = alert.TypeID
                        };
                        results.Add(result);
                    }
                }
            }

            return(results);
        }
Example #3
0
        public List <DTO_CORE_GigAlert> FindAlertsByPay(DTO_CORE_GigAlert request)
        {
            using (DB_connection context = new GigALoan_DAL.DB_connection())
            {
                List <DTO_CORE_GigAlert> results = new List <DTO_CORE_GigAlert>();

                var alertList = context.CORE_GigAlerts.Where(ga => ga.PaymentAmt >= request.PaymentAmt);

                foreach (CORE_GigAlerts alert in alertList)
                {
                    DTO_CORE_GigAlert result = new DTO_CORE_GigAlert
                    {
                        AlertID     = alert.AlertID,
                        TypeID      = alert.TypeID,
                        Title       = alert.Title,
                        Comment     = alert.Comment,
                        Active      = (bool)alert.Active,
                        ClientID    = alert.ClientID,
                        DateCreated = alert.DateCreated,
                        Lat         = alert.Lat,
                        Long        = alert.Long,
                        PaymentAmt  = alert.PaymentAmt
                                      /*TODO: Get Alert images(or at least the first) loaded as well*/
                    };
                    results.Add(result);
                }

                if (request == null)
                {
                    return new List <DTO_CORE_GigAlert> {
                               new DTO_CORE_GigAlert {
                                   Comment = "empty request"
                               }
                    }
                }
                ;
                else if (results.Count == 0)
                {
                    return new List <DTO_CORE_GigAlert> {
                               new DTO_CORE_GigAlert {
                                   Comment = "empty response"
                               }
                    }
                }
                ;
                else
                {
                    return(results);
                }
            }
        }
Example #4
0
        public static List <DTO_CORE_Student> AlertLocalStudents(DTO_CORE_GigAlert alert, int range)
        {
            GigALoan_DAL.DB_connection context = new GigALoan_DAL.DB_connection();
            if (range == 0)
            {
                range = 10; //10 miles
            }
            var localStudents = context.proc_GetLocalStudentsByAlert(alert.AlertID, range).ToList();
            List <DTO_CORE_Student> returnList = new List <DTO_CORE_Student>();

            foreach (var s in localStudents)
            {
                returnList.Add(new DTO_CORE_Student
                {
                    StudentID = s.Value
                });
            }

            return(returnList);
        }
Example #5
0
        public List <DTO_CORE_Gig> FindGigByAlertID(DTO_CORE_GigAlert request)
        {
            List <DTO_CORE_Gig> results = new List <DTO_CORE_Gig>();

            using (DB_connection context = new GigALoan_DAL.DB_connection())
            {
                var gigList = context.CORE_Gigs.Where(g => g.AlertID == request.AlertID).ToList();

                foreach (CORE_Gigs gig in gigList)
                {
                    DTO_CORE_Gig result = new DTO_CORE_Gig
                    {
                        GigID           = gig.GigID,
                        StudentID       = gig.StudentID,
                        AlertID         = gig.AlertID,
                        DateAccepted    = gig.DateAccepted,
                        StudentComments = gig.StudentComments,
                        ClientComments  = gig.ClientComments
                    };
                    if (gig.DateClosed != null)
                    {
                        result.DateClosed = (DateTime)gig.DateClosed;
                    }
                    if (gig.StudentRating != null)
                    {
                        result.StudentRating = (double)gig.StudentRating;
                    }
                    if (gig.ClientRating != null)
                    {
                        result.ClientRating = (double)gig.ClientRating;
                    }

                    results.Add(result);
                }

                return(results);
            }
        }