public ActionResult AddStaff(int id = 0)
        {
            StaffTable staffTable = new StaffTable();

            if (id > 0)
            {
                staffTable = staffRepository.GetStaffById(id);
            }
            ViewBag.Session = StaticData.GetStaffAT();

            StaffModel staffModel = new StaffModel()
            {
                ID            = staffTable.ID,
                ACDetails     = staffTable.ACDetails,
                DateOfBirth   = staffTable.DateOfBirth,
                DateOfJoin    = staffTable.DateOfJoin,
                Designation   = staffTable.Designation,
                Salary        = staffTable.Salary,
                Experience    = staffTable.Experience,
                SchoolMatric  = staffTable.SchoolMatric,
                Name          = staffTable.Name,
                PhotoGraph    = staffTable.PhotoGraph,
                Staff         = staffTable.Staff,
                Qualification = staffTable.Qualification
            };

            return(View(staffModel));
        }
Beispiel #2
0
        // GET: Admin/AStaffStundent
        public ActionResult StaffCreate(int id = 0)
        {
            Staff staff = new Staff();

            if (id > 0)
            {
                staff = staffRepository.GetStaffById(id);
            }
            StaffModel staffModel = new StaffModel
            {
                ID               = staff.ID,
                AadharNumber     = staff.AadharNumber,
                DateOfBirth      = staff.DateOfBirth,
                DateOfJoin       = staff.DateOfJoin,
                Salary           = staff.Salary,
                StaffName        = staff.StaffName,
                StaffType        = staff.StaffType,
                Subject          = staff.Subject,
                SubjectNumFirst  = staff.SubjectNumFirst,
                SubjectNumSecond = staff.SubjectNumSecond,
                TeachSubFirst    = staff.TeachSubFirst,
                TeachSubSecond   = staff.TeachSubSecond,
                Designation      = staff.Designation,
                Experience       = staff.Experience,
                FatherName       = staff.FatherName,
                PanNumber        = staff.PanNumber
            };

            return(View(staffModel));
        }
Beispiel #3
0
        public bool ChangePassword(Guid staffId, string password)
        {
            bool changepass = false;

            try
            {
                IUnitOfWork      ouw     = new UnitOfWork();
                IStaffRepository rep     = new StaffRepository(ouw);
                IStaffService    service = new StaffService(rep);


                var result = rep.GetStaffById(staffId);

                if (result != null)
                {
                    result.Password = Utility.MD5(password);
                    rep.UpdateStaff(result);
                }
            }
            catch (Exception ex)
            {
                changepass = false;
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                throw new Exception(ex.Message);
            }

            return(changepass);
        }
Beispiel #4
0
        public void GetStaffById_WithValidId_ReturnsRightStaff()
        {
            using (new AssertionScope())
            {
                int            validId = 1;
                StaffViewModel actual  = _sut.GetStaffById(validId);
                actual.Should().Equals(_mockStaffListVM[0]);

                validId = 2;
                actual  = _sut.GetStaffById(validId);
                actual.Should().Equals(_mockStaffListVM[1]);

                validId = 3;
                actual  = _sut.GetStaffById(validId);
                actual.Should().Equals(_mockStaffListVM[2]);
            }
        }