private void btnAttendanceSave_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedDate.IsValidDate() && SelectedClassID > 0)
     {
         foreach (var item in StudentAttendanceList)
         {
             Attendance atnd = new Attendance {
                 ClassID = SelectedClassID, StudentID = SelectedStudenID, SessionID = SessionID, isPresent = item.isPresent, updated_by = UserID
             };
             if (item.isExisted)
             {
                 AttendanceRepo.Update(atnd);
             }
             else
             {
                 atnd.created_by = UserID;
                 AttendanceRepo.Insert(atnd);
             }
         }
     }
     else
     {
         Message(MessageTypes.Error, "Please Select the date and Class");
     }
 }
Esempio n. 2
0
        public void TestInitialize()
        {
            _mockAttends = new Mock <DbSet <Attendance> >();
            var mockDb = new Mock <IApplicationDbContext>();

            mockDb.SetupGet(n => n.Attendances).Returns(_mockAttends.Object);

            _attendRepo = new AttendanceRepo(mockDb.Object);
        }
Esempio n. 3
0
 public UnitOfWork(ApplicationDbContext db)
 {
     _db           = db;
     Gigs          = new GigRepo(_db);
     Attendances   = new AttendanceRepo(_db);
     Genres        = new GenreRepo(_db);
     Followings    = new FollowingRepo(_db);
     Notifications = new NotificationRepo(_db);
 }
Esempio n. 4
0
        public ActionResult DeleteConfirm(int id)
        {
            Responses responses = AttendanceRepo.Delete(id);

            if (responses.Success)
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, message = "Error msg" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context        = context;
     Patients        = new PatientRepo(context);
     Appointments    = new AppointmentRepo(context);
     Attandences     = new AttendanceRepo(context);
     Cities          = new CityRepo(context);
     Doctors         = new DoctorRepo(context);
     Specializations = new SpecializationRepo(context);
     Users           = new ApplicationUserRepo(context);
 }
Esempio n. 6
0
 public ActionResult Edit(AttendanceViewModel model)
 {
     if (ModelState.IsValid)
     {
         Responses responses = AttendanceRepo.Update(model);
         if (responses.Success)
         {
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = "Error msg" }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet));
 }
Esempio n. 7
0
 public ActionResult Create(AttendanceViewModel model)
 {
     if (ModelState.IsValid)
     {
         Responses responses = AttendanceRepo.Update(model);
         if (responses.Success)
         {
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = responses.Message }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new { success = false, message = ModelState.ToString() }, JsonRequestBehavior.AllowGet));
 }
Esempio n. 8
0
        private void ReloadList()
        {
            RefreshList();

            if (SelectedClassID > 0 && !string.IsNullOrEmpty(SelectedDate))
            {
                var atndList = AttendanceRepo.GetClassAttendance(SelectedClassID, SessionID, SelectedSectionID, SelectedDate);
                var stdlist  = AttendanceRepo.GetStudentsListForAttendance(SelectedClassID, SelectedSectionID);
                ClassAttendanceList = MergeLists(atndList, stdlist);

                FormMode = FormModes.Edit;
                if (ClassAttendanceList.Count() == 0)
                {
                    FormMode            = FormModes.New;
                    ClassAttendanceList = null;
                }
            }
        }
Esempio n. 9
0
 private void btnAttendanceSave_Click(object sender, RoutedEventArgs e)
 {
     foreach (var item in ClassAttendanceList)
     {
         item.created_by = item.updated_by = UserID;
         if (item.isNew)
         {
             item.SessionID      = SessionID;
             item.AttendanceDate = SelectedDate;
             item.SectionID      = SelectedSectionID;
             AttendanceRepo.Insert(item);
         }
         else
         {
             AttendanceRepo.Update(item);
         }
     }
     ReloadList();
 }
        public FrmAttendance(int courseId, string courseName)
        {
            if (LoggedInUser.UserId == 0)
            {
                FrmLogin login = new FrmLogin();
                login.Show();
            }

            InitializeComponent();
            MaterialSkinBase.InitializeForm(this);
            lblTodaysDate.Text = DateTime.Now.ToLongDateString();
            lblCourse.Text     = courseName;
            lblUsername.Text   = LoggedInUser.Fullname;

            _semesterRepo   = new SessionSemesterRepo();
            _attendanceRepo = new AttendanceRepo();
            _studentRepo    = new StudentRepo();
            _bioRepo        = new BiometricsRepo();
            this.courseId   = courseId;
        }
