public FacultyWorkInfo Create(FacultyWorkInfo obj)
 {
     try
     {
         _facultyWorkInfoRepo.InsertCompletedEvent += objSubscriberClasses.SendEmail;
         _facultyWorkInfoRepo.InsertCompletedEvent += objSubscriberClasses.SendSMS;
         return _facultyWorkInfoRepo.Create(obj);
     }
     catch (Exception ex)
     {
         _logger.Error(ex.Message, ex);
         throw ex;
     }
 }
        public FacultyWorkInfo Create(FacultyWorkInfo FacultyInfoRepo)
        {
            using (var context = _dbContextFactory.CreateConnection())
            {
                try
                {
                    FacultyInfoRepo = context.FacultyWorkInfoes.Add(FacultyInfoRepo);
                    context.SaveChanges();
                    CallNotificationModules(this, new UserRegistrationDoneEventArgs { Email = FacultyInfoRepo.Email, MobileNumber = FacultyInfoRepo.MobileNumber });
                    return FacultyInfoRepo;

                }
                catch (Exception ex)
                {
                    _Logger.Error(ex.Message, ex);
                    throw ex;
                }

            }
        }
        public FacultyWorkInfo UpdateWorkInfo(int id, FacultyWorkInfo WorkInfo)
        {
            using (var context = _dbContextFactory.CreateConnection())
            {
                try
                {
                    FacultyWorkInfo WorkingInfo = context.FacultyWorkInfoes.Where(x => x.FacultyUserId == id).FirstOrDefault();
                    WorkingInfo.DepartmentName = WorkInfo.DepartmentName;
                    WorkingInfo.DesignationName = WorkInfo.DesignationName;
                    WorkingInfo.WorkingFrom = WorkInfo.WorkingFrom;
                    WorkingInfo.WorkingTo = WorkingInfo.WorkingTo;
                    context.SaveChanges();
                    return WorkInfo;

                }
                catch (Exception ex)
                {
                    _Logger.Error(ex.Message, ex);
                    throw ex;
                }

            }
        }
 public FacultyWorkInfo UpdateWorkInfo(int id, FacultyWorkInfo WorkInfo)
 {
     return _facultyWorkInfoRepo.UpdateWorkInfo(id, WorkInfo);
 }
Example #5
0
 public ActionResult RegisterAsFaculty(FacultyRegistrationModel FacultyRegistration)
 {
     if (Session["UserId"] != null)
     {
         if (ModelState.IsValid)
         {
             int UserId = Convert.ToInt32(Session["UserId"].ToString());
             FacultyWorkInfo details = new FacultyWorkInfo();
             TryUpdateModel(details);
             details.FacultyUserId = Convert.ToInt64(Session["UserId"]);
             details.Status = true;
             FacultyWorkInfoService.Create(details);
             View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
             UserManager.RemoveFromRole(Userdetails.AspnetUsersId, Userdetails.Role);
             UserManager.AddToRole(Userdetails.AspnetUsersId, "Alumni and Faculty");
             TempData["Success"] = UtilitiesClass.SuccessMessage;
             return RedirectToAction("Profile", "Profile", new { area = "Alumini" });
         }
         List<GraduationYear> _GraduationYears = new List<GraduationYear>();
         for (int i = 1970; i <= 2015; i++)
             _GraduationYears.Add(new GraduationYear { Year = "" + i, GraduationYearId = i });
         FacultyRegistrationModel Faculty = new FacultyRegistrationModel()
         {
             GraduationYears = _GraduationYears,
         };
         return View(Faculty);
     }
     return RedirectToAction("Login", "Account", new { area = "" });
 }