Esempio n. 1
0
        private void SetRoomsUI(ComboBox cmb, ScheduleLesson lesson, ScheduleTime time)
        {
            List <string> rooms = new List <string>();

            foreach (ScheduleRoom room in Rooms)
            {
                if (Employments.Rooms.IsFree(room.Name, time))
                {
                    rooms.Add(room.Name);
                }
            }

            if (lesson != null)
            {
                rooms.Add(lesson.Room);
            }
            BindingSource bs = new BindingSource();

            bs.DataSource  = rooms;
            cmb.DataSource = bs;
            cmb.Text       = (lesson != null && !lesson.IsEmpty) ? lesson.Room : String.Empty;
            if (lesson == null || lesson.IsEmpty)
            {
                cmb.SelectedItem = null;
            }
        }
        public ActionResult UpdateScheduleTime(int?id)
        {
            int ab = Convert.ToInt32(Session["id"]);
            int bc = Convert.ToInt32(Session["Designation"]);

            if (ab != 0 && bc == 1)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ScheduleTime scheduleTime = db.ScheduleTimes.Find(id);

                if (scheduleTime == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.ScheduleTimeid = new SelectList(db.ScheduleTimes, "ScheduleTimeId", "ScheduleName");

                return(View(scheduleTime));
            }
            else
            {
                FormsAuthentication.SignOut();
                return(RedirectToAction("Login", "Login"));
            }
        }
        /// <summary>
        /// Determines whether or not a Student can register for a course.
        /// </summary>
        /// <param name="student">The Student to register to the Course.</param>
        /// <param name="course">The Course to register the Student for.</param>
        /// <returns>True if the Student can register for the Course.</returns>
        private bool CanRegisterForCourse(Student student, CourseSchedule courseSchedule)
        {
            bool successful = true;

            TimeSpan startTime = courseSchedule.Schedule.StartTime;
            TimeSpan endTime   = ScheduleTime.GetEndTime(startTime, courseSchedule.Schedule.TimeBlocks);

            if (courseSchedule.ProfessorId == student.PersonId)
            {
                successful = false;
            }
            else if (GetNumberOfStudentsInCourse(courseSchedule) >= courseSchedule.Capacity)
            {
                successful = false;
            }
            else
            {
                foreach (StudentSchedule existingSchedule in student.StudentSchedules.Where(s => s.Enrolled))
                {
                    TimeSpan oldStartTime = existingSchedule.CourseSchedule.Schedule.StartTime;
                    TimeSpan oldEndTime   = ScheduleTime.GetEndTime(oldStartTime, existingSchedule.CourseSchedule.Schedule.TimeBlocks);

                    if (ScheduleTime.TimesOverlap(startTime, endTime, oldStartTime, oldEndTime))
                    {
                        successful = false;
                    }
                }
            }

            return(successful);
        }
