protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest && !IsPostBack) { SetExtLanguage(); HideShowButtons(); try { AccessControlApplier.ApplyAccessControlOnPage(typeof(Model.Employees.Profile.ImportEmployees), null, null, null, null); } catch (AccessDeniedException exp) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show(); Viewport1.Hidden = true; return; } BatchStatusRequest req = new BatchStatusRequest(); req.classId = ClassId.TAOT; RecordResponse <BatchOperationStatus> resp = _systemService.ChildGetRecord <BatchOperationStatus>(req); if (!resp.Success || resp.result == null) { return; } switch (resp.result.status) { case 0: Viewport1.ActiveIndex = 0; break; case 1: Viewport1.ActiveIndex = 1; this.ResourceManager1.AddScript("{0}.startTask('longactionprogress');", this.TaskManager1.ClientID); break; case 2: Viewport1.ActiveIndex = 1; this.ResourceManager1.AddScript("{0}.startTask('longactionprogress');", this.TaskManager1.ClientID); break; case 3: Viewport1.ActiveIndex = 2; break; default: Viewport1.ActiveIndex = 0; break; } } }
protected void RefreshProgress(object sender, DirectEventArgs e) { //object progress = _systemService.SessionHelper.Get("LongActionProgress"); double progress = 0; //object prep = _systemService.SessionHelper.Get("Preporcessing"); BatchStatusRequest req = new BatchStatusRequest(); req.classId = ClassId.TAOT; RecordResponse <BatchOperationStatus> resp = _systemService.ChildGetRecord <BatchOperationStatus>(req); if (resp.result == null) { return; } if (resp.result.status == 1 || resp.result.status == 2) { if (resp.result.tableSize == 0) { progress = 0; } else { progress = (double)resp.result.processed / resp.result.tableSize; } string prog = (float.Parse(progress.ToString()) * 100).ToString(); string message = resp.result.status == 2 ? GetLocalResourceObject("working").ToString() : GetLocalResourceObject("preprocessing").ToString(); this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100))); } else if (resp.result.status == 3) { //this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID); Viewport1.ActiveIndex = 2; } else if (resp.result.status == 0) { this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID); Viewport1.ActiveIndex = 0; } }