Esempio n. 1
0
        // GET: Attendance/Edit/5
        public async Task <ActionResult> Edit(Guid?id)
        {
            Permissions p    = new Permissions();
            bool        auth = p.isGranted(User.Identity.Name, this.ControllerContext.RouteData.Values["controller"].ToString() + "_" + this.ControllerContext.RouteData.Values["action"].ToString());

            if (!auth)
            {
                return(new ViewResult()
                {
                    ViewName = "Unauthorized"
                });
            }
            else
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                AttendanceModels attendanceModels = await db.Attendance.FindAsync(id);

                if (attendanceModels == null)
                {
                    return(HttpNotFound());
                }

                ViewBag.listClient    = new SelectList(db.Clients.Where(x => x.Active == true).OrderBy(x => x.CompanyName).ToList(), "Id", "CompanyName");
                ViewBag.listEmployee  = new SelectList(db.User.OrderBy(x => x.FullName).ToList(), "Id", "FullName");
                ViewBag.listAttStatus = new SelectList(db.AttStatus.Where(x => x.Active == true).OrderBy(x => x.Name).ToList(), "Id", "Name");
                ViewBag.listWorkshift = new SelectList(db.Workshift.Where(x => x.UserAccounts_Id == attendanceModels.UserAccounts_Id && x.Clients_Id == attendanceModels.Clients_Id).OrderBy(x => x.Name).ToList(), "Id", "Name");
                return(View(attendanceModels));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> DeleteConfirmed(Guid id)
        {
            AttendanceModels attendanceModels = await db.Attendance.FindAsync(id);

            db.Attendance.Remove(attendanceModels);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public List <AttendanceModels> getAttedenceL(int SchoolId, int StdID, int StudID, int Type)
        {
            List <AttendanceModels> attendanceModelsList = new List <AttendanceModels>();
            AttendanceModels        attedanceModels      = new AttendanceModels();

            attedanceModels.SchoolID   = SchoolId;
            attedanceModels.StandardID = StdID;
            attedanceModels.StduentID  = StudID;
            attedanceModels.Type       = Type;
            if (!string.IsNullOrEmpty(Convert.ToString(attedanceModels.SchoolID)))
            {
                DataTable dtSubjectList = new DataTable();
                dtSubjectList = attedanceModels.GetAttedenceList();
                if (dtSubjectList.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtSubjectList.Rows)
                    {
                        AttendanceModels attedanceModelsTypes = new AttendanceModels();

                        attedanceModelsTypes.ID = Convert.ToInt32(dr["id"]);

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["exam_id"])))
                        {
                            attedanceModelsTypes.SchoolID = Convert.ToInt32(dr["exam_id"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["standard_id"])))
                        {
                            attedanceModelsTypes.StandardID = Convert.ToInt32(dr["standard_id"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["student_id"])))
                        {
                            attedanceModelsTypes.StduentID = Convert.ToInt32(dr["student_id"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["reason"])))
                        {
                            attedanceModelsTypes.Reason = Convert.ToString(dr["reason"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["absent_on"])))
                        {
                            attedanceModelsTypes.AttedendanceDate = Convert.ToDateTime(dr["absent_on"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["taken_by"])))
                        {
                            attedanceModelsTypes.AttedenceMarkedBy = Convert.ToString(dr["taken_by"]);
                        }

                        attendanceModelsList.Add(attedanceModelsTypes);
                    }
                }
            }
            return(attendanceModelsList);
        }
        public HttpResponseMessage DeleteAttedence(int userID)
        {
            bool             Status           = false;
            AttendanceModels attendanceModels = new AttendanceModels();

            attendanceModels.UID = userID;
            Status = attendanceModels.DeleteAttendance();
            return(Request.CreateResponse(HttpStatusCode.OK, Status));
        }
        public List <AttendanceModels> GetResultL(int SchoolId, int UID)
        {
            List <AttendanceModels> attendanceModelsList = new List <AttendanceModels>();
            AttendanceModels        attedanceModels      = new AttendanceModels();

            attedanceModels.SchoolID = SchoolId;
            attedanceModels.UID      = UID;
            if (!string.IsNullOrEmpty(Convert.ToString(attedanceModels.SchoolID)))
            {
                DataTable dtSubjectList = new DataTable();
                dtSubjectList = attedanceModels.GetStudentResult();
                if (dtSubjectList.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtSubjectList.Rows)
                    {
                        AttendanceModels attedanceModelsTypes = new AttendanceModels();
                        if (!string.IsNullOrEmpty(Convert.ToString(dr["Subject"])))
                        {
                            attedanceModelsTypes.Subject = Convert.ToString(dr["Subject"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["ChapterName"])))
                        {
                            attedanceModelsTypes.Chapter = Convert.ToString(dr["ChapterName"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["Marks"])))
                        {
                            attedanceModelsTypes.Marks = Convert.ToInt32(dr["Marks"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["ExamTime"])))
                        {
                            attedanceModelsTypes.TotalTime = Convert.ToString(dr["ExamTime"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["ExamFinished"])))
                        {
                            attedanceModelsTypes.TimeTaken = Convert.ToString(dr["ExamFinished"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["CreatedOn"])))
                        {
                            attedanceModelsTypes.ExamDate = Convert.ToString(dr["CreatedOn"]);
                        }

                        attendanceModelsList.Add(attedanceModelsTypes);
                    }
                }
            }
            return(attendanceModelsList);
        }
        public HttpResponseMessage InsertAttedence(int SchoolID, int StandID, int studID, string reason, int userID)
        {
            string           Status           = string.Empty;
            AttendanceModels attendanceModels = new AttendanceModels();

            attendanceModels.SchoolID   = SchoolID;
            attendanceModels.StandardID = StandID;
            attendanceModels.StduentID  = studID;
            attendanceModels.Reason     = reason;
            attendanceModels.UID        = userID;
            Status = attendanceModels.InsertAttendance();
            return(Request.CreateResponse(HttpStatusCode.OK, Status));
        }