Esempio n. 4
0
        private static void SetElementView(List <ScheduleLesson> LessonsByView, string nameElementProjection,
                                           ScheduleClasses.View view, ScheduleWeeks Shedule, DataGridView table, Employments Employments, bool watchAll)
        {
            for (int Hour = 1; Hour <= Shedule.Setting.CountLessonsOfDay; Hour++)
            {
                DataGridViewRow row = CreateNewRow(table, nameElementProjection, ScheduleTime.GetHourDiscription(Hour));

                for (int Week = 1, CellIndex = 2; Week <= Shedule.Setting.CountWeeksShedule; Week++)
                {
                    for (int Day = 1; Day <= Shedule.Setting.CountDaysEducationWeek; Day++, CellIndex++)
                    {
                        //время занятия на 1-2 недели
                        ScheduleTime Time1 = new ScheduleTime((Week)Week, (ScheduleClasses.Day)Day, Hour);
                        //время занятия на 3-4 недели
                        ScheduleTime Time2 = GetTimeAfterTwoWeek(Time1);

                        //занятие на 1-2 недели
                        ScheduleLesson item1 = Shedule.FindLessonInList(LessonsByView, Time1);
                        //занятие на 3-4 недели
                        ScheduleLesson item2 = Shedule.FindLessonInList(LessonsByView, Time2);

                        string Room1 = item1 != null ? item1.Room : String.Empty;
                        string Room2 = item2 != null ? item2.Room : String.Empty;

                        Employment employmentCell = FindEmployment(view, Employments, nameElementProjection, Time1);

                        string cellContent = item1 == null && item2 == null ? String.Empty : IsLessonsEqualAndNonEmpty(item1, item2) ?
                                             GetCellContentIdenticalLessons(view, item1) : GetCellContentDiffrentLessons(view, item1, item2);

                        // задать значения ячейки в
                        DataGridViewCell cell = row.Cells[CellIndex];
                        cell.Value = cellContent;
                        cell.Tag   = new SchedulePointer(Time1, Time2, Room1, Room2);
                        // задать цвет и стиль ячейке
                        if (cellContent != String.Empty)
                        {
                            cell.Style.BackColor = IsLessonsEqualAndNonEmpty(item1, item2) ? Color.LightGreen : Color.LightGreen;
                        }

                        if (employmentCell != null && employmentCell.Reason == ReasonEmployment.UserBlocked)
                        {
                            SetCellBlockedStyle(cell);
                        }
                    }
                }

                if (watchAll || (!watchAll && Shedule.Lessons.Where(x => x.Hour == Hour && !x.IsEmpty).Count() > 0))
                {
                    table.Rows.Add(row);
                }
            }

            //добавить разделитель
            int index = table.Rows.GetLastRow(DataGridViewElementStates.None);

            if (index >= 0)
            {
                table.Rows[index].DividerHeight = 3;
            }
        }
Esempio n. 5
0
        private void ViewSelectLesson(DataGridViewCell cell)
        {
            SchedulePointer Tag = cell.Tag as SchedulePointer;

            ScheduleLesson lesson1 = Schedule.GetLesson(Tag.Time1, Tag.Room1);
            ScheduleLesson lesson2 = Schedule.GetLesson(Tag.Time2, Tag.Room2);

            if (NumSelectLesson == 1)
            {
                SetDataSelectLessonForm(lesson1, lesson2, txtTeacher1, txtDiscipline1, txtRoom1, txtTypeLesson1);

                L1 = lesson1;
                L2 = lesson2;
                T1 = Tag.Time1.Copy();
                T2 = Tag.Time2.Copy();
            }
            else if (NumSelectLesson == 2)
            {
                SetDataSelectLessonForm(lesson1, lesson2, txtTeacher2, txtDiscipline2, txtRoom2, txtTypeLesson2);

                L3 = lesson1;
                L4 = lesson2;
                T3 = Tag.Time1.Copy();
                T4 = Tag.Time2.Copy();
            }

            NumSelectLesson = 0;
        }
Esempio n. 6
0
        private void SetTeachersUI(ComboBox cmb, ScheduleLesson lesson, ScheduleTime time)
        {
            List <string> Teachers = new List <string>();

            foreach (string teacher in Adapter.NamesTeachers)
            {
                if (Employments.Teachers.IsFree(teacher, time))
                {
                    Teachers.Add(teacher);
                }
            }

            if (lesson != null)
            {
                Teachers.Add(lesson.Teacher);
            }
            BindingSource bs = new BindingSource();

            bs.DataSource  = Teachers;
            cmb.DataSource = bs;
            cmb.Text       = (lesson != null && !lesson.IsEmpty) ? lesson.Teacher : String.Empty;
            if (lesson == null || lesson.IsEmpty)
            {
                cmb.SelectedItem = null;
            }
        }
Esempio n. 7
0
        private static ScheduleTime GetTimeAfterTwoWeek(ScheduleTime now)
        {
            ScheduleTime afterTwoWeek = now.Copy();

            afterTwoWeek.Week = (Week)(afterTwoWeek.WeekNumber + 2);
            return(afterTwoWeek);
        }
