Ejemplo n.º 1
0
        public ActionResult FilterContactRecoveredDistributor()
        {
            var       listStatusCare = StatusCareRepository.GetAll();
            const int total          = 2;
            var       array          = new List <List <StatusCareInfo> >();

            for (var i = 0; i < total; i++)
            {
                var divice = (int)Math.Ceiling((double)listStatusCare.Count / (total - i));
                array.Add(listStatusCare.Take(divice).ToList());
                listStatusCare.RemoveRange(0, divice);
            }
            ViewBag.ArrayStatusCare = array;
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult FilterContactHandover()
        {
            // Check account user form
            var status = StoreData.CheckAccountUseHandover(EmployeeType.Consultant);

            // ImportExcelCCs
            var importExcels = ImportExcelRepository.FilterForCampain(UserContext.GetDefaultBranch(), (int)SourceType.CC);

            foreach (var item in importExcels)
            {
                item.FilePath = (new FileInfo(item.FilePath)).Name;
            }
            ViewBag.Channels       = ChannelRepository.GetAll();
            ViewBag.ImportExcelCCs = importExcels;
            ViewBag.StatusMessage  = status;
            ViewBag.StatusCares    = StatusCareRepository.GetAll();
            ViewBag.StatusMaps     = StatusMapRepository.GetAll();

            return(View(new ContactCreateModel()));
        }
Ejemplo n.º 3
0
        public static T Create <T>(ContactInfo info) where T : BCModelContact
        {
            var objModel = Activator.CreateInstance(typeof(T)) as BCModelContact;

            if (objModel == null)
            {
                return(default(T));
            }

            objModel.Id           = info.Id;
            objModel.Code         = info.Code;
            objModel.Email        = info.Email;
            objModel.Location     = info.Address;
            objModel.Fullname     = info.Fullname;
            objModel.Level        = Enum.GetName(typeof(LevelType), info.LevelId);
            objModel.SourceType   = Enum.GetName(typeof(SourceType), info.TypeId);
            objModel.HandoverDate = info.HandoverConsultantDate != null
                ? info.HandoverConsultantDate.Value.ToString("dd/MM/yyyy")
                : string.Empty;

            objModel.HandoverDistributorDate = info.HandoverCollaboratorDate != null
                ? info.HandoverCollaboratorDate.Value.ToString("dd/MM/yyyy")
                : info.RegisteredDate != null?info.RegisteredDate.Value.ToString("dd/MM/yyyy") : string.Empty;

            // Phone
            var phones = PhoneRepository.GetByContact(info.Id);

            if (phones != null)
            {
                var phoneEntity = phones.FirstOrDefault(phone => phone.IsPrimary > 0) ?? phones.FirstOrDefault();
                if (phoneEntity != null)
                {
                    objModel.Mobile = phoneEntity.PhoneNumber;
                }
            }

            // StatusCare
            var statusCare = StatusCareRepository.GetAll().FirstOrDefault(c => c.Id == info.StatusCareConsultantId);

            if (statusCare != null)
            {
                objModel.StatusCare = statusCare.Name;
            }

            // StatusMap
            var statusMap = StatusMapRepository.GetAll().FirstOrDefault(c => c.Id == info.StatusMapConsultantId) ??
                            StatusMapRepository.GetInfo(info.StatusMapConsultantId);

            if (statusMap != null)
            {
                objModel.StatusMap = statusMap.Name;
            }

            // Notes
            if (info.CallInfoConsultant.IsStringNullOrEmpty())
            {
                var callHistories = CallHistoryRepository.GetAllByContactId(info.Id);
                if (!callHistories.IsNullOrEmpty())
                {
                    objModel.Notes = callHistories.Last().CallCenterInfo;
                }
            }
            else
            {
                objModel.Notes = info.CallInfoConsultant;
            }

            // Channel
            if (objModel.SourceType == Enum.GetName(typeof(SourceType), Core.SourceType.MO))
            {
                var channel = ChannelRepository.GetAll().FirstOrDefault(c => c.ChannelId == info.ChannelId) ??
                              ChannelRepository.GetInfo(info.ChannelId);
                if (channel != null)
                {
                    objModel.Channel = channel.Name;
                }
            }
            else if (objModel.SourceType == Enum.GetName(typeof(SourceType), Core.SourceType.CC))
            {
                if (info.UserCollaboratorId > 0)
                {
                    var user = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserCollaboratorId);
                    if (user != null)
                    {
                        objModel.Channel = user.FullName;
                    }
                }
            }
            else
            {
                if (info.ChannelId == 1)
                {
                    if (info.UserCollaboratorId > 0)
                    {
                        var user = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserCollaboratorId);
                        if (user != null)
                        {
                            objModel.Channel = user.FullName;
                        }
                    }
                }
                if (objModel.Channel.IsStringNullOrEmpty())
                {
                    var channel = ChannelRepository.GetAll().FirstOrDefault(c => c.ChannelId == info.ChannelId) ??
                                  ChannelRepository.GetInfo(info.ChannelId);
                    if (channel != null)
                    {
                        objModel.Channel = channel.Name;
                    }
                }
            }

            // Consultant
            var consultant = StoreData.ListUser.FirstOrDefault(c => c.UserID == info.UserConsultantId) ??
                             UserRepository.GetInfo(info.UserConsultantId);

            if (consultant != null)
            {
                objModel.Consultant = consultant.FullName;
            }

            return((T)objModel);
        }