Esempio n. 11
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string username = usernameField.Text;
            string password = passwordField.Text;

            if (employeeService == null)
            {
                TaskRepo       taskRepo       = new TaskRepo();
                AttendanceRepo attendanceRepo = new AttendanceRepo();
                //RepoCompany repoCompany = new RepoCompany();
                employeeService = new EmployeeService(taskRepo, attendanceRepo, RepoCompany.Instance);
            }
            try
            {
                User user = companyService.ValidateCredentials(username, password);
                if (user.Position.Equals("employee"))
                {
                    Employee employee = companyService.GetEmployeeByUser(username, password);

                    EmployeeView employeeView = new EmployeeView(employeeService, user);
                    companyService.addObserver(employeeView);

                    employeeView.Show();
                }
                if (user.Position.Equals("manager"))
                {
                    managerView = new ManagerView(companyService);
                    manager     = new Manager();
                    employeeService.addObserver(managerView);

                    managerView.Show();
                }
            }
            catch (ServiceException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void SetList()
        {
            string sdate = "", edate = "";

            SelectedDate.GetStartEndDate(ref sdate, ref edate);
            var atnds = AttendanceRepo.GetStudentAttendance(SelectedStudenID, SelectedClassID, sdate, edate);
            int count = SelectedDate.GetDaysInMonth();

            IEnumerable <StudentAttendance> _list = null;

            for (int i = 1; i <= count; i++)
            {
                bool isExisted         = false;
                StudentAttendance temp = null;
                foreach (var item in atnds)
                {
                    if (i == item.DayNumber)
                    {
                        item.isExisted = true;
                        temp           = item;
                        isExisted      = true;
                        break;
                    }
                }
                if (!isExisted)
                {
                    temp = new StudentAttendance()
                    {
                        isPresent = false, DayNumber = i, DayName = sdate.AddDaysInDate(i).GetDayName()
                    };
                }

                _list = _list.Add(temp);
            }
            StudentAttendanceList = _list;
        }
 // GET api/<controller>
 public IEnumerable <AttendanceViewModel> Get()
 {
     return(AttendanceRepo.Get());
 }
Esempio n. 14
0
 //DETAILS
 public ActionResult Details(int id)
 {
     return(View(AttendanceRepo.GetById(id)));
 }
 // GET api/<controller>/5
 public AttendanceViewModel Get(int id)
 {
     return(AttendanceRepo.GetById(id));
 }
Esempio n. 16
0
 //DELETE
 public ActionResult Delete(int id)
 {
     return(View("_Delete", AttendanceRepo.GetById(id)));
 }
Esempio n. 17
0
 public ActionResult List()
 {
     return(View("_List", AttendanceRepo.Get()));
 }
Esempio n. 18
0
 //EDIT
 public ActionResult Edit(int id)
 {
     return(View("_Edit", AttendanceRepo.GetById(id)));
 }
 public AttendanceViewModel Get(string badgeId)
 {
     return(AttendanceRepo.GetByBadgeId(badgeId));
 }
Esempio n. 20
0
        private IEnumerable <ClassAttendanceList> GetList()
        {
            int    days = SelectedDate.GetDaysInMonth();
            string sData = "", eDate = "";

            SelectedDate.GetStartEndDate(ref sData, ref eDate);

            var atndList = AttendanceRepo.GetClassAttendance(SelectedClassID, SessionID, SelectedSectionID, sData, eDate);
            var stdList  = AttendanceRepo.GetStudentsListForAttendance(SelectedClassID, SelectedSectionID);

            IEnumerable <ClassAttendanceList> newList = null;

            foreach (var item in stdList)
            {
                var atnds = from atnd in atndList
                            where atnd.StudentID == item.StudentID
                            select atnd;

                var atdStd = new ClassAttendanceList()
                {
                    StudentName = item.StudentName, StudentID = item.StudentID
                };

                foreach (var atnd in atnds)
                {
                    int    day       = atnd.AttendanceDate.GetDayOfMonth();
                    string isPresent = atnd.isPresent ? "p" : "A";
                    switch (day)
                    {
                    case 1:
                        atdStd.Day01 = isPresent;
                        break;

                    case 2:
                        atdStd.Day02 = isPresent;
                        break;

                    case 3:
                        atdStd.Day03 = isPresent;
                        break;

                    case 4:
                        atdStd.Day04 = isPresent;
                        break;

                    case 5:
                        atdStd.Day05 = isPresent;
                        break;

                    case 6:
                        atdStd.Day06 = isPresent;
                        break;

                    case 7:
                        atdStd.Day07 = isPresent;
                        break;

                    case 8:
                        atdStd.Day08 = isPresent;
                        break;

                    case 9:
                        atdStd.Day09 = isPresent;
                        break;

                    case 10:
                        atdStd.Day10 = isPresent;
                        break;

                    case 11:
                        atdStd.Day11 = isPresent;
                        break;

                    case 12:
                        atdStd.Day12 = isPresent;
                        break;

                    case 13:
                        atdStd.Day14 = isPresent;
                        break;

                    case 14:
                        atdStd.Day14 = isPresent;
                        break;

                    case 15:
                        atdStd.Day15 = isPresent;
                        break;

                    case 16:
                        atdStd.Day16 = isPresent;
                        break;

                    case 17:
                        atdStd.Day17 = isPresent;
                        break;

                    case 18:
                        atdStd.Day18 = isPresent;
                        break;

                    case 19:
                        atdStd.Day19 = isPresent;
                        break;

                    case 20:
                        atdStd.Day20 = isPresent;
                        break;

                    case 21:
                        atdStd.Day21 = isPresent;
                        break;

                    case 22:
                        atdStd.Day22 = isPresent;
                        break;

                    case 23:
                        atdStd.Day23 = isPresent;
                        break;

                    case 24:
                        atdStd.Day24 = isPresent;
                        break;

                    case 25:
                        atdStd.Day25 = isPresent;
                        break;

                    case 26:
                        atdStd.Day26 = isPresent;
                        break;

                    case 27:
                        atdStd.Day27 = isPresent;
                        break;

                    case 28:
                        atdStd.Day28 = isPresent;
                        break;

                    case 29:
                        atdStd.Day29 = isPresent;
                        break;

                    case 30:
                        atdStd.Day30 = isPresent;
                        break;

                    case 31:
                        atdStd.Day31 = isPresent;
                        break;
                    }
                }
                newList = newList.Add(atdStd);
            }
            return(newList);
        }
 // POST api/<controller>
 public Responses Post([FromBody] AttendanceViewModel entity)
 {
     return(AttendanceRepo.Update(entity));
 }
 public EmployeeService(TaskRepo taskRepo, AttendanceRepo attendanceRepo, RepoCompany rc)
 {
     TaskRepo       = taskRepo;
     AttendanceRepo = attendanceRepo;
     RepoCompany    = rc;
 }
 // PUT api/<controller>/5
 public Responses Put(int id, [FromBody] AttendanceViewModel entity)
 {
     entity.Id = id;
     return(AttendanceRepo.Update(entity));
 }
 // DELETE api/<controller>/5
 public Responses Delete(int id)
 {
     return(AttendanceRepo.Delete(id));
 }
Esempio n. 25
0
 public FrmAttendance()
 {
     InitializeComponent();
     _repo = new AttendanceRepo();
 }