Example #1
0
        public JsonResult CreateActivity(string LeadActivityId, string LeadId, string Description)
        {
            try
            {
                JazMaxIdentityHelper.UserName = User.Identity.Name;
                JazMax.Core.Leads.Activity.LeadActivity model = new Core.Leads.Activity.LeadActivity()
                {
                    CoreUserId     = JazMaxIdentityHelper.GetCoreUserId(),
                    Description    = Description,
                    IsSystem       = false,
                    LeadActivityId = Convert.ToInt32(LeadActivityId),
                    LeadId         = Convert.ToInt32(LeadId)
                };

                JazMax.Core.Leads.Activity.ActivityCreation.CaptureLeadActivity(model);

                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Success,
                    Message = Common.Models.JsonMessage.Saved,
                }));
            }
            catch
            {
                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Error,
                    Message = Common.Models.JsonMessage.Error,
                }));
            }
        }
        // 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)));
        }
Example #3
0
        public JsonResult CreateReminder(string LeadId, string DescriptionReminder, string Date)
        {
            try
            {
                JazMaxIdentityHelper.UserName = User.Identity.Name;
                JazMax.Core.Leads.Reminder.LeadReminder model = new Core.Leads.Reminder.LeadReminder()
                {
                    CoreUserId   = JazMaxIdentityHelper.GetCoreUserId(),
                    Description  = DescriptionReminder,
                    ReminderDate = Convert.ToDateTime(Date),
                    LeadId       = Convert.ToInt32(LeadId)
                };

                JazMax.Core.Leads.Reminder.ReminderCreation.CaptureLeadReminder(model);

                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Success,
                    Message = Common.Models.JsonMessage.Saved,
                }));
            }
            catch
            {
                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Error,
                    Message = Common.Models.JsonMessage.Error,
                }));
            }
        }
Example #4
0
 public JsonResult CloseLead(string LeadId, string DescriptionText)
 {
     try
     {
         JazMaxIdentityHelper.UserName = User.Identity.Name;
         JazMax.Core.Leads.Status.LeadStatusLogic.CloseLead(Convert.ToInt32(LeadId), new Core.Leads.Activity.LeadActivity
         {
             CoreUserId     = JazMaxIdentityHelper.GetCoreUserId(),
             Description    = "Lead has been closed by " + JazMaxIdentityHelper.GetBasicUserInfo().DisplayName,
             IsSystem       = false,
             LeadActivityId = 6, //Lead CLosed
             LeadId         = Convert.ToInt32(LeadId)
         });
         return(Json(new JazMaxJsonHelper
         {
             Result = Common.Models.JsonResult.Success,
             Message = Common.Models.JsonMessage.Saved,
         }));
     }
     catch (Exception e)
     {
         return(Json(new JazMaxJsonHelper
         {
             Result = Common.Models.JsonResult.Error,
             Message = Common.Models.JsonMessage.Error,
         }));
     }
 }
 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));
 }
        public ActionResult SaveRequest(string CoreBranchId, string MoveRequestComment)
        {
            try
            {
                JazMaxIdentityHelper.UserName = User.Identity.Name;
                obj.CaptureUserRequest(new ViewModel.UserAccountView.RequestBranchMoveView
                {
                    CoreBranchId       = Convert.ToInt32(CoreBranchId),
                    MoveRequestComment = MoveRequestComment,
                    CoreUserId         = JazMaxIdentityHelper.GetCoreUserId()
                });

                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Success,
                    Message = Common.Models.JsonMessage.Saved,
                }));
            }
            catch
            {
                return(Json(new JazMaxJsonHelper
                {
                    Result = Common.Models.JsonResult.Error,
                    Message = Common.Models.JsonMessage.Error,
                }));
            }
        }
        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 #8
0
        // GET: Leads/Leads
        public ActionResult Index()
        {
            LeadHelper o = new LeadHelper();

            JazMaxIdentityHelper.UserName = User.Identity.Name;
            // return View(o.GetLeadIndex((int)JazMaxIdentityHelper.GetUserInformationNew().BranchId));
            return(View(o.GetLeadIndex((int)JazMaxIdentityHelper.GetUserInformationNew().BranchId)));
        }
 public ActionResult SendProspect(SendMessage model)
 {
     JazMaxIdentityHelper.UserName = User.Identity.Name;
     model.CoreUserId  = JazMaxIdentityHelper.GetCoreUserId();
     model.TriggerText = TriggerType.LeadProspects.ToString();
     model.MessageType = 1;
     MessageCreationLogic.CreateTrigger(model);
     return(RedirectToAction("Index", "Home"));
 }
