Beispiel #1
0
        public async Task <IActionResult> PutAttendanceDetails(int id, AttendanceDetails attendanceDetails)
        {
            if (id != attendanceDetails.AttendanceID)
            {
                return(BadRequest());
            }

            _context.Entry(attendanceDetails).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AttendanceDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <ActionResult <AttendanceDetails> > PostAttendanceDetails(AttendanceDetails attendanceDetails)
        {
            _context.AttendanceDetails.Add(attendanceDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAttendanceDetails", new { id = attendanceDetails.AttendanceID }, attendanceDetails));
        }
        public void OverwriteModeOfMarks_OnAttendanceRegister()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var registerView = new AttendanceSearchPanel();

            registerView.ClickRadioButton("Week");

            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            AttendanceDetails editMarksPage = group.EditMarksSearchButton();

            //Vertical Cursor Orientation in Preserve Mode
            EditMarksGridHelper grid = new EditMarksGridHelper();

            grid.ClickOrientationbutton(grid.preserveButton);
            grid.ClickOrientationbutton(grid.overwriteMode);
            EditMarksGridHelper.ClickFirstCellofColumn("3");
            EditMarksGridHelper.GetEditor().SendKeys("L");
            EditMarksGridHelper.GetEditor().SendKeys("L");
            EditMarksGridHelper.GetEditor().SendKeys("B");
            EditMarksGridHelper.GetEditor().SendKeys("C");
            EditMarksGridHelper.GetEditor().SendKeys("C");
            EditMarksGridHelper.GetEditor().SendKeys("D");
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Reason,Status")] AttendanceDetails attendanceDetails)
        {
            if (id != attendanceDetails.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attendanceDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttendanceDetailsExists(attendanceDetails.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(attendanceDetails));
        }
        public void AdditionalColumnCountForAdmin()
        {
            Select_Year_And_NavigateToEditMarksScreen();
            AttendanceDetails    editMarksGrid     = new AttendanceDetails();
            AdditionalCoulmnPage additionalColumns = editMarksGrid.ClickAdditionalColumn();

            Assert.IsTrue(additionalColumns.GetDialogAdditionalColumnCount() == 12);
        }
        public void ShouldHaveSummarySection()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails editMarksPage = group.EditMarksSearchButton();

            Assert.IsTrue(editMarksPage.IsSummarySectionDisplayed());
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("ID,Reason,Status")] AttendanceDetails attendanceDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(attendanceDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(attendanceDetails));
        }
        public void ShouldHavePupilLogLinkAndAttendanceNoteOnPLogPopUp()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails    editMarksPage = group.EditMarksSearchButton();
            EditMarksPupilDetail plog          = editMarksPage.ClickPupilLink();

            Assert.IsTrue(plog.viewPlogNote.Displayed && plog.attendanceNote.Displayed);
        }
