public ActionResult Save(string CoreTeamLeaderId, string ProvinceId, string BranchName, string Phone, string EmailAddress, string StreetAddress, string City, string Suburb)
 {
     JazMax.Web.ViewModel.UserAccountView.CoreBranchView m = new ViewModel.UserAccountView.CoreBranchView()
     {
         BranchName       = BranchName,
         City             = City,
         CoreTeamLeaderId = Convert.ToInt32(CoreTeamLeaderId),
         EmailAddress     = EmailAddress,
         IsActive         = true,
         Phone            = Phone
     };
     JazMaxIdentityHelper.UserName = User.Identity.Name;
     if (JazMaxIdentityHelper.IsUserInRole("PA"))
     {
         m.ProvinceId = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name).ProvinceId;
     }
     else
     {
         m.ProvinceId = Convert.ToInt32(ProvinceId);
     }
     m.StreetAddress = StreetAddress;
     m.Suburb        = Suburb;
     o.CreateNewBranch(m);
     return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
 }
        // GET: Leads/Reminder
        public ActionResult Index()
        {
            LeadReminderSearch index = new LeadReminderSearch()
            {
                BranchId   = 0,
                CoreUserId = 0,
                ProvinceId = 0
            };

            JazMax.Core.SystemHelpers.JazMaxIdentityHelper.UserName = User.Identity.Name;

            if (JazMaxIdentityHelper.IsUserInRole("Agent"))
            {
                index.CoreUserId = JazMaxIdentityHelper.GetCoreUserId();
            }

            if (JazMaxIdentityHelper.IsUserInRole("TeamLeader"))
            {
                index.BranchId = JazMaxIdentityHelper.GetTeamLeadersInfoNew().CoreBranchId;
            }

            if (JazMaxIdentityHelper.IsUserInRole("PA"))
            {
                index.ProvinceId = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name).ProvinceId;
            }
            ReminderLogic o = new ReminderLogic();

            return(View(o.GetMyLeadReminders(index)));
        }
        public ActionResult MyAgent()
        {
            int teamLeaderId = 0;

            JazMaxIdentityHelper.UserName = User.Identity.Name;

            try
            {
                if (JazMaxIdentityHelper.IsUserInRole("TeamLeader"))
                {
                    teamLeaderId = JazMaxIdentityHelper.GetTeamLeadersInfoNew().CoreTeamLeaderId;
                    return(View(o.GetMyAgents(teamLeaderId)));
                }
                else if (JazMaxIdentityHelper.IsUserInRole("PA"))
                {
                    var provinceId = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name).ProvinceId;
                    return(View(o.GetMyAgentInProvince(provinceId)));
                }
            }
            catch (Exception e)
            {
                //JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
                teamLeaderId = 0;
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult UpdateBranch(string BranchId, string CoreTeamLeaderId, string ProvinceId, string BranchName, string Phone, string EmailAddress, string StreetAddress, string City, string Suburb)
        {
            try
            {
                JazMax.Web.ViewModel.UserAccountView.CoreBranchView m = new ViewModel.UserAccountView.CoreBranchView()
                {
                    BranchId   = Convert.ToInt16(BranchId),
                    BranchName = BranchName,
                    City       = City
                };
                if (CoreTeamLeaderId == null)
                {
                    //DO Nothing.
                    //Do not update the TeamLeaderID
                }
                else
                {
                    m.CoreTeamLeaderId = Convert.ToInt32(CoreTeamLeaderId);
                }
                m.EmailAddress = EmailAddress;
                m.IsActive     = true;
                m.Phone        = Phone;

                JazMaxIdentityHelper.UserName = User.Identity.Name;
                if (JazMaxIdentityHelper.IsUserInRole("PA"))
                {
                    m.ProvinceId = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name).ProvinceId;
                }
                else
                {
                    m.ProvinceId = Convert.ToInt32(ProvinceId);
                }
                m.StreetAddress = StreetAddress;
                m.Suburb        = Suburb;
                o.Update(m, JazMaxIdentityHelper.GetCoreUserId());
                return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { Result = "Error!", Message = "Branch could not be updated" }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult GetMyBranches()
        {
            UserInformation a = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name);

            return(View(o.GetMyBranchs(a.ProvinceId)));
        }
Example #6
0
        public ActionResult GetBranchsForAgentProvince()
        {
            UserInformation a = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name);

            return(Json(_helper.GetBranchesBasedOnProvince(a.ProvinceId), JsonRequestBehavior.AllowGet));
        }