Example #10
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 JsonResult UpdateProvince(string ProvinceName, string ProvinceId)
 {
     try
     {
         JazMaxIdentityHelper.UserName = User.Identity.Name;
         CoreProvinceService.Update(ProvinceName, JazMaxIdentityHelper.GetCoreUserId(), Convert.ToInt32(ProvinceId));
         return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { Result = "Error!", Message = "Error, Please try again" }, JsonRequestBehavior.AllowGet));
     }
 }
Example #13
0
 public JsonResult Activate(string coreUserId)
 {
     try
     {
         JazMaxIdentityHelper.UserName = User.Identity.Name;
         CoreUserService.DeactiveCoreUser(Convert.ToInt32(coreUserId), JazMaxIdentityHelper.GetCoreUserId(), false);
         return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { Result = "Error!", Message = "Error, Please try again" }, JsonRequestBehavior.AllowGet));
     }
 }
Example #14
0
 public JsonResult MoveAgent(string coreUserId, string ddlDropBranch)
 {
     try
     {
         JazMaxIdentityHelper.UserName = User.Identity.Name;
         CoreUserService.MoveAgent(Convert.ToInt32(coreUserId), JazMaxIdentityHelper.GetCoreUserId(), Convert.ToInt32(ddlDropBranch));
         return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { Result = "Error!", Message = "Error, Please try again" }, JsonRequestBehavior.AllowGet));
     }
 }
Example #15
0
        public int Upload(UploadView coreFileUpload)
        {
            using (DataAccess.JazMaxDBProdContext db = new DataAccess.JazMaxDBProdContext())
            {
                var context = HttpContext.Current;
                for (int i = 0; i < context.Request.Files.Count; i++)
                {
                    var file = context.Request.Files[i];
                    #region Content Length
                    if (file != null && file.ContentLength > 0)
                    {
                        #region CoreFIleUpload
                        DataAccess.CoreFileUpload fileUpload = new DataAccess.CoreFileUpload()
                        {
                            FileUploadId       = coreFileUpload.FileUploadId,
                            FileNames          = System.IO.Path.GetFileName(file.FileName),
                            CoreUserId         = JazMaxIdentityHelper.GetCoreUserId(),
                            CoreUserTypeId     = JazMaxIdentityHelper.GetCoreUserId(),
                            DateCreated        = DateTime.Now,
                            DeletedBy          = "None",
                            DeletedDate        = DateTime.Now,
                            BranchId           = (int)JazMaxIdentityHelper.GetUserInformationNew().BranchId,
                            ProvinceId         = (int)JazMaxIdentityHelper.GetUserInformationNew().ProvinceId,
                            CoreFileTypeId     = coreFileUpload.CoreFileTypeId,
                            FileDescription    = coreFileUpload.FileDescription,
                            CoreFileCategoryId = coreFileUpload.CoreFileCategoryId,
                            LastUpdated        = DateTime.Now,
                            IsActive           = true,
                            IsSent             = true,
                            IsRecieved         = true,
                            FileContent        = coreFileUpload.FileContent,
                            SentFrom           = JazMaxIdentityHelper.UserName,
                            SentTo             = "Document Directory"
                        };
                        #endregion

                        #region Binary Reader
                        using (var reader = new System.IO.BinaryReader(file.InputStream))
                        {
                            fileUpload.FileContent = reader.ReadBytes(file.ContentLength);
                        }
                        #endregion

                        db.CoreFileUploads.Add(fileUpload);
                    }
                    #endregion
                    db.SaveChanges();
                }
                return(coreFileUpload.FileUploadId);
            }
        }