Beispiel #9
0
        internal static IList <AttendanceDetails> GetSummaryReport(string startDate, string endDate)
        {
            DataTable result             = new DataTable();
            List <AttendanceDetails> res = new List <AttendanceDetails>();

            string query = " SELECT " +
                           " eid_base_data.PROJECTPRIMARYCODE as 'PPCode'," +
                           " eid_base_data.WEBACCESSPIN as 'UserId'," +
                           " eid_base_data.TITLEPREFIX as 'Title'," +
                           " eid_base_data.SURNAME as 'Surname'," +
                           " eid_base_data.FIRSTNAME as 'First_Name'," +
                           " eid_base_data.MIDDLENAME as 'Middle_Name'," +
                           " eid_attendance_log.ClockDate as 'Date'," +
                           " COUNT(eid_attendance_log.ClockTime) as 'Clock_Count'," +
                           " MIN(eid_attendance_log.ClockTime) as 'Clock_In'," +
                           " MAX(eid_attendance_log.ClockTime) as 'Clock_Out'," +
                           " TIMEDIFF(MAX(eid_attendance_log.TransactionDateTime), MIN(eid_attendance_log.TransactionDateTime)) as 'Time_Spent'" +
                           " FROM" +
                           " eid_attendance_log" +
                           " LEFT JOIN eid_base_data ON eid_attendance_log.userPrimaryCode = eid_base_data.PROJECTPRIMARYCODE" +
                           string.Format(" WHERE eid_attendance_log.ClockDate>= '{0}' AND eid_attendance_log.ClockDate <= '{1}'", startDate, endDate) +
                           " GROUP BY" +
                           " eid_attendance_log.userPrimaryCode, eid_attendance_log.ClockDate" +
                           " ORDER BY eid_attendance_log.TransactionDateTime";

            MySqlDataAdapter Adapter = new MySqlDataAdapter(query, myConn);

            Adapter.Fill(result);

            foreach (DataRow row in result.Rows)
            {
                AttendanceDetails obj = new AttendanceDetails
                {
                    UserId             = row["UserId"].ToString(),
                    Title              = row["Title"].ToString(),
                    Surname            = row["Surname"].ToString(),
                    FirstName          = row["First_Name"].ToString(),
                    MiddleName         = row["Middle_Name"].ToString(),
                    ProjectPrimaryCode = row["PPCode"].ToString(),
                    Date       = ((DateTime)row["Date"]).ToString("yyyy-MMM-dd"),
                    ClockCount = row["Clock_Count"].ToString(),
                    ClockIn    = row["Clock_In"].ToString(),
                    ClockOut   = row["Clock_Out"].ToString(),
                    TimeSpent  = null,
                    Ministry   = FindUserMinistry(row["PPCode"].ToString(), Settings.Default.CDataField1),
                };

                res.Add(obj);
            }

            return(res.OrderBy(x => x.ProjectPrimaryCode).ToList());
        }
        public void VerifyMaxLengthOfNoteAndTitleField()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails    editMarksPage = group.EditMarksSearchButton();
            EditMarksPupilDetail plog          = editMarksPage.ClickPupilLink();

            plog.ClickOnAttendanceNoteButton();
            Assert.IsTrue(plog.attendanceNoteTextArea.GetAttribute("data-rule-maxlength") == "4000" && plog.attendanceTitleArea.GetAttribute("maxlength") == "200");
        }
        public void ShouldDisplayAdditionalColumnDialog()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();

            //Select Class and Year Group
            var search_filter = new AttendanceSearchPanel();

            search_filter.Select("Year Group", "Year 1", "Year 2");
            AttendanceDetails editMarksGrid = search_filter.EditMarksSearchButton();

            // Check if the Identifier button is displayed
            Assert.IsTrue(editMarksGrid.additionalColumnButton.Displayed);
        }
        public void ShouldRedirectToPupilLogPage_OnClickOfPupilLogLink()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails    editMarksPage = group.EditMarksSearchButton();
            EditMarksPupilDetail plog          = editMarksPage.ClickPupilLink();

            plog.ClickViewPupilLogLink();
            Assert.IsTrue(plog.pupilLogPage.Displayed);
        }
        public void ShouldHaveMandatoryNoteField()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails    editMarksPage = group.EditMarksSearchButton();
            EditMarksPupilDetail plog          = editMarksPage.ClickPupilLink();

            plog.ClickOnAttendanceNoteButton();
            plog.AttendanceNoteTextSave();
            Assert.IsTrue(plog.attendanceNotevalidationWarning.Displayed);
        }
        public void ShouldDisplayAdditionalColumns_OnClickOfAdditionalColumnOKButton()
        {
            Select_Year_And_NavigateToEditMarksScreen();
            AttendanceDetails    editMarksGrid     = new AttendanceDetails();
            AdditionalCoulmnPage additionalColumns = editMarksGrid.ClickAdditionalColumn();

            additionalColumns.ClickParentCheckboxes();
            additionalColumns.ClickOkButton();
            // Check the columns are added to the grid
            bool DOBColumn    = SeleniumHelper.FindElement(EditMarksElements.GridColumns.DateOfBirth).Displayed;
            bool genderColumn = SeleniumHelper.FindElement(EditMarksElements.GridColumns.Gender).Displayed;

            Assert.IsTrue(DOBColumn && genderColumn);
        }
        public void VerifySummarySectionRows()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails editMarksPage = group.EditMarksSearchButton();
            var summaryRows = editMarksPage.SummarySection().ToList();

            Assert.AreEqual(summaryRows[0].Text, "Total Present + AEA");
            Assert.AreEqual(summaryRows[1].Text, "Total Unrecorded");
            Assert.AreEqual(summaryRows[2].Text, "Total Authorised Absence");
            Assert.AreEqual(summaryRows[3].Text, "Total Unauthorised Absence");
        }
        public void VerifyWeekViewOfRegister()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var registerView = new AttendanceSearchPanel();

            registerView.ClickRadioButton("Week");
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            AttendanceDetails editMarksPage = group.EditMarksSearchButton();

            IWebElement grid    = SeleniumHelper.Get(By.CssSelector("[data-section-id=\"searchResults\"]"));
            var         columns = grid.FindElements(By.CssSelector("[data-menu-column-id]"));

            // Only the Pupil Name column And Single Day Sessions should be present in the grid
            Assert.IsTrue(columns.Count == 12);
        }
        public void ShouldRemoveColumnsinGrid_OnClickOfClearSelection_AdditionalColumnOKButton()
        {
            Select_Year_And_NavigateToEditMarksScreen();
            AttendanceDetails    editMarksGrid     = new AttendanceDetails();
            AdditionalCoulmnPage additionalColumns = editMarksGrid.ClickAdditionalColumn();

            additionalColumns.ClickPersonalDetailsCheckbox();
            AttendanceDetails    editMarksGrid1    = additionalColumns.ClickOkButton();
            AdditionalCoulmnPage additionalColumn1 = editMarksGrid1.ClickAdditionalColumn();

            additionalColumn1.ClearAdditionalColumnSelection();
            additionalColumn1.ClickOkButton();

            IWebElement grid    = SeleniumHelper.Get(By.CssSelector("[data-section-id=\"searchResults\"]"));
            var         columns = grid.FindElements(By.CssSelector("[data-menu-column-id]"));

            // Only the Pupil Name and Session columns should be present in the grid
            Assert.IsTrue(columns.Count == 3);
        }
        public void CreateAttendaceNoteWithoutPinNote()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            group.EnterDate(SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            AttendanceDetails    editMarksPage = group.EditMarksSearchButton();
            EditMarksPupilDetail plog          = editMarksPage.ClickPupilLink();

            plog.ClickOnAttendanceNoteButton();
            plog.EnterTextInAttendanceNoteTextArea("Test Note For Attendance Plog");
            plog.EnterTitle("AttendanceNote");
            AttendanceDetails    editMarksPage1 = plog.AttendanceNoteTextSave();
            EditMarksPupilDetail plog1          = editMarksPage1.ClickPupilLink();

            plog1.ClickViewPupilLogLink();
            Assert.IsTrue(plog.AttendanceNoteOnPupilLogPage.Displayed);
        }
        public void VerifyFloodFillForMealType_InEditMarksToolBar()
        {
            //login with Dinner Money feature bee on
            string[] featureList = { "Dinner Money Settings" };
            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator, featureList);

            Wait.WaitForDocumentReady();
            SeleniumHelper.NavigateQuickLink("Edit Marks");
            AttendanceNavigations.ClickDayOrWeekRadioButton("Day");
            AttendanceNavigations.SelectClass("6A");
            AttendanceNavigations.ClickEditMarksSearchButton();

            Wait.WaitForDocumentReady();
            SeleniumHelper.Sleep(10);

            AttendanceDetails editMarksGrid = new AttendanceDetails();

            SeleniumHelper.FindAndClick(By.CssSelector("tr[section='header']:nth-child(3) td[column='3']"));
            SeleniumHelper.Sleep(2);
            editMarksGrid.ClickMealColumn();

            // check Overwrite existing values check box
            SeleniumHelper.FindAndClick(By.CssSelector(".grid-menu:nth-child(9) .checkbox input"));

            //select H (Home) meal choice
            SeleniumHelper.FindElement(By.XPath("//*[@id='screen-viewer']/div/div[2]/div/div/div[2]/div[7]/div[3]/div[2]/div[1]/div/select")).SelectByText("H");

            //click column button
            SeleniumHelper.FindAndClick(By.XPath("//*[@id='screen-viewer']/div/div[2]/div/div/div[2]/div[7]/div[3]/div[2]/div[3]/div/button[1]"));

            List <IWebElement> cells = EditMarksGridHelper.FindAllcells();
            var cellValues           = cells.Skip(1).FirstOrDefault().Text;

            string[]             stringSeparators = new string[] { "\r\n" };
            IEnumerable <string> distinctMealCode = cellValues.Split(stringSeparators, StringSplitOptions.None).Distinct();

            //if flood fill is successful, all the cells would have been populated with 'H', so distinctMealCode collection should have only one
            //item 'H'
            Assert.IsTrue(distinctMealCode.Count() == 1 || distinctMealCode.FirstOrDefault() == "H");
        }
        public void PreseveModeOfMarks_OnAttendanceRegister()
        {
            AttendanceNavigations.NavigateToEditMarksMenuPage();
            var registerView = new AttendanceSearchPanel();

            registerView.ClickRadioButton("Week");

            var group = new AttendanceSearchPanel();

            group.Select("Year Group", "Year 1", "Year 2");
            AttendanceDetails editMarksPage = group.EditMarksSearchButton();

            var editMarksTripletPage = new EditMarksTriplet();
            var editPage             = editMarksTripletPage.SearchCriteria.Search <EditMarksPage>();

            var editmarkTable = editPage.Marks;
            IEnumerable <SchoolAttendanceCode> getHolidays = Queries.GetAttendanceNotRequiredCodes();
            List <string> codes = getHolidays.Select(x => x.Code).ToList <string>();

            if (codes.Contains(editmarkTable[1][2].Text))
            {
                Console.WriteLine("Marks can't be overwritten on Holidays");
                return;
            }

            //Vertical Cursor Orientation in Preserve Mode
            EditMarksGridHelper grid = new EditMarksGridHelper();

            grid.ClickOrientationbutton(grid.preserveButton);
            grid.ClickOrientationbutton(grid.preserveMode);
            EditMarksGridHelper.ClickFirstCellofColumn("3");
            EditMarksGridHelper.GetEditor().SendKeys("L");
            EditMarksGridHelper.GetEditor().SendKeys("L");
            EditMarksGridHelper.GetEditor().SendKeys("B");
            EditMarksGridHelper.GetEditor().SendKeys("C");
            EditMarksGridHelper.GetEditor().SendKeys("C");
            EditMarksGridHelper.GetEditor().SendKeys("D");
        }
        public EmployeeAttendance GetEmployeeAttendance(EmployeeAttendance model, string EmployeeID = "")
        {
            EmployeeSalary                  _EmployeeSalaryModel = new EmployeeSalary();
            EmployeeSalary                  _EmployeeSalary      = new EmployeeSalary();
            DALFee                          dal           = new DALFee(ConStr);
            List <EmployeeMaster>           _employeeList = new List <EmployeeMaster>();
            List <EmployeeAttendanceRecord> ObjEmployeeAttendanceRecordList = new List <EmployeeAttendanceRecord>();
            EmployeeAttendanceRecord        objEmployeeAttendanceRecord     = null;
            EmployeeMaster                  objEmployeeMaster = null;
            AttendanceDetails               objAttendanceDetails = null;
            int Month = 0, Year = 0;

            try
            {
                #region SET properties to Get Employee Salary status
                _EmployeeSalaryModel.SchoolID      = model.SchoolID;
                _EmployeeSalaryModel.FinancialYear = model.FinancialYear;
                _EmployeeSalaryModel.MonthYear     = model.MonthYear;
                #endregion SET properties to Get Employee Salary status
                model.MonthYear = string.IsNullOrEmpty(model.MonthYear) ? DateTime.Now.ToString("MMM/yyyy") : model.MonthYear;
                Month           = Convert.ToInt32(Convert.ToDateTime(model.MonthYear).ToString("MM"));
                Year            = Convert.ToInt32(Convert.ToDateTime(model.MonthYear).ToString("yyyy"));
                _employeeList   = !string.IsNullOrEmpty(EmployeeID) ? dal.GetEmployeeList(1, model.SchoolID).Where(x => x.ISACTIVE == true && Convert.ToString(x.EMP_ID) == EmployeeID).ToList() : dal.GetEmployeeList(1, model.SchoolID).Where(x => x.ISACTIVE == true).ToList();
                foreach (var emp in _employeeList)
                {
                    objEmployeeAttendanceRecord = new EmployeeAttendanceRecord();
                    objEmployeeMaster           = new EmployeeMaster();
                    objAttendanceDetails        = new AttendanceDetails();



                    objEmployeeMaster = emp;
                    var dtEmployeeAttendance = dal.GetEmployeeAttendance(model.SchoolID, model.FinancialYear, emp.EMP_ID, Month, Year);

                    var startDate = !string.IsNullOrEmpty(Convert.ToString(emp.JOININGDATE)) ? Convert.ToDateTime(emp.JOININGDATE) : new DateTime(Year, Month, 1);
                    var endDate   = !string.IsNullOrEmpty(Convert.ToString(emp.LEAVINGDATE)) ? Convert.ToDateTime(emp.LEAVINGDATE) : new DateTime(Year, Month, DateTime.DaysInMonth(Year, Month));
                    model.TotalDaysInMonth = DateTime.DaysInMonth(Year, Month);
                    var ListDates = Enumerable.Range(1, DateTime.DaysInMonth(Year, Month)).Select(day => new DateTime(Year, Month, day)).ToList();
                    objAttendanceDetails.TotalWorkingDaysList = ListDates.Where(x => Convert.ToDateTime(x) >= startDate && Convert.ToDateTime(x) <= endDate).Select(x => x.ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.Attendance           = dtEmployeeAttendance;
                    //if (dtEmployeeAttendance.Rows.Count > 0)
                    //{
                    _EmployeeSalary = dal.GetEmployeeSalaryList(_EmployeeSalaryModel, emp.EMPCODE);

                    objAttendanceDetails.AbsentList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "A" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalAbsent   = objAttendanceDetails.AbsentList.Count();
                    objAttendanceDetails.ModifiedTotalAbsent = objAttendanceDetails.AbsentList.Count();

                    objAttendanceDetails.PaidLeaveList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "PL" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalPaidLeave   = objAttendanceDetails.PaidLeaveList.Count();
                    objAttendanceDetails.ModifiedTotalPaidLeave = objAttendanceDetails.PaidLeaveList.Count();


                    objAttendanceDetails.UnPaidLeaveList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "UPL" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalUnPaidLeave   = objAttendanceDetails.UnPaidLeaveList.Count();
                    objAttendanceDetails.ModifiedTotalUnPaidLeave = objAttendanceDetails.UnPaidLeaveList.Count();

                    objAttendanceDetails.HolidayList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "H" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalHoliday   = objAttendanceDetails.HolidayList.Count();
                    objAttendanceDetails.ModifiedTotalHoliday = objAttendanceDetails.HolidayList.Count();

                    objAttendanceDetails.WOList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "WO" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalWO   = objAttendanceDetails.WOList.Count();
                    objAttendanceDetails.ModifiedTotalWO = objAttendanceDetails.WOList.Count();

                    objAttendanceDetails.PresentList          = dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <string>("SalaryAttendance") == "P" && dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList();
                    objAttendanceDetails.ActualTotalPresent   = objAttendanceDetails.PresentList.Count();
                    objAttendanceDetails.ModifiedTotalPresent = objAttendanceDetails.PresentList.Count();

                    objAttendanceDetails.MissingAttendenceList          = objAttendanceDetails.TotalWorkingDaysList.Where(y => !(dtEmployeeAttendance.Rows.OfType <DataRow>().Where(dr => dr.Field <DateTime>("Attendancedate") >= startDate && dr.Field <DateTime>("Attendancedate") <= endDate).Select(dr => dr.Field <DateTime>("Attendancedate").ToString("dd/MM/yyyy")).ToList()).Any(z => z == y)).ToList();
                    objAttendanceDetails.ActualTotalMissingAttendence   = objAttendanceDetails.MissingAttendenceList.Count();
                    objAttendanceDetails.ModifiedTotalMissingAttendence = objAttendanceDetails.MissingAttendenceList.Count();
                    objEmployeeAttendanceRecord.PaidSalary    = "N/G";
                    objEmployeeAttendanceRecord.PaymentStatus = false;
                    if (_EmployeeSalary != null)
                    {
                        if (_EmployeeSalary.SalaryDetailsList != null && _EmployeeSalary.SalaryDetailsList.Count > 0)
                        {
                            if (_EmployeeSalary.SalaryDetailsList.Where(x => x.EMP_ID == emp.EMP_ID && x.EMP_CODE == emp.EMPCODE).Any())
                            {
                                var empSal = _EmployeeSalary.SalaryDetailsList.Where(x => x.EMP_ID == emp.EMP_ID && x.EMP_CODE == emp.EMPCODE).FirstOrDefault();
                                objEmployeeAttendanceRecord.PaidSalary    = string.IsNullOrEmpty(Convert.ToString(empSal.PaidSalary)) ? objEmployeeAttendanceRecord.PaidSalary : Convert.ToString(empSal.PaidSalary);
                                objEmployeeAttendanceRecord.PaymentStatus = empSal.PaymentStatus;
                            }
                        }
                    }

                    //}
                    //else
                    //{

                    //    objAttendanceDetails.AbsentList = new List<string>();
                    //    objAttendanceDetails.ActualTotalAbsent = 0;
                    //    objAttendanceDetails.ModifiedTotalAbsent = 0;

                    //    objAttendanceDetails.PaidLeaveList = new List<string>();
                    //    objAttendanceDetails.ActualTotalPaidLeave = 0;
                    //    objAttendanceDetails.ModifiedTotalPaidLeave = 0;

                    //    objAttendanceDetails.UnPaidLeaveList = new List<string>();
                    //    objAttendanceDetails.ActualTotalUnPaidLeave = 0;
                    //    objAttendanceDetails.ModifiedTotalUnPaidLeave = 0;

                    //    objAttendanceDetails.HolidayList = new List<string>();
                    //    objAttendanceDetails.ActualTotalHoliday = 0;
                    //    objAttendanceDetails.ModifiedTotalHoliday = 0;

                    //    objAttendanceDetails.WOList = new List<string>();
                    //    objAttendanceDetails.ActualTotalWO = 0;
                    //    objAttendanceDetails.ModifiedTotalWO = 0;

                    //    objAttendanceDetails.PresentList = new List<string>();
                    //    objAttendanceDetails.ActualTotalPresent = 0;
                    //    objAttendanceDetails.ModifiedTotalPresent = 0;

                    //    objAttendanceDetails.MissingAttendenceList = ListDates.Select(x => x.ToString("dd/MM/yyyy")).ToList();
                    //    objAttendanceDetails.ActualTotalMissingAttendence = objAttendanceDetails.MissingAttendenceList.Count();
                    //    objAttendanceDetails.ModifiedTotalMissingAttendence = objAttendanceDetails.MissingAttendenceList.Count();
                    //    objEmployeeAttendanceRecord.PaidSalary = "N/G";
                    //}
                    objEmployeeAttendanceRecord.AttendanceDetail = objAttendanceDetails;
                    objEmployeeAttendanceRecord.EmployeeDetails  = objEmployeeMaster;

                    ObjEmployeeAttendanceRecordList.Add(objEmployeeAttendanceRecord);
                }
                model.EmployeeAttendanceList = ObjEmployeeAttendanceRecordList;
            }
            catch (Exception ex)
            {
            }

            return(model);
        }
 private static AttendanceGroup GetAttendanceGroup(AttendanceDetails details, DateTimeOffset date)
 {
     if (details.Contains(date))
         return details[date];
     else
         return null;
 }
Beispiel #23
0
        public async Task <ActionResult <AttendanceDetails> > PostAttendanceDetailList(AttendanceDetailsDTO attendanceDetailsDTO)
        {
            List <AttendanceDetails> attendedStudentList = new List <AttendanceDetails>();

            var attendance = from s in _context.Attendance
                             where s.SubjectClassID == attendanceDetailsDTO.SubjectClassID
                             select new
            {
                AttendanceID = s.AttendanceID,
                StudentID    = s.StudentID,
            };
            var eventID = attendanceDetailsDTO.EventID;

            // update event status
            (from x in _context.Event where x.EventID == eventID select x).ToList().ForEach(x => x.Status = 1);
            if (attendanceDetailsDTO.StudentList.Count != 0)
            {
                foreach (var s in attendance)
                {
                    foreach (var a in attendanceDetailsDTO.StudentList)
                    {
                        var attendedStudent = new AttendanceDetails()
                        {
                            AttendanceID = s.AttendanceID,
                            EventID      = eventID,
                        };
                        if (s.StudentID == a.StudentID)
                        {
                            attendedStudent.IsAttended = true;
                        }
                        else
                        {
                            attendedStudent.IsAttended = false;
                        }
                        _context.AttendanceDetails.Add(attendedStudent);
                    }
                }
            }
            else
            {
                foreach (var s in attendance)
                {
                    var attendedStudent = new AttendanceDetails()
                    {
                        AttendanceID = s.AttendanceID,
                        EventID      = eventID,
                    };


                    attendedStudent.IsAttended = false;

                    _context.AttendanceDetails.Add(attendedStudent);
                }
            };
            try
            {
                await _context.SaveChangesAsync();
            }catch (Exception ex)
            {
            }

            return(Ok());
        }