Esempio n. 1
0
        public ActionResult GetTAMData([DataSourceRequest] DataSourceRequest request, Can_TamScanLogModel model)
        {
            var service = new Can_TamServices();
            List<Guid> listOrgStructureID = new List<Guid>();

            DateTime dateFrom = DateTime.Now.Date;
            DateTime dateTo = DateTime.Now.Date;

            if (model.DateFrom.HasValue)
            {
                dateFrom = model.DateFrom.Value;
            }

            if (model.DateTo.HasValue)
            {
                dateTo = model.DateTo.Value;
            }

            model.AsynTaskID = service.CreateComputingTask(model.UserID,
                dateFrom, dateTo);

            if (model.ProfileID != null && model.ProfileID.Count > 0)
            {
                Task task = Task.Run(() => service.SyncTAMLog(model.UserID,
                    model.AsynTaskID, false, dateFrom, dateTo, model.ProfileID));
            }
            else
            {
                if (model.OrgStructureID != null)
                {
                    listOrgStructureID = model.OrgStructureID.Where(d => d.HasValue).Select(d => d.Value).ToList();
                }

                Task task = Task.Run(() => service.SyncTAMLog(model.UserID, model.AsynTaskID,
                    false, dateFrom, dateTo, listOrgStructureID, null, null));
            }

            return Json(model, JsonRequestBehavior.AllowGet);
        }
Esempio n. 2
0
        public string CheckConnectTAM()
        {
            var service = new Can_TamServices();
            string message = "";
            bool status = false;

            bool isconnect = service.IsConnected(AppConfig.HRM_SYS_CAN_TAMSCANLOG_1_, ref message);

            if (isconnect == true)
            {
                status = true;
            }
            else
            {
                status = false;
            }

            var sys_AllSetting = new Sys_AllSettingEntity();
            sys_AllSetting = LibraryService.GetSys_AllSettingByKey(Constant.HRM_SYS_COMPUTE_TAMLOG_CAN);
            string result = string.Empty;
            string DateFrom = string.Empty;
            string DateTo = string.Empty;

            if (sys_AllSetting != null)
            {
                DateFrom = sys_AllSetting.Value2 != null ? sys_AllSetting.Value2.ToString() : string.Empty;
                DateTo = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToString().Split(' ')[1] + " " + DateTime.Now.ToString().Split(' ')[2];
            }

            result = status.ToString() + "|" + DateFrom + "|" + DateTo;
            return result;
        }