Esempio n. 8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (dispatchTime_ != null)
            {
                hash ^= DispatchTime.GetHashCode();
            }
            if (responseTime_ != null)
            {
                hash ^= ResponseTime.GetHashCode();
            }
            if (responseStatus_ != null)
            {
                hash ^= ResponseStatus.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 9
0
        private void SetGroupsUI(ListView ChooiceGroups, ListView AccessGroups,
                                 ScheduleLesson lesson, ScheduleTime time)
        {
            List <string> AccGroups = new List <string>();
            List <string> ChcGroups = new List <string>();

            foreach (string group in Adapter.NamesGroups)
            {
                if (Employments.Groups.IsFree(group, time))
                {
                    AccGroups.Add(group);
                }
            }

            if (lesson != null && !lesson.IsEmpty)
            {
                ChcGroups.AddRange(lesson.Groups);
            }

            foreach (string group in ChcGroups)
            {
                ChooiceGroups.Items.Add(new ListViewItem(group)
                {
                    ImageIndex = 0
                });
            }

            foreach (string group in AccGroups)
            {
                AccessGroups.Items.Add(new ListViewItem(group)
                {
                    ImageIndex = 0
                });
            }
        }
Esempio n. 10
0
        private static void InitCalendarColumns(DataGridView table, int countWeeks, int countDays)
        {
            for (int week = 1; week <= countWeeks; week++)
            {
                DataGridViewTextBoxColumn clmn = new DataGridViewTextBoxColumn();
                for (int day = 1; day <= countDays; day++)
                {
                    clmn = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = ScheduleTime.GetDayDescription((ScheduleClasses.Day)day).ToUpper(),
                        Name       = "w" + week.ToString() + "d" + day.ToString(),
                        Width      = 220,
                        ReadOnly   = true,
                        SortMode   = DataGridViewColumnSortMode.NotSortable
                    };

                    clmn.DefaultCellStyle.BackColor = (day > (int)ScheduleClasses.Day.Friday) ?
                                                      Color.LightBlue : new DataGridViewCellStyle().BackColor;

                    clmn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

                    table.Columns.Add(clmn);
                }
                clmn.DividerWidth = 5;
            }
        }