Esempio n. 7
0
        // GET: Attendance/Details/5
        public async Task <ActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttendanceModels attendanceModels = await db.Attendance.FindAsync(id);

            if (attendanceModels == null)
            {
                return(HttpNotFound());
            }
            return(View(attendanceModels));
        }
Esempio n. 8
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,UserAccounts_Id,TimestampIn,TimestampOut,Notes,Flag1,Flag2,Approved,Workshifts_DayOfWeek,Workshifts_Start,Workshifts_DurationMinutes,EffectiveTimestampIn,EffectiveTimestampOut,Clients_Id,Rejected,PayrollItems_Id,AttendanceStatuses_Id,Workshifts_Id,AttendancePayRates_Id,AttendancePayRates_Amount")] AttendanceModels attendanceModels)
        {
            if (ModelState.IsValid)
            {
                attendanceModels.Workshifts_Start           = attendanceModels.EffectiveTimestampIn;
                attendanceModels.Workshifts_DurationMinutes = (int)attendanceModels.EffectiveTimestampOut.Subtract(attendanceModels.EffectiveTimestampIn).TotalMinutes;
                db.Entry(attendanceModels).State            = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.listClient    = new SelectList(db.Clients.Where(x => x.Active == true).OrderBy(x => x.CompanyName).ToList(), "Id", "CompanyName");
            ViewBag.listEmployee  = new SelectList(db.User.OrderBy(x => x.FullName).ToList(), "Id", "FullName");
            ViewBag.listAttStatus = new SelectList(db.AttStatus.Where(x => x.Active == true).OrderBy(x => x.Name).ToList(), "Id", "Name");
            ViewBag.listWorkshift = new SelectList(db.Workshift.Where(x => x.UserAccounts_Id == attendanceModels.UserAccounts_Id && x.Clients_Id == attendanceModels.Clients_Id).OrderBy(x => x.Name).ToList(), "Id", "Name");
            return(View(attendanceModels));
        }
Esempio n. 9
0
        public async Task <ActionResult> Create([Bind(Include = "Id,UserAccounts_Id,TimestampIn,TimestampOut,Notes,Flag1,Flag2,Approved,Workshifts_DayOfWeek,Workshifts_Start,Workshifts_DurationMinutes,EffectiveTimestampIn,EffectiveTimestampOut,Clients_Id,Rejected,PayrollItems_Id,AttendanceStatuses_Id,Workshifts_Id,AttendancePayRates_Id,AttendancePayRates_Amount")] AttendanceModels attendanceModels)
        {
            if (ModelState.IsValid)
            {
                attendanceModels.Id = Guid.NewGuid();
                attendanceModels.Workshifts_Start           = attendanceModels.EffectiveTimestampIn;
                attendanceModels.Workshifts_DurationMinutes = (int)attendanceModels.EffectiveTimestampOut.Subtract(attendanceModels.EffectiveTimestampIn).TotalMinutes;
                attendanceModels.AttendancePayRates_Amount  = attendanceModels.AttendancePayRates_Amount == null ? 0 : attendanceModels.AttendancePayRates_Amount;
                db.Attendance.Add(attendanceModels);
                await db.SaveChangesAsync();

                ViewBag.listClient    = new SelectList(db.Clients.Where(x => x.Active == true).OrderBy(x => x.CompanyName).ToList(), "Id", "CompanyName");
                ViewBag.listEmployee  = new SelectList(db.User.OrderBy(x => x.FullName).ToList(), "Id", "FullName");
                ViewBag.listAttStatus = new SelectList(db.AttStatus.Where(x => x.Active == true).OrderBy(x => x.Name).ToList(), "Id", "Name");
                ViewBag.StatusAction  = "Submit";
                return(View());
                //return RedirectToAction("Create");
            }

            ViewBag.listClient    = new SelectList(db.Clients.Where(x => x.Active == true).OrderBy(x => x.CompanyName).ToList(), "Id", "CompanyName");
            ViewBag.listEmployee  = new SelectList(db.User.OrderBy(x => x.FullName).ToList(), "Id", "FullName");
            ViewBag.listAttStatus = new SelectList(db.AttStatus.Where(x => x.Active == true).OrderBy(x => x.Name).ToList(), "Id", "Name");
            return(View(attendanceModels));
        }
        public List <AttendanceModels> getStudentsL(int StdID, int Type, int UserID)
        {
            List <AttendanceModels> attendanceModelsList = new List <AttendanceModels>();
            AttendanceModels        attedanceModels      = new AttendanceModels();

            attedanceModels.StandardID       = StdID;
            attedanceModels.Type             = Type;
            attedanceModels.NominattedUserID = UserID;
            if (!string.IsNullOrEmpty(Convert.ToString(attedanceModels.SchoolID)))
            {
                DataTable dtSubjectList = new DataTable();
                dtSubjectList = attedanceModels.GetStudentList();
                if (dtSubjectList.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtSubjectList.Rows)
                    {
                        AttendanceModels attedanceModelsTypes = new AttendanceModels();
                        if (!string.IsNullOrEmpty(Convert.ToString(dr["UID"])))
                        {
                            attedanceModelsTypes.UID = Convert.ToInt32(dr["UID"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["exam_id"])))
                        {
                            attedanceModelsTypes.SchoolID = Convert.ToInt32(dr["exam_id"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["first_name"])))
                        {
                            attedanceModelsTypes.FirstName = Convert.ToString(dr["first_name"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["last_name"])))
                        {
                            attedanceModelsTypes.LastName = Convert.ToString(dr["last_name"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["standard"])))
                        {
                            attedanceModelsTypes.StandardID = Convert.ToInt32(dr["standard"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["phone_no"])))
                        {
                            attedanceModelsTypes.PhoneNo = Convert.ToString(dr["phone_no"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["e_mail"])))
                        {
                            attedanceModelsTypes.Email = Convert.ToString(dr["e_mail"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["postal_code"])))
                        {
                            attedanceModelsTypes.PostalCode = Convert.ToString(dr["postal_code"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["dob"])))
                        {
                            attedanceModelsTypes.DateOfBirth = Convert.ToString(dr["dob"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["country"])))
                        {
                            attedanceModelsTypes.Country = Convert.ToString(dr["country"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["state"])))
                        {
                            attedanceModelsTypes.State = Convert.ToString(dr["state"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["profile_picture"])))
                        {
                            attedanceModelsTypes.ProfilePicture = Convert.ToString(dr["profile_picture"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["user_type"])))
                        {
                            attedanceModelsTypes.UserType = Convert.ToInt32(dr["user_type"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["user_type"])))
                        {
                            attedanceModelsTypes.Address = Convert.ToString(dr["address"]).ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["leader"])))
                        {
                            attedanceModelsTypes.IsLeader = Convert.ToBoolean(dr["leader"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["DisplayLeaderList"])))
                        {
                            attedanceModelsTypes.DisplayLeaderSection = Convert.ToBoolean(dr["DisplayLeaderList"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["nominated_student_id"])))
                        {
                            attedanceModelsTypes.NominattedUserID = Convert.ToInt32(dr["nominated_student_id"]);
                        }

                        if (!string.IsNullOrEmpty(Convert.ToString(dr["nominated_student_name"])))
                        {
                            attedanceModelsTypes.NominattedUsername = Convert.ToString(dr["nominated_student_name"]);
                        }

                        attendanceModelsList.Add(attedanceModelsTypes);
                    }
                }
            }
            return(attendanceModelsList);
        }