private int UpdateHWTaskResourceList(HWESightTask hwtask, DeployPackageTaskDetail deployProgress)
 {
     /*
      * bool isFinsihed = false;
      * int finishedCnt = 0;
      * IList<HWTaskResource> resourceList = HWTaskResourceDal.Instance.FindTaskResourceByTaskId(hwtask.ID);
      * Dictionary<string, DeviceProgress> dviDict = new Dictionary<string, DeviceProgress>();
      * foreach (DeviceProgress deviceProgress in deployProgress.DeviceDetails)
      * {
      * dviDict[deviceProgress.DeviceDn.ToUpper()] = deviceProgress;
      * }
      * foreach (HWTaskResource hwResource in resourceList)
      * {
      * DeviceProgress deviceProgress = dviDict[hwResource.DN.ToUpper()];
      * hwResource.DeviceResult = deviceProgress.DeviceResult;
      * hwResource.DeviceProgress = deviceProgress.Progress;
      * hwResource.ErrorDetail = deviceProgress.ErrorDetail;
      * hwResource.TaskType = ConstMgr.HWESightTask.TASK_TYPE_DEPLOY;
      * hwResource.SyncStatus = hwtask.SyncStatus;
      * hwResource.LastModifyTime = System.DateTime.Now;
      * HWTaskResourceDal.Instance.UpdateEntity(hwResource);
      * if (deviceProgress.Progress == 100) finishedCnt++;
      * }
      * if (resourceList.Count > 0)
      * return (finishedCnt * 100) / resourceList.Count;
      * else
      * return 0;*/
     return(0);
 }
        private void SaveDeployProgressToDB(QueryObjectResult <DeployPackageTaskDetail> queryObjectResult, string taskName)
        {
            //sync to the database.
            DeployPackageTaskDetail deployProgress = queryObjectResult.Data;
            HWESightTask            hwtask         = HWESightTaskDal.Instance.FindTaskByName(this.ESSession.HWESightHost.ID, taskName);

            hwtask.TaskStatus = deployProgress.TaskStatus;

            hwtask.TaskResult = deployProgress.TaskResult;
            //hwtask.TaskCode = deployProgress.TaskCode;
            //hwtask.ErrorDetail = deployProgress.ErrorDetail;

            hwtask.LastModifyTime = System.DateTime.Now;

            //find child device in database.
            int progress = UpdateHWTaskResourceList(hwtask, deployProgress);

            if (progress > 0)
            {
                hwtask.TaskProgress = progress;// deployProgress.TaskProgress;
            }
            if (deployProgress.TaskProgress > 0)
            {
                hwtask.TaskProgress = deployProgress.TaskProgress;
            }
            if (progress == 100)
            {
                hwtask.SyncStatus = ConstMgr.HWESightTask.SYNC_STATUS_FINISHED;
            }

            hwtask.SyncStatus = GetTaskStatus(hwtask.SyncStatus, deployProgress.TaskStatus, deployProgress.TaskResult);
            HWESightTaskDal.Instance.UpdateEntity(hwtask);
        }
Exemplo n.º 3
0
        public void QueryDeployTaskProcessTest()
        {
            _esSession.Open();
            var packageTask = new { taskName = "API@Task_1456209500919" };
            WebOneESightParam <dynamic> packageParam = new WebOneESightParam <dynamic>();

            packageParam.ESightIP = "127.0.0.1";
            packageParam.Param    = packageTask;
            LogUtil.HWLogger.API.Info("QueryDeployTaskProcessTest packageParam:" + JsonUtil.SerializeObject(packageParam));

            DeployPackageTaskDetail taskDetail            = _esSession.BasePackageWorker.QueryDeployTaskProcess(packageTask.taskName);
            WebReturnResult <DeployPackageTaskDetail> ret = new WebReturnResult <DeployPackageTaskDetail>();

            ret.Code        = 0;
            ret.Description = "";
            ret.Data        = taskDetail;
            LogUtil.HWLogger.API.Info("QueryDeployTaskProcessTest basePackageProcess:" + JsonUtil.SerializeObject(ret));
        }