Esempio n. 11
0
        public void MergeFrom(Task other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Name.Length != 0)
            {
                Name = other.Name;
            }
            if (other.scheduleTime_ != null)
            {
                if (scheduleTime_ == null)
                {
                    scheduleTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
                }
                ScheduleTime.MergeFrom(other.ScheduleTime);
            }
            if (other.createTime_ != null)
            {
                if (createTime_ == null)
                {
                    createTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
                }
                CreateTime.MergeFrom(other.CreateTime);
            }
            if (other.status_ != null)
            {
                if (status_ == null)
                {
                    status_ = new global::Google.Cloud.Tasks.V2Beta2.TaskStatus();
                }
                Status.MergeFrom(other.Status);
            }
            if (other.View != 0)
            {
                View = other.View;
            }
            switch (other.PayloadTypeCase)
            {
            case PayloadTypeOneofCase.AppEngineHttpRequest:
                if (AppEngineHttpRequest == null)
                {
                    AppEngineHttpRequest = new global::Google.Cloud.Tasks.V2Beta2.AppEngineHttpRequest();
                }
                AppEngineHttpRequest.MergeFrom(other.AppEngineHttpRequest);
                break;

            case PayloadTypeOneofCase.PullMessage:
                if (PullMessage == null)
                {
                    PullMessage = new global::Google.Cloud.Tasks.V2Beta2.PullMessage();
                }
                PullMessage.MergeFrom(other.PullMessage);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Esempio n. 12
0
 private DateTime getDateTime(ScheduleTime t)
 {
     if (t == ScheduleTime.Start)
     {
         return(new DateTime(dtpDateStart.Value.Year, dtpDateStart.Value.Month, dtpDateStart.Value.Day, dtpTimeStart.Value.Hour, dtpTimeStart.Value.Minute, 0));
     }
     return(new DateTime(dtpDateEnd.Value.Year, dtpDateEnd.Value.Month, dtpDateEnd.Value.Day, dtpTimeEnd.Value.Hour, dtpTimeEnd.Value.Minute, 0));
 }
Esempio n. 13
0
        public void ShowAllProgress(int selectedIndex)
        {
            DataRow dr = scheduledEvents.Rows[selectedIndex];

            ActSched     scheduler = new ActSched(iMainPage.userInfo);
            ScheduleTime form      = new ScheduleTime(scheduler, dr);

            form.Show();
        }
Esempio n. 14
0
        public void Test_TimesOverlap_False()
        {
            TimeSpan startTime1 = new TimeSpan(8, 0, 0);
            TimeSpan endTime1   = new TimeSpan(9, 15, 0);
            TimeSpan startTime2 = new TimeSpan(9, 30, 0);
            TimeSpan endTime2   = new TimeSpan(10, 45, 0);

            Assert.False(ScheduleTime.TimesOverlap(startTime1, endTime1, startTime2, endTime2));
        }
Esempio n. 15
0
 /// <summary>
 /// Convert Schedule into ScheduleDAO.
 /// </summary>
 /// <param name="schedule">The Schedule to convert.</param>
 /// <returns>The ScheduleDAO.</returns>
 public static ScheduleDAO MapToScheduleDAO(Schedule schedule)
 {
     return(new ScheduleDAO
     {
         Id = schedule.ScheduleId,
         StartTime = schedule.StartTime,
         EndTime = ScheduleTime.GetEndTime(schedule.StartTime, schedule.TimeBlocks),
         TimeBlocks = schedule.TimeBlocks
     });
 }
 public ActionResult AddScheduleTime(ScheduleTime scheduleTime)
 {
     if (ModelState.IsValid)
     {
         db.ScheduleTimes.Add(scheduleTime);
         db.SaveChanges();
         return(RedirectToAction("ScheduleTime"));
     }
     return(View("AddScheduleTime"));
 }
 public ActionResult UpdateScheduleTime([Bind(Include = "ScheduleTimeId,ScheduleName,StartTime,EndTime")] ScheduleTime scheduleTime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(scheduleTime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ScheduleTime"));
     }
     return(View(scheduleTime));
 }
Esempio n. 18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.AppEngineHttpRequest)
            {
                hash ^= AppEngineHttpRequest.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.HttpRequest)
            {
                hash ^= HttpRequest.GetHashCode();
            }
            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (dispatchDeadline_ != null)
            {
                hash ^= DispatchDeadline.GetHashCode();
            }
            if (DispatchCount != 0)
            {
                hash ^= DispatchCount.GetHashCode();
            }
            if (ResponseCount != 0)
            {
                hash ^= ResponseCount.GetHashCode();
            }
            if (firstAttempt_ != null)
            {
                hash ^= FirstAttempt.GetHashCode();
            }
            if (lastAttempt_ != null)
            {
                hash ^= LastAttempt.GetHashCode();
            }
            if (View != 0)
            {
                hash ^= View.GetHashCode();
            }
            hash ^= (int)payloadTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 19
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (messageTypeCase_ == MessageTypeOneofCase.AppEngineHttpRequest)
            {
                hash ^= AppEngineHttpRequest.GetHashCode();
            }
            if (messageTypeCase_ == MessageTypeOneofCase.HttpRequest)
            {
                hash ^= HttpRequest.GetHashCode();
            }
            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (dispatchDeadline_ != null)
            {
                hash ^= DispatchDeadline.GetHashCode();
            }
            if (DispatchCount != 0)
            {
                hash ^= DispatchCount.GetHashCode();
            }
            if (ResponseCount != 0)
            {
                hash ^= ResponseCount.GetHashCode();
            }
            if (firstAttempt_ != null)
            {
                hash ^= FirstAttempt.GetHashCode();
            }
            if (lastAttempt_ != null)
            {
                hash ^= LastAttempt.GetHashCode();
            }
            if (View != global::Google.Cloud.Tasks.V2.Task.Types.View.Unspecified)
            {
                hash ^= View.GetHashCode();
            }
            hash ^= (int)messageTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 20