Example #16
0
        public int ForwardDocument(int id, UploadView coreFileUpload, FormCollection Form)
        {
            using (DataAccess.JazMaxDBProdContext db = new DataAccess.JazMaxDBProdContext())
            {
                string[] ids = Form["SentTo"].Split(new char[] { ',' });
                //Find Document Id That i Want to forward
                var FindContent = FindById(id);
                //get All contents of that particular file
                //Move Document to User Email Thats been Selected
                #region Database Upload object
                foreach (var item in ids)
                {
                    DataAccess.CoreFileUpload upload = new DataAccess.CoreFileUpload()
                    {
                        FileUploadId       = FindContent.FileUploadId,
                        FileNames          = FindContent.FileNames,
                        CoreUserId         = JazMaxIdentityHelper.GetCoreUserId(),
                        CoreUserTypeId     = FindContent.CoreUserTypeId,
                        DateCreated        = DateTime.Now,
                        DeletedBy          = "None",
                        DeletedDate        = DateTime.Now,
                        BranchId           = (int)JazMaxIdentityHelper.GetUserInformationNew().BranchId,
                        ProvinceId         = (int)JazMaxIdentityHelper.GetUserInformationNew().ProvinceId,
                        CoreFileTypeId     = FindContent.CoreFileTypeId,
                        FileDescription    = coreFileUpload.FileDescription,
                        CoreFileCategoryId = FindContent.CoreFileCategoryId,
                        LastUpdated        = DateTime.Now,
                        IsActive           = true,
                        IsSent             = true,
                        IsRecieved         = false,
                        FileContent        = FindContent.FileContent,
                        SentFrom           = JazMaxIdentityHelper.UserName,
                        SentTo             = item.ToString()
                    };

                    #endregion

                    //SaveChanges To Database
                    db.CoreFileUploads.Add(upload);
                    db.SaveChanges();
                }
                return(FindContent.FileUploadId);
            }
        }
        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 #18
0
 public ActionResult UpdateCoreUser(string coreUserId, string FirstName, string LastName, string MiddleName, string PhoneNumber, string CellPhone, string IdNumber)
 {
     try
     {
         JazMaxIdentityHelper.UserName = User.Identity.Name;
         CoreUserDetails m = new CoreUserDetails()
         {
             FirstName   = FirstName,
             LastName    = LastName,
             MiddleName  = MiddleName,
             PhoneNumber = PhoneNumber,
             CellPhone   = CellPhone,
             IDNumber    = IdNumber
         };
         obj.UpdateCoreUser(Convert.ToInt32(coreUserId), 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 #19
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)));
        }
        public ActionResult GetMyBranches()
        {
            UserInformation a = JazMaxIdentityHelper.GetPAUserInformation(User.Identity.Name);

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

            return(Json(_helper.GetBranchesBasedOnProvince(a.ProvinceId), JsonRequestBehavior.AllowGet));
        }
Example #22
0
        public ActionResult SaveAgent(string FirstName, string MiddleName, string LastName, string IDNumber, string PhoneNumber, string CellPhone, string EmailAddress, string GenderId)
        {
            try
            {
                #region Capture CoreUser Details
                TeamLeaderInfomation team = new TeamLeaderInfomation();

                JazMaxIdentityHelper.UserName = User.Identity.Name;
                team = JazMaxIdentityHelper.GetTeamLeadersInfoNew();

                CoreUserView m = new CoreUserView()
                {
                    FirstName    = FirstName,
                    MiddleName   = MiddleName,
                    LastName     = LastName,
                    EmailAddress = EmailAddress,
                    IsActive     = true,
                    IDNumber     = IDNumber,
                    PhoneNumber  = PhoneNumber,
                    CellPhone    = CellPhone
                };
                m.EmailAddress = EmailAddress;

                m.GenderId       = Convert.ToInt32(GenderId);
                m.CoreUserTypeId = Convert.ToInt32(4);

                #region Not Required
                CapturePAView mm = new CapturePAView()
                {
                    provinceId = 0
                };
                CaptureTeamLeader zz = new CaptureTeamLeader()
                {
                    provinceId = 0
                };
                #endregion

                CaptureAgent yy = new CaptureAgent()
                {
                    BranchId = team.CoreBranchId
                };

                m.CapturePAView     = mm;
                m.CaptureTeamLeader = zz;
                m.CaptureAgent      = yy;
                obj.CreateNewCoreUser(m);
                #endregion

                #region Capture AspUser and Role
                var store = new UserStore <ApplicationUser>(new ApplicationDbContext());
                ApplicationUserManager _userManager = new ApplicationUserManager(store);
                var    manger        = _userManager ?? HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
                string studentNumber = EmailAddress;
                string password      = "******";
                var    user          = new ApplicationUser()
                {
                    Email = studentNumber, UserName = studentNumber
                };
                var usmanger = manger.Create(user, password);

                obj.AddUserToAspUserRole(user.Id, obj.GetRoleGUID(Convert.ToInt16(4)));
                #endregion

                return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                // BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
                return(Json(new { Result = "Fail", Message = "Error, Could not save user. Please try again" }, JsonRequestBehavior.AllowGet));
            }
        }