Example #1
0
        public IEnumerable <R_Task> GetTasks()
        {
            IEnumerable <R_Task> results = null;

            var sql = PetaPoco.Sql.Builder
                      .Select("*")
                      .From("R_Task")
                      .Where("IsDeleted = 0")

            ;

            results = R_Task.Query(sql);

            return(results);
        }
Example #2
0
        public IEnumerable <R_Task> GetTaskListAdvancedSearch(
            string name
            , int?taskTypeId
            , System.DateTime?taskDateFrom
            , System.DateTime?taskDateTo
            , int?weekDay
            , System.DateTime?startTimeFrom
            , System.DateTime?startTimeTo
            , System.DateTime?endTimeFrom
            , System.DateTime?endTimeTo
            , int?estimatedDuration
            , string description
            , bool?requiresCar
            , int?teamLeaderId
            , bool?active
            )
        {
            IEnumerable <R_Task> results = null;

            var sql = PetaPoco.Sql.Builder
                      .Select("*")
                      .From("R_Task")
                      .Where("IsDeleted = 0"
                             + (name != null ? " and Name like '%" + name + "%'" : "")
                             + (taskTypeId != null ? " and TaskTypeId like '%" + taskTypeId + "%'" : "")
                             + (taskDateFrom != null ? " and TaskDate >= '" + taskDateFrom.Value.ToShortDateString() + "'" : "")
                             + (taskDateTo != null ? " and TaskDate <= '" + taskDateTo.Value.ToShortDateString() + "'" : "")
                             + (weekDay != null ? " and WeekDay like '%" + weekDay + "%'" : "")
                             + (startTimeFrom != null ? " and StartTime >= '" + startTimeFrom.Value.ToShortDateString() + "'" : "")
                             + (startTimeTo != null ? " and StartTime <= '" + startTimeTo.Value.ToShortDateString() + "'" : "")
                             + (endTimeFrom != null ? " and EndTime >= '" + endTimeFrom.Value.ToShortDateString() + "'" : "")
                             + (endTimeTo != null ? " and EndTime <= '" + endTimeTo.Value.ToShortDateString() + "'" : "")
                             + (estimatedDuration != null ? " and EstimatedDuration like '%" + estimatedDuration + "%'" : "")
                             + (description != null ? " and Description like '%" + description + "%'" : "")
                             + (requiresCar != null ? " and RequiresCar like '%" + requiresCar + "%'" : "")
                             + (teamLeaderId != null ? " and TeamLeaderId like '%" + teamLeaderId + "%'" : "")
                             + (active != null ? " and Active = " + (active == true ? "1" : "0") : "")
                             )
            ;

            results = R_Task.Query(sql);

            return(results);
        }