0
        public async Task <IActionResult> UpdateTemperature([FromRoute] byte value, [FromBody] ScheduleTime schedule)
        {
            var result = await _mediator.Send(new SetStatusCommand
            {
                Status   = value,
                Schedule = schedule,
                Type     = WaterTempChannels.Boiler
            }, CancellationToken.None);

            return(StatusCode((int)result));
        }
Esempio n. 21
0
 private static void SetDatesColumns(DataGridView table, ScheduleWeeks Shedule)
 {
     for (int WeekCounter = 1, CellCounter = 2; WeekCounter <= Shedule.Setting.CountWeeksShedule; WeekCounter++)
     {
         for (int DayCounter = 1; DayCounter <= Shedule.Setting.CountDaysEducationWeek; DayCounter++, CellCounter++)
         {
             table.Columns[CellCounter].HeaderText = ScheduleTime.GetDayDescription((ScheduleClasses.Day)DayCounter).ToUpper() +
                                                     Environment.NewLine + Shedule.GetDay((Week)WeekCounter, (ScheduleClasses.Day)DayCounter).DatesDescription;
         }
     }
 }
Esempio n. 22
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (eventList.Rows.Count > 0)
     {
         DataRow      dr   = this.dtEventList.Rows[eventList.SelectedRows[0].Index];
         ScheduleTime form = new ScheduleTime(this, dr);
         form.ShowDialog();
     }
     else
     {
         MessageBox.Show("Nothing to Show");
     }
 }
Esempio n. 23
0
        private void SetCellBlockedStyle(DataGridViewCell cell, ScheduleTime FirstDayTime, ScheduleTime SecondDayTime)
        {
            cell.Style.BackColor = Color.LightPink;
            string msg = "Занято";

            if (FirstDayTime == SecondDayTime)
            {
                msg += "\n\r" + FirstDayTime.Description;
            }
            cell.Value           = msg;
            cell.Style.Font      = new Font(FontFamily.GenericSansSerif, 12);
            cell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
        }
