예제 #1
0
        public ActionResult FilterContactToday()
        {
            #region "Start Checkpoint BEGIN_LOAD_LICH_LAM_VIEC_CONTACT"
            int SessionLog = TmpJobReportRepository.GetSessionLog();
            ViewBag.SessionLog = SessionLog;
            DateTime TimeBegin = DateTime.Now;
            ViewBag.TimeBegin = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff");

            var logbegin = new LogDashBoard
            {
                Date      = DateTime.Now.Date,
                Time      = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                Name      = "BEGIN_LOAD_LICH_LAM_VIEC_CONTACT",
                ContactId = 0,
                CreatedBy = UserContext.GetCurrentUser().UserID,
                Runtime   = "0",
                Session   = SessionLog,
            };

            LogDashBoardRepository.CreateLogDashBoard(logbegin);
            #endregion

            var branchId = UserContext.GetDefaultBranch();
            var userId   = UserContext.GetCurrentUser().UserID;

            var user         = UserContext.GetCurrentUser();
            var employeeType = user.IsCollaborator
                ? EmployeeType.Collaborator
                : user.IsConsultant ? EmployeeType.Consultant : EmployeeType.All;


            var levels = LevelRepository.GetAllWithContactCountForConsultant(userId, branchId, employeeType) ?? new List <LevelInfo>();
            foreach (var level in StoreData.ListLevel
                     .Where(c => !levels.Exists(p => p.LevelId == c.LevelId)))
            {
                levels.Add(level);
            }
            ViewBag.LevelWithContactCount = levels.OrderBy(c => c.LevelId).ToList();

            #region "Start Checkpoint END_CONTROLLER_LOAD_LICH_LAM_VIEC_CONTACT"
            DateTime TimeEnd = DateTime.Now;
            var      logend  = new LogDashBoard
            {
                Date      = DateTime.Now.Date,
                Time      = TimeEnd.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                Name      = "END_CONTROLLER_LOAD_LICH_LAM_VIEC_CONTACT",
                ContactId = 0,
                CreatedBy = UserContext.GetCurrentUser().UserID,
                Runtime   = "0",
                Session   = SessionLog,
            };

            LogDashBoardRepository.CreateLogDashBoard(logend);
            #endregion

            return(View());
        }
예제 #2
0
 public static void CreateLogDashBoard(LogDashBoard info)
 {
     info.Time = info.Time.Substring(11);
     try
     {
         DataProvider.Instance().LogDashBoard_Insert(info.Date, info.Time, info.ContactId, info.Name, info.CreatedBy, info.Runtime, info.Session);
     }
     catch
     {
     }
 }
예제 #3
0
        public void SaveEndLoadDashBoard(string time, int contactid, string name, int createdby, string timebegin, int session)
        {
            string _runtime   = (DateTime.Now - DateTime.ParseExact(timebegin, "dd/MM/yyyy HH:mm:ss:fff", CultureInfo.InvariantCulture)).ToString();
            var    logendform = new LogDashBoard
            {
                Date      = DateTime.Now.Date,
                Time      = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                Name      = name,
                ContactId = contactid,
                CreatedBy = createdby,
                Runtime   = "0",
                Session   = session,
            };

            LogDashBoardRepository.CreateLogDashBoard(logendform);
        }
예제 #4
0
        public CallHistoryInfo Call(int id, string mobile)
        {
            #region "Log Checkpoint - Begin Goi Den CallCenter 28/10/2016"
            int      SessionLog = TmpJobReportRepository.GetSessionLog();
            DateTime TimeBegin  = DateTime.Now;

            var logbegin = new LogDashBoard
            {
                Date      = DateTime.Now.Date,
                Time      = TimeBegin.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                Name      = "BEGIN_CALL_CONTACT_TVTS",
                ContactId = id,
                CreatedBy = UserContext.GetCurrentUser().UserID,
                Runtime   = "0",
                Session   = SessionLog,
            };

            LogDashBoardRepository.CreateLogDashBoard(logbegin);
            #endregion

            if (string.IsNullOrEmpty(mobile))
            {
                return(null);
            }
            var user = UserRepository.GetCurrentUserInfo();


            // Logs
            var log = new TmpLogServiceInfo
            {
                Time     = DateTime.Now,
                CallType = (int)CallType.Incoming,
            };

            try
            {
                //var item = HelpUtils.Call(mobile, user.StationId, user.UserName, StoreData.CallCenterSoapBinding);

                var item = HelpUtils.CallNew(mobile, user.StationId, user.UserName, StoreData.LinkCallCenter);

                #region "Log Checkpoint - End Goi Den CallCenter 28/10/2016"
                DateTime TimeEnd = DateTime.Now;
                var      logend  = new LogDashBoard
                {
                    Date      = DateTime.Now.Date,
                    Time      = TimeEnd.ToString("dd/MM/yyyy HH:mm:ss:fff"),
                    Name      = "END_CALL_CONTACT_TVTS",
                    ContactId = id,
                    CreatedBy = UserContext.GetCurrentUser().UserID,
                    Runtime   = "0",
                    Session   = SessionLog,
                    CallId    = item.call_id
                };
                LogDashBoardRepository.CreateLogDashBoard(logend);
                #endregion

                var entity = new CallHistoryInfo
                {
                    ContactId      = id,
                    StatusMapId    = 0,
                    StatusUpdate   = 1,
                    StatusCareId   = 0,
                    CallHistoryId  = 0,
                    RecallTime     = null,
                    CallTimeLength = 0,
                    Status         = item.status,
                    CallId         = item.call_id,
                    CreatedBy      = user.UserID,
                    CallTime       = DateTime.Now,
                    RingTime       = item.ringtime,
                    Duration       = item.duration,
                    CreatedDate    = DateTime.Now,
                    AgentCode      = item.agent_code,
                    ErrorCode      = item.error_code,
                    ErrorDesc      = item.error_desc,
                    StationId      = item.station_id,
                    CallCenterInfo = string.Empty,
                    MessageCode    = item.message_code,
                    MobilePhone    = item.mobile_phone,
                    LinkRecord     = item.link_down_record,
                    EndTime        = item.end_time.ToDateTime("yyyyMMddHHmmss"),
                    StartTime      = item.start_time.ToDateTime("yyyyMMddHHmmss"),
                    ResponseTime   = item.datetime_response.ToDateTime("yyyyMMddHHmmss"),
                    LogCallCenter  = item.log_callcenter
                };
                entity.CallHistoryId = CallHistoryRepository.Create(entity);

                // Logs
                log.Description = entity.LogCallCenter;
                log.Status      = 1; // ko lỗi
                TmpLogServiceRepository.Create(log);

                // Return
                return(entity);
            }
            catch (Exception ex)
            {
                // Logs
                log.Status      = 0; //lỗi
                log.Description = "CallHistories/Call, Mobile: " + mobile + ": " + ex.Message.ToString();
                TmpLogServiceRepository.Create(log);

                // Return
                return(null);
            }
        }