public ActionResult Edit(MaintenanceTeam maintenanceteam)
 {
     if (ModelState.IsValid)
     {
         UserHelper.UpdateMaintenanceTeamsName(maintenanceteam);
         return Redirect(UserHelper.ProviderMaintenanceTeamTabUrl());
     }
     return View(maintenanceteam);
 }
 public ActionResult Create(MaintenanceTeam maintenanceteam)
 {
     if (!ModelState.IsValid)
     {
         return null;
     }
     maintenanceteam.MaintenanceProviderId = UserHelper.GetProviderId();
     UnitofWork.MaintenanceTeamRepository.Add(maintenanceteam);
     UnitofWork.Save();
     return Redirect(UserHelper.ProviderMaintenanceTeamTabUrl());
 }
        public MaintenanceTeam ThirdMaintenanceTeam()
        {
            var thirdMaintenanceTeam = new MaintenanceTeam {

                 TeamId = new Int32()
            ,
                 TeamName = null,
                 MaintenanceProviderId = new Int32()

             };

            return thirdMaintenanceTeam;
        }
        public MaintenanceTeam SecondMaintenanceTeam()
        {
            var secondMaintenanceTeam = new MaintenanceTeam {

                 TeamId = new Int32()
            ,
                 TeamName = null,
                 MaintenanceProviderId = new Int32()

             };

            return secondMaintenanceTeam;
        }
        public MaintenanceTeam FirstMaintenanceTeam()
        {
            var firstMaintenanceTeam = new MaintenanceTeam {

                 TeamId = new Int32()
            ,
                 TeamName = null,
                 MaintenanceProviderId = new Int32()

             };

            return firstMaintenanceTeam;
        }
 public void UpdateMaintenanceTeamsName(MaintenanceTeam maintenanceteam)
 {
     var providerId = UserHelper.GetProviderId();
     var maintenanceTeamAssociation = UnitofWork.MaintenanceTeamAssociationRepository.
         FindBy(x => x.TeamId == maintenanceteam.TeamId
                    && x.MaintenanceProviderId == providerId).ToList();
     if (maintenanceTeamAssociation.Count > 0)
     {
         foreach (var mta in maintenanceTeamAssociation)
         {
             mta.TeamName = maintenanceteam.TeamName;
         }
     }
     UnitofWork.Save();
 }
 public ActionResult RemoveMember(MaintenanceTeam team)
 {
     if (Request.Params["stid"] == null || Request.Params["pid"] == null)
     {
         return RedirectToAction("AddTeamMember");
     }
     int pid = Convert.ToInt32(Request.Params["pid"]);
     int sid = Convert.ToInt32(Request.Params["stid"]);
     var provider = UserHelper.ProviderPrivateProfileHelper.GetProvider();
     var currentspecialist = UnitofWork.MaintenanceTeamAssociationRepository.FirstOrDefault(
         x => x.MaintenanceProviderId == provider.MaintenanceProviderId
              && x.SpecialistId == pid
              && x.TeamId == sid);
     if (currentspecialist != null)
     {
         UnitofWork.MaintenanceTeamAssociationRepository.Delete(currentspecialist);
         UnitofWork.Save();
     }
     RemoveSpecialistZoneFromProviderTeamZone(Convert.ToInt32(Request.Params["pid"]),
                                              Convert.ToInt32(Request.Params["stid"]));
     var teamcoverageUpdate = new UpdateCoverage(Convert.ToInt32(Request.Params["pid"]), Convert.ToInt32(Request.Params["stid"]));
     teamcoverageUpdate.RemoveAllCoverageFromSpecialistToTeam();
     RemoveSpecialist(Convert.ToInt32(Request.Params["stid"]), Convert.ToInt32(Request.Params["pid"]));
     JNotify("Your request has been completed.", "/Provider/#team");
     return View();
 }
 public ActionResult InviteTeamMember(MaintenanceTeam team)
 {
     if (Request.Params["stid"] == null || Request.Params["pid"] == null)
     {
         return RedirectToAction("AddTeamMember");
     }
     var tid = Convert.ToInt32(Request.Params["stid"]);
     var selectedteam = UnitofWork.MaintenanceTeamRepository.
         FirstOrDefault(x => x.TeamId == tid);
     var provider = UserHelper.ProviderPrivateProfileHelper.GetProvider();
     var proid = provider.MaintenanceProviderId;
     if (selectedteam != null)
     {
         var npti = new SpecialistPendingTeamInvitation
             {
                 MaintenanceProviderId = proid,
                 SpecialistID = Convert.ToInt32(Request.Params["pid"]),
                 TeamId = selectedteam.TeamId,
                 TeamName = selectedteam.TeamName
             };
         UnitofWork.SpecialistPendingTeamInvitationRepository.Add(npti);
     }
     UnitofWork.Save();
     InviteSpecialist(Convert.ToInt32(Request.Params["stid"]), Convert.ToInt32(Request.Params["pid"]));
     JNotify("Your request has been completed.", "/Provider/#team");
     return View();
 }
 public void UpdateMaintenanceTeamsName(MaintenanceTeam maintenanceteam)
 {
     ProviderTeamPrivateProfileHelper.UpdateMaintenanceTeamsName(maintenanceteam);
 }