Пример #1
0
 public Assignment(string name, string assignee, DateTime assignedOn, DateTime dueDate, DateTime startDate, Status currentStatus, bool completed, DateTime? completedOn, string topicDescription, string emp, int orderNum, Int64 assignmentid)
 {
     Name = name;
     AssignedOn = assignedOn;
     DueDate = dueDate;
     StartDate = startDate;
     CurrentStatus = currentStatus;
     Assignee = assignee;
     Completed = completed;
     CompletedOn = completedOn;
     TopicDescription = topicDescription;
     Emp = emp;
     OrderNum = orderNum;
     AssignmentID = assignmentid;
 }
Пример #2
0
        private Assignment GetAssignment(IDataReader reader, Status currentStatus)
        {

            ReportingArea area = null;
            //If we have reporting scope, we can assume that we have all of the area columns.
            if (reader.HasColumn("ReportingScope") &&
                !reader.IsDBNull(reader.GetOrdinal("ReportingScope")))
            {
                area =
                    new ReportingArea(
                        reader.IsDBNull(reader.GetOrdinal("SDst")) ? null : reader.GetString("SDst"),
                        reader.IsDBNull(reader.GetOrdinal("PA")) ? null : reader.GetString("PA"),
                        reader.IsDBNull(reader.GetOrdinal("Abbrev")) ? null : reader.GetString("Abbrev"),
                        reader.IsDBNull(reader.GetOrdinal("RegionID")) ? null : (int?)reader.GetInt32("RegionID"),
                        reader.IsDBNull(reader.GetOrdinal("Region")) ? null : reader.GetString("Region"),
                        (Domain.ReportingScope)(reader.GetInt32("ReportingScope")??1));
            }

            var assignment = new Assignment();
            assignment.Name = reader.GetString("SubscriptionDescription") ?? "(missing course name)";
            assignment.Assignee = string.Format("{0} {1}", reader.GetString("Firstname"), reader.GetString("Lastname"));
            assignment.AssignedOn = reader.GetDateTime("AssignedOn") ?? DateTime.Today;
            assignment.DueDate = reader.GetDateTime("DueDate") ?? DateTime.Today.AddDays(1);
            assignment.StartDate = reader.GetDateTime("StartDate") ?? DateTime.Today;
            assignment.CurrentStatus = currentStatus;
            assignment.Completed = reader.GetBoolean("Completed") ?? false;
            assignment.CompletedOn = reader.IsDBNull(reader.GetOrdinal("CompletedOn")) ? null : (DateTime?)reader.GetDateTime("CompletedOn");
            assignment.Area = area;
            assignment.TopicDescription = reader.GetString("TopicDescription") ?? "(missing description)";
            assignment.Emp = reader.GetString("emp");
            assignment.OrderNum = reader.GetInt32("OrderNum") ?? 1;
            assignment.AssignmentID = reader.GetInt64("AssignmentID") ?? 0;
            assignment.EmployeeCourseAssignmentID = reader.GetInt64("EmployeeCourseAssignmentID") ?? 0;
            assignment.CourseTopicAssignmentID = reader.GetInt64("CourseTopicAssignmentID") ?? 0;
            assignment.CourseTopicID = reader.GetInt32("CourseTopicID") ?? 0;
            assignment.CourseID = reader.GetInt32("CourseID") ?? 0;
            assignment.TopicID = reader.GetInt32("TopicID") ?? 0;
            return assignment;
        }
Пример #3
0
        private IList<Assignment> LoadAssignments(IDataReader reader, bool loadStatus)
        {

            //string statusQuery = @"LoadSubscriptions";

            IList<Assignment> assignments = new List<Assignment>();
            while (reader.Read())
            {
                Status status = null;
                if (loadStatus)
                {
                    char? section = null;
                    if (reader.HasColumn("Section"))
                    {
                        var str = reader.GetString(reader.GetOrdinal("Section"));
                        if (!String.IsNullOrEmpty(str))
                            section = str[0];
                    }
                    byte? sectionSequence = reader.GetByte("SectionSequence");
                    if (section.HasValue && sectionSequence.HasValue)
                        status = new Status(Translator.FromDBValueToStatusType(section.Value), sectionSequence.Value);
                }

                Assignment assignment = GetAssignment(reader, status);
                assignments.Add(assignment);
                var id = reader.GetInt64("Id");
                if (id.HasValue)
                    _IdsByHashCode[assignment.GetHashCode()] = (int)id.Value;
            }

            return assignments;
        }
Пример #4
0
 public Assignment(string name, string assignee, DateTime assignedOn, DateTime dueDate, DateTime startDate, Status currentStatus, bool completed, DateTime? completedOn, ReportingArea area, string topicDescription, string emp, int orderNum, Int64 assignmentid)
     : this(name, assignee, assignedOn, dueDate, startDate, currentStatus, completed, completedOn, topicDescription, emp, orderNum, assignmentid)
 {
     Area = area;
 }