Esempio n. 24
0
        private void ExchangeLessons(ScheduleLesson item1, ScheduleLesson item2, ScheduleTime time1, ScheduleTime time2)
        {
            if (item1 != null && item2 != null)
            {
                ScheduleLesson tmp1  = item1.Copy();
                ScheduleLesson less1 = Schedule.GetLesson(time1, item1.Room);
                ScheduleLesson less2 = Schedule.GetLesson(time2, item2.Room);

                Schedule.Employments.Remove(less1.Teacher, less1.Groups, less1.Room, less1.Time);
                Schedule.Employments.Remove(less2.Teacher, less2.Groups, less2.Room, less2.Time);

                less1.UpdateFields(item1.Teacher, item1.Discipline, item1.Groups, item1.Type, item2.Dates);
                less1.Time = item2.Time.Copy();
                less1.Room = item2.Room;

                less2.UpdateFields(item2.Teacher, item2.Discipline, item2.Groups, item2.Type, tmp1.Dates);
                less2.Time = tmp1.Time.Copy();
                less2.Room = tmp1.Room;

                Schedule.Employments.Add(less2.Teacher, less2.Groups, less2.Room, less2.Time, ReasonEmployment.UnionLesson);
                Schedule.Employments.Add(less1.Teacher, less1.Groups, less1.Room, less1.Time, ReasonEmployment.UnionLesson);
            }
            else if (item1 == null && item2 != null)
            {
                ScheduleLesson lsn = Schedule.GetLesson(time1, item2.Room);
                if (lsn.GroupsDescription != "" || lsn.Teacher != "" || lsn.Discipline != "")
                {
                    MessageBox.Show("Занято для " + item2.Week.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                ScheduleLesson lsn2 = Schedule.GetLesson(time2, item2.Room).Copy();
                Schedule.Employments.Remove(lsn2.Teacher, lsn2.Groups, lsn2.Room, lsn2.Time);
                lsn.UpdateFields(item2.Teacher, item2.Discipline, item2.Groups, item2.Type, lsn.Dates);
                item2.Clear();
                Schedule.Employments.Add(lsn.Teacher, lsn.Groups, lsn.Room, lsn.Time, ReasonEmployment.UnionLesson);
            }
            else if (item1 != null && item2 == null)
            {
                ScheduleLesson lsn = Schedule.GetLesson(time2, item1.Room);
                if (lsn.GroupsDescription != "" || lsn.Teacher != "" || lsn.Discipline != "")
                {
                    MessageBox.Show("Занято для " + item1.Week.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                ScheduleLesson lsn2 = Schedule.GetLesson(time1, item1.Room).Copy();
                Schedule.Employments.Remove(lsn2.Teacher, lsn2.Groups, lsn2.Room, lsn2.Time);
                lsn.UpdateFields(item1.Teacher, item1.Discipline, item1.Groups, item1.Type, lsn.Dates);
                item1.Clear();
                Schedule.Employments.Add(lsn.Teacher, lsn.Groups, lsn.Room, lsn.Time, ReasonEmployment.UnionLesson);
            }
        }
Esempio n. 25
0
        private ScheduleTime CreateScheduleTime(DateTime schedDT, Schedule scheduleItem)
        {
            ScheduleTime tmpSchedTime = new ScheduleTime();

            tmpSchedTime.ScheduleDate     = schedDT;
            tmpSchedTime.ScheduleId       = scheduleItem.Id;
            tmpSchedTime.ResourceId       = scheduleItem.ResourceId;
            tmpSchedTime.RecordState      = scheduleItem.RecordState;
            tmpSchedTime.WorkTimeDuration = scheduleItem.Duration;
            tmpSchedTime.WorkTimeFrom     = scheduleItem.WorkTimeFrom.Value.TimeOfDay;
            tmpSchedTime.WorkTimeTo       = scheduleItem.WorkTimeTo.Value.TimeOfDay;
            tmpSchedTime.BreakBetweenSlot = scheduleItem.BreakBetweenSlot;
            return(tmpSchedTime);
        }
Esempio n. 26
0
        /// <summary>
        /// File Parsing
        /// </summary>
        /// <param name="reader">Reader</param>
        /// <returns>List of employee</returns>
        public static List <Employee> FileParsing(StreamReader reader)
        {
            List <Employee> employees = new List <Employee>();

            try
            {
                while (reader.Peek() >= 0)
                {
                    List <ScheduleTime> scheduleTimes = new List <ScheduleTime>();
                    var line  = reader.ReadLine().Split(",");
                    int index = line[0].IndexOf('=');

                    //Parsing data to object
                    for (int i = 0; i < line.Length; i++)
                    {
                        ScheduleTime scheduleTime = new ScheduleTime();
                        if (i == 0)
                        {
                            var tempDay = line[i].Remove(0, index + 1).ToString();
                            scheduleTime.Day  = (EnumDays)Enum.Parse(typeof(EnumDays), tempDay.Substring(0, 2), true);
                            scheduleTime.Time = line[i].Remove(0, index + 3).ToString();
                        }
                        else
                        {
                            scheduleTime.Day  = (EnumDays)Enum.Parse(typeof(EnumDays), line[i].Substring(0, 2).ToString(), true);
                            scheduleTime.Time = line[i].Remove(0, 2).ToString();
                        }

                        scheduleTimes.Add(scheduleTime);
                    }

                    var _empoyee = new Employee
                    {
                        Name          = line[0].Substring(0, index).ToString(),
                        ScheduleHours = scheduleTimes
                    };

                    employees.Add(_empoyee);
                }
                reader.Close();
            }
            catch (Exception)
            {
                throw;
            }
            return(employees);
        }
Esempio n. 27
0
        void dgvSchedule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex <= 1 || e.RowIndex < 0)
            {
                return;
            }

            LessonForm      frmLesson = new LessonForm(curSheduleType);
            SchedulePointer Tag       = dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag as SchedulePointer;

            frmLesson.txtSheduleTime.Text = ScheduleTime.GetDescription(Tag.Time1);
            frmLesson.Employments         = Schedule.Employments;
            frmLesson.ds      = ScheduleDataSet;
            frmLesson.Adapter = EducationAdapter;
            frmLesson.Rooms   = Rooms;
            frmLesson.curClmn = dgvSchedule.CurrentCell.ColumnIndex;

            frmLesson.Time1   = Tag.Time1;
            frmLesson.Lesson1 = Schedule.GetLesson(Tag.Time1, Tag.Room1);

            frmLesson.Time2   = Tag.Time2;
            frmLesson.Lesson2 = Schedule.GetLesson(Tag.Time2, Tag.Room2);

            frmLesson.Shedule = Schedule;

            if (frmLesson.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UpdateTableShedule();
                if (curSheduleType == scheduleType.exams)
                {
                    if (frmLesson.Lesson1 != null)
                    {
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 1], frmLesson.Time1.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 2], frmLesson.Time1.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 3], frmLesson.Time1.Week);
                    }
                    if (frmLesson.Lesson2 != null)
                    {
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 1], frmLesson.Time2.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 2], frmLesson.Time2.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 3], frmLesson.Time2.Week);
                    }
                }
            }
        }
Esempio n. 28
0
        public int AddPatient(ScheduleTime schedule, DateTime value1, string value2, string value3, string value4, string value5, string value6, string value7, string value8, string value9, string value10, string value11, string value12, string value13, string value14, string value15, string value16, string value17, string value18, string value19, string value20, string value21, string value22, string value23)
        {
            try
            {
                schedule.ScheduleId            = Guid.NewGuid().ToString();
                schedule.Date                  = value1;
                schedule.Time                  = value2;
                schedule.DXCode                = value3;
                schedule.DoctorsName           = value4;
                schedule.FacilityName          = value5;
                schedule.FacilityAddress       = value6;
                schedule.FirstName             = value7;
                schedule.MiddleName            = value8;
                schedule.LastName              = value9;
                schedule.Address               = value10;
                schedule.City                  = value11;
                schedule.State                 = value12;
                schedule.Zip                   = value13;
                schedule.PhoneNumber           = value14;
                schedule.Email                 = value15;
                schedule.PrimaryInsurance      = value16;
                schedule.SecondaryInsurance    = value17;
                schedule.MemberID              = value18;
                schedule.Destination           = value19;
                schedule.TransportationService = value20;
                schedule.TypeOfVehicle         = value21;
                schedule.Authorization         = value22;
                schedule.Priority              = value23;



                _context.ScheduleTime.Add(schedule);
                _context.SaveChanges();
                return(1);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 29
0
 public void MergeFrom(Attempt other)
 {
     if (other == null)
     {
         return;
     }
     if (other.scheduleTime_ != null)
     {
         if (scheduleTime_ == null)
         {
             scheduleTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         ScheduleTime.MergeFrom(other.ScheduleTime);
     }
     if (other.dispatchTime_ != null)
     {
         if (dispatchTime_ == null)
         {
             dispatchTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         DispatchTime.MergeFrom(other.DispatchTime);
     }
     if (other.responseTime_ != null)
     {
         if (responseTime_ == null)
         {
             responseTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         ResponseTime.MergeFrom(other.ResponseTime);
     }
     if (other.responseStatus_ != null)
     {
         if (responseStatus_ == null)
         {
             responseStatus_ = new global::Google.Rpc.Status();
         }
         ResponseStatus.MergeFrom(other.ResponseStatus);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Esempio n. 30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.AppEngineHttpRequest)
            {
                hash ^= AppEngineHttpRequest.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.PullMessage)
            {
                hash ^= PullMessage.GetHashCode();
            }
            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (status_ != null)
            {
                hash ^= Status.GetHashCode();
            }
            if (View != 0)
            {
                hash ^= View.GetHashCode();
            }
            hash ^= (int)payloadTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 31
0
        public void sendMail()
        {
            var ActiveSchedules = RE.Schedules.Where(p => p.state == "ACTIVE");

            foreach (var scheduleItem in ActiveSchedules)
            {
                var ActiveUser = RE.Users.Single(p => p.id == scheduleItem.userId);
                if (ActiveUser.state == "ACTIVE")
                {
                    var ActiveScheduleTimes = RE.ScheduleTimes.Where(p => p.scheduleId == scheduleItem.id && p.state == "ACTIVE");
                    foreach (var scheduleTimeItem in ActiveScheduleTimes)
                    {
                        if (scheduleTimeItem.taskTime <= DateTime.Now)
                        {
                            string body, subject, email, from;
                            from = "*****@*****.**";
                            email = ActiveUser.email;
                            subject = "Reminder Notification";
                            body = "Reminder name: " + scheduleItem.name + "\r\n"
                                + "Description: " + scheduleItem.description + "\r\n"
                                + "Time: " + scheduleTimeItem.taskTime.ToString();

                            SmtpClient sm = new SmtpClient("smtp.gmail.com", 587);
                            sm.EnableSsl = true;
                            sm.Credentials = new NetworkCredential("biggash730", "kp0l3miah");
                            sm.Send(from, email, subject, body);

                            //WebMail.SmtpServer = Global.SMTP;
                            //WebMail.EnableSsl = true;
                            //WebMail.SmtpPort = 587;
                            //WebMail.UserName = "******";
                            //WebMail.Password = "******";
                            //WebMail.From = "*****@*****.**";
                            //WebMail.Send(email, subject, body, "*****@*****.**");

                            var oldscheduleTime = RE.ScheduleTimes.Single(p => p.id == scheduleTimeItem.id);
                            var newScheduleTime = new ScheduleTime();
                            newScheduleTime.state = "ACTIVE";
                            newScheduleTime.scheduleId = oldscheduleTime.scheduleId;

                            if (scheduleItem.type == "ONCE")
                            {
                                oldscheduleTime.state = "INACTIVE";

                                var oldschedule = RE.Schedules.Single(p => p.id == scheduleItem.id);
                                oldschedule.state = "INACTIVE";

                            }
                            else if (scheduleItem.type == "DAILY")
                            {
                                oldscheduleTime.state = "INACTIVE";

                                newScheduleTime.taskTime = oldscheduleTime.taskTime.AddDays(1);
                                newScheduleTime.
                                RE.ScheduleTimes.AddObject(newScheduleTime);

                            }
                            else if (scheduleItem.type == "WEEKLY")
                            {
                                oldscheduleTime.state = "INACTIVE";

                                newScheduleTime.taskTime = oldscheduleTime.taskTime.AddDays(7);

                                RE.ScheduleTimes.AddObject(newScheduleTime);

                            }
                            else if (scheduleItem.type == "MONTHLY")
                            {
                                oldscheduleTime.state = "INACTIVE";

                                newScheduleTime.taskTime = oldscheduleTime.taskTime.AddMonths(1);

                                RE.ScheduleTimes.AddObject(newScheduleTime);

                            }
                            else if (scheduleItem.type == "YEARLY")
                            {
                                oldscheduleTime.state = "INACTIVE";

                                newScheduleTime.taskTime = oldscheduleTime.taskTime.AddYears(1);

                                RE.ScheduleTimes.AddObject(newScheduleTime);

                            }
                        }
                    }
                }
            }
            RE.SaveChanges();
        }
 private void grid_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right) {
         var hitInfo = gridView.CalcHitInfo(e.Location);
         if (hitInfo.InRow) {
             if (hitInfo.RowHandle == GridControl.NewItemRowHandle)
                 return;
             menuTime = gridView.GetRow(hitInfo.RowHandle) as ScheduleTime;
             menuDelete.Caption = "&Delete " + menuTime.Name;
             menuRecalc.Caption = "&Recalculate " + menuTime.Name;
             menuRecalc.Enabled = cellCalculator.CalcTimes().Any(t => t.Name.Equals(menuTime.Name, StringComparison.CurrentCultureIgnoreCase));
         } else if (hitInfo.HitTest == GridHitTest.EmptyRow) {
             menuTime = null;
             menuDelete.Caption = "&Delete All";
             menuRecalc.Caption = "&Recalculate All";
         } else
             return;
         timeContextMenu.ShowPopup(grid.PointToScreen(e.Location));
     }
 }