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"));
        }
Example #4
0
 public string test()
 {
     JazMaxIdentityHelper.UserName = User.Identity.Name;
     if (JazMaxIdentityHelper.IsUserInRole("PA"))
     {
         return("Yes");
     }
     return("No");
 }
        public ActionResult Create(MessageTemplate model)
        {
            JazMaxIdentityHelper.UserName = User.Identity.Name;
            model.CoreUserId = JazMaxIdentityHelper.GetCoreUserId();
            if (!JazMaxIdentityHelper.IsUserInRole("CEO,PA"))
            {
                model.CoreBranchId = JazMaxIdentityHelper.User().BranchId;
            }

            TemplateCreation.CreateTemplate(model);
            return(View());
        }
        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));
            }
        }
Example #7
0
        public ActionResult Search(string ProspectName, string LeadTypeId, string LeadStatusId, string BranchId, string AngentId)
        {
            JazMaxIdentityHelper.UserName = User.Identity.Name;
            LeadHelper o = new LeadHelper();

            LeadIndexSearch model = new LeadIndexSearch()
            {
                ProspectName = ProspectName,
                AngentId     = Convert.ToInt32(AngentId),
                BranchId     = Convert.ToInt32(BranchId),
                LeadStatusId = Convert.ToInt32(LeadStatusId),
                LeadTypeId   = Convert.ToInt32(LeadTypeId)
            };

            if (JazMaxIdentityHelper.IsUserInRole(JazMax.Common.Enum.UserType.Agent.ToString()))
            {
                model.AngentId = JazMaxIdentityHelper.GetAgentId();
                return(View(o.GetLeadIndexNew(model)));
            }

            if (JazMaxIdentityHelper.IsUserInRole(JazMax.Common.Enum.UserType.TeamLeader.ToString()))
            {
                model.BranchId = JazMaxIdentityHelper.GetTeamLeadersInfoNew().CoreBranchId;
                return(View(o.GetLeadIndexNew(model)));
            }

            if (JazMaxIdentityHelper.IsUserInRole(JazMax.Common.Enum.UserType.PA.ToString()))
            {
                model.BranchIdList = JazMaxIdentityHelper.GetPAProvinceIdList();
                return(View(o.GetLeadIndexNew(model)));
            }

            if (JazMaxIdentityHelper.IsUserInRole(JazMax.Common.Enum.UserType.CEO.ToString()))
            {
                return(View(o.GetLeadIndexNew(model)));
            }

            return(View(o.GetLeadIndexNew(model)));
        }