protected void btnLanzador_Click(object sender, EventArgs e) { if (!DatosOk()) { return; } int pT = 0; // primary total int pV = 0; // primary value int pP = 0; // primary percent int sT = 0; // secondary total int sV = 0; // secondary value int sP = 0; // secondary percent // this happens for every company RadProgressContext context = RadProgressContext.Current; sT = instalacion.Dispositivos.Count; context.SecondaryTotal = sT; context.CurrentOperationText = "Generando las revisiones..."; foreach (Dispositivo dsp in instalacion.Dispositivos) { sV++; sP = (int)(decimal)((sV / sT) * 100.0); if (dsp.Operativo == true && !dsp.Caducado) { context.SecondaryValue = sV; context.SecondaryPercent = sP; // por cada dispositivo sacar las revisiones CntLainsaSci.ProgramarRevisiones(dsp, ctx); } } RadWindowManager1.RadAlert("Generación finalizada", null, null, "ATENCION", "noHaceNada"); }
private void UpdateProgressContext2() { const int total = 100; RadProgressContext progress = RadProgressContext.Current; for (int i = 0; i < total; i++) { progress.PrimaryTotal = 1; progress.PrimaryValue = 1; progress.PrimaryPercent = 100; progress.SecondaryTotal = total; progress.SecondaryValue = i; progress.SecondaryPercent = i; progress.CurrentOperationText = "Quiebres Canal AASS"; if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } progress.Speed = i; //Stall the current thread for 0.1 seconds System.Threading.Thread.Sleep(100); } }
/// <summary> /// Sets the complete process info. /// </summary> private void SetCompleteProcessInfo() { Page.Session["ProcessRunning"] = null; RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["ProcessCompleted"] = "True"; }
/// <summary> /// Gets the arguements from the handler to set the progress indicator. /// </summary> /// <param name="args">The args.</param> private void JobProgressHandler(DeDupJobEventArgs args) { RadProgressContext jobProgress = RadProgressContext.Current; string percent; try { percent = Convert.ToString(args.Job.ProgressInfo.Percent); } catch (Exception) { percent = "0"; } if (args.Job != null && args.Job.ProgressInfo.ProcessedCount < 2) { Page.Session["DeDupJobId"] = args.Job.JobId; } object processingMessageFormat = GetLocalResourceObject("processingMessage"); if (processingMessageFormat == null) { processingMessageFormat = "Processing record {0} of {1} - ({2}%)"; } jobProgress["PrimaryValue"] = String.Format((string)processingMessageFormat, args.Job.ProgressInfo.ProcessedCount, args.Job.ProgressInfo.RecordCount, percent); jobProgress["SecondaryTotal"] = args.Job.ProgressInfo.DuplicateCount.ToString(); if (args.Job.ProgressInfo.ErrorCount > 0) { } else { jobProgress["ProcessCompleted"] = "False"; } }
private void UpdateProgressContext() { const int total = 100; RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; for (int i = 0; i < total; i++) { progress.PrimaryTotal = 1; progress.PrimaryValue = 1; progress.PrimaryPercent = 100; progress.SecondaryTotal = total; progress.SecondaryValue = i; progress.SecondaryPercent = i; progress.CurrentOperationText = "Percentage complete: " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (total - i) * 100; //Stall the current thread for 0.1 seconds System.Threading.Thread.Sleep(100); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Do not display SelectedFilesCount progress indicator. RadProgressArea1.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount; RadProgressArea1.ProgressIndicators = ProgressIndicators.CurrentFileName | ProgressIndicators.FilesCount | ProgressIndicators.FilesCountBar | ProgressIndicators.FilesCountPercent | ProgressIndicators.RequestSize | ProgressIndicators.TimeElapsed | ProgressIndicators.TimeEstimated | ProgressIndicators.TotalProgress | ProgressIndicators.TotalProgressBar | ProgressIndicators.TotalProgressPercent | ProgressIndicators.TransferSpeed; RadProgressArea1.Localization["UploadedFiles"] = "Processed "; RadProgressArea1.Localization["TotalFiles"] = ""; RadProgressArea1.Localization["CurrentFileName"] = "File: "; RadProgressContext progress = RadProgressContext.Current; //Prevent the secondary progress from appearing when the file is uploaded (FileCount etc.) progress["SecondaryTotal"] = "0"; progress["SecondaryValue"] = "0"; progress["SecondaryPercent"] = "0"; } }
private static void RadProgress(RadProgressContext context, int n) { context.SecondaryValue = n; context.SecondaryPercent = (n / 9) * 100; //context.CurrentOperationText += "Doing step " + n.ToString(); //context.TimeEstimated = 100 - (n / 6) * 100; }
private void LooongMethodWhichUpdatesTheProgressContext(UploadedFile file) { const int total = 100; RadProgressContext progress = RadProgressContext.Current; for (int i = 0; i < total; i++) { progress.PrimaryTotal = 1; progress.PrimaryValue = 1; progress.PrimaryPercent = 100; progress.SecondaryTotal = total; progress.SecondaryValue = i; progress.SecondaryPercent = i; progress.CurrentOperationText = file.GetName() + " Empezando a procesar..."; if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } //Stall the current thread for 0.1 seconds System.Threading.Thread.Sleep(100); } }
public bool EnvioCorreo(string Email, string Nombre, string Titulo) { bool resultado; string tipo = ""; Mail mail = new Mail(ContextoApp.mailConfiguration); try { //envio correo // mail.addToAddress(Email, Nombre); RadProgressContext progress = RadProgressContext.Current; tipo = "application/pdf"; mail.addAttachment(info, Titulo, tipo); if (String.IsNullOrEmpty(Email)) { UtilMensajes.MensajeResultadoDB(rnMensaje, "No cuentas con dirección de correo electrónico.", E_TIPO_RESPUESTA_DB.WARNING, pCallBackFunction: ""); } else { string body = ContextoCorreo.CuerpoMensaje; mail.Send("Buen día" + " " + Titulo, String.Format(body, ContextoCorreo.encabezado, "Estimado(a): ", " " + Titulo, "Anexamos el documento de la solicitud requerida para tu comodidad, no olvides imprimir en hojas recicladas!! Cuidemos el medio ambiente", ContextoCorreo.pie)); } UtilMensajes.MensajeResultadoDB(rnMensaje, "Proceso exitoso", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pCallBackFunction: ""); resultado = true; } catch (Exception) { resultado = false; } return(resultado); }
/// <summary> /// Gets the arguements from the handler to set the progress indicator. /// </summary> /// <param name="args">The args.</param> private void ImportHandler(ImportProgressArgs args) { //ImportManager importManager = Page.Session["testimportManager"] as ImportManager; TestResultsInfo testResultInfo = GetTestResultInfo(); RadProgressContext importProgress = RadProgressContext.Current; importProgress["PrimaryPercent"] = Convert.ToString(Math.Round(Decimal.Divide(args.ProcessedCount, args.RecordCount) * 100)); importProgress["PrimaryValue"] = String.Format("({0})", args.ProcessedCount); importProgress["PrimaryTotal"] = String.Format("({0})", args.RecordCount); //importProgress["SecondaryTotal"] = String.Format("{0} Duplicates:{1}", args.ErrorCount, args.DuplicateCount); importProgress["ProcessCompleted"] = "False"; testResultInfo.TotalRecords = args.RecordCount.ToString(); testResultInfo.TotalRecordsProcessed = args.ProcessedCount.ToString(); testResultInfo.TotalDuplicates = args.DuplicateCount.ToString(); testResultInfo.TotalWarnings = args.WarningCount.ToString(); testResultInfo.TotalTotalMerged = args.MergeCount.ToString(); testResultInfo.TotalErrors = args.ErrorCount.ToString(); try { if (args.RecordCount == 0) { testResultInfo.ProjectedDuplicateRate = string.Format("{0:P}", 0); } else { testResultInfo.ProjectedDuplicateRate = string.Format("{0:P}", Decimal.Divide(args.DuplicateCount, args.RecordCount)); } } catch (Exception) { } SaveTestResultInfo(testResultInfo); LoadResults(); }
protected void Page_Load(object sender, EventArgs e) { // allows the javascript function to do a postback and call the onClick method // associated with the linkButton LinkButton1. string jscript = "function UploadComplete(){"; jscript += string.Format("__doPostBack('{0}','');", LinkButton1.ClientID.Replace("_", "$")); jscript += "};"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "FileCompleteUpload", jscript, true); if (!IsPostBack) { //Do not display SelectedFilesCount progress indicator. RadProgressArea1.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount; RadProgressArea1.Localization["UploadedFiles"] = "Processed "; RadProgressArea1.Localization["TotalFiles"] = ""; RadProgressArea1.Localization["CurrentFileName"] = "File: "; RadProgressContext progress = RadProgressContext.Current; //Prevent the secondary progress from appearing when the file is uploaded (FileCount etc.) progress["SecondaryTotal"] = "0"; progress["SecondaryValue"] = "0"; progress["SecondaryPercent"] = "0"; } }
/// <summary> /// Handles the OnClick event of the cmdCompleted control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void cmdCompleted_OnClick(object sender, EventArgs e) { Page.Session["ProcessRunning"] = null; RadProgressContext importProgress = RadProgressContext.Current; importProgress["ProcessCompleted"] = "True"; ProcessStatus.Value = "Completed"; }
private static void RadProgress(RadProgressContext context, int n, int total, string nombre) { context.CurrentOperationText = "Importando dispositivo ... " + nombre; context.SecondaryValue = n; int x = n / total * 100; context.SecondaryPercent = x; }
/// <summary> /// Sets the complete process info. /// </summary> private void SetCompleteProcessInfo() { RadProgressContext insertProgress = RadProgressContext.Current; insertProgress["ProcessCompleted"] = "True"; Page.Session["ImportingLeads"] = "True"; Thread.Sleep(1000); }
private void LoadView() { if (Job != null) { if (String.IsNullOrEmpty(Job.JobId)) { using (new SessionScopeWrapper(true)) { IDeDupJobProcess job = GetJob(); if (job != null) { if (string.IsNullOrEmpty(job.JobId)) { IDeDupService srv = ApplicationContext.Current.Services.Get <IDeDupService>(); string jobId = srv.SubmitJob(job); Page.Session["DeDupJobId"] = jobId; } ThreadPoolHelper.QueueTask(StartJobProcess); } } } try { lnkJobNumber.Text = String.Format("{0}", Job.ProgressInfo.JobNumber); switch (Job.ProcessState) { case DeDupJobProcessState.Aborted: break; case DeDupJobProcessState.Completed: { cmdAbort.Visible = false; lblHeader.Text = String.Format(GetLocalResourceObject("CompletedMsg").ToString()); Page.Session["DeDupJob"] = null; RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["ProcessCompleted"] = "True"; jobProgress["OperationComplete"] = "True"; } break; default: cmdAbort.Visible = true; lblHeader.Text = String.Format(GetLocalResourceObject("lblPrimary_Progress.Caption").ToString()); lblHeader2.Text = String.Format(GetLocalResourceObject("ProcessingMsg").ToString()); break; } } catch (Exception) { } } else { RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["OperationComplete"] = "True"; GoToDeDupManager(); } }
private void ProcessLanguage(IEnumerable <TabInfo> pageList, Locale locale, int languageCount, int totalLanguages) { RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; progress.PrimaryTotal = totalLanguages; progress.PrimaryValue = languageCount; int total = pageList.Count(); if (total == 0) { progress.SecondaryTotal = 0; progress.SecondaryValue = 0; progress.SecondaryPercent = 100; } for (int i = 0; i < total; i++) { TabInfo currentTab = pageList.ElementAt(i); int stepNo = i + 1; progress.SecondaryTotal = total; progress.SecondaryValue = stepNo; float secondaryPercent = ((float)stepNo / (float)total) * 100; progress.SecondaryPercent = Convert.ToInt32(secondaryPercent); float primaryPercent = ((((float)languageCount + ((float)stepNo / (float)total)) / (float)totalLanguages)) * 100; progress.PrimaryPercent = Convert.ToInt32(primaryPercent); progress.CurrentOperationText = string.Format(Localization.GetString("ProcessingPage", LocalResourceFile), locale.Code, stepNo, total, currentTab.TabName); if (!Response.IsClientConnected) { //clear cache DataCache.ClearPortalCache(PortalId, true); //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (total - stepNo) * 100; if (locale.Code == PortalDefault) { TabController.Instance.LocalizeTab(currentTab, locale, true); } else { TabController.Instance.CreateLocalizedCopy(currentTab, locale, false); } if (i % 10 == 0) { KeepConnectionAlive(); } } }
public void EnvioCorreo(string Email, string Mensaje, string Asunto) { Mail mail = new Mail(ContextoApp.mailConfiguration); mail.addToAddress(Email, ""); RadProgressContext progress = RadProgressContext.Current; mail.Send(Asunto, String.Format("{0}", Mensaje)); }
private string EnvioCorreo(string pEmail, string pMensaje, string pAsunto) { Mail mail = new Mail(ContextoApp.mailConfiguration); mail.addToAddress(pEmail, ""); RadProgressContext progress = RadProgressContext.Current; string vResultado = mail.SendCopia(pAsunto, String.Format("{0}", pMensaje)); return(vResultado); }
/// <summary> /// Sets the start process info. /// </summary> private void SetStartProcessInfo() { Page.Session["ProcessRunning"] = true; RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["PrimaryValue"] = "0"; jobProgress["SecondaryValue"] = "0"; jobProgress["SecondaryTotal"] = "0"; jobProgress["ProcessCompleted"] = "False"; }
/// <summary> /// Sets the start process info. /// </summary> private void SetStartProcessInfo() { RadProgressContext insertProgress = RadProgressContext.Current; insertProgress["PrimaryPercent"] = "0"; insertProgress["PrimaryValue"] = "0"; insertProgress["PrimaryTotal"] = "0"; insertProgress["SecondaryValue"] = "0"; insertProgress["SecondaryTotal"] = "0"; insertProgress["ProcessCompleted"] = "False"; }
protected void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e) { if (e.Command.Equals("UploadFile")) { RadProgressContext context = RadProgressContext.Current; context.SecondaryTotal = "100"; for (int i = 1; i < 100; i++) { // A very time consumming task context.SecondaryValue = i.ToString(); context.SecondaryPercent = i.ToString(); context.CurrentOperationText = "Doing step " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } // simulate a long time performing the current step System.Threading.Thread.Sleep(100); } try { //create the purgeResult object HostSite.Web.UI.ServiceReference1.PurgeResult r = new HostSite.Web.UI.ServiceReference1.PurgeResult(); HostSite.Web.UI.ServiceReference1.PurgeApiClient a; a = new HostSite.Web.UI.ServiceReference1.PurgeApiClient(); string[] options = new string[4]; string[] uri = new string[1]; //get the login credential and other data for Akamai from the web.config options[0] = ConfigurationManager.AppSettings["AkamaiCCUEmail"].ToString(); options[1] = ConfigurationManager.AppSettings["AkamaiCCUAction"].ToString(); options[2] = ConfigurationManager.AppSettings["AkamaiCCUType"].ToString(); options[3] = ConfigurationManager.AppSettings["AkamaiCCUDomain"].ToString(); //build the URL to the file that was uploaded uri[0] = "http://www.yourdomain.com" + e.Path; //request the content purge r = a.purgeRequest(ConfigurationManager.AppSettings["AkamaiCCUUserName"].ToString(), ConfigurationManager.AppSettings["AkamaiCCUPassword"].ToString(), "", options, uri); //log the activity Web.Core.Context.Current.LogMessage("Akamai CCU WebService Message: " + r.resultCode + " " + r.resultMsg + " " + r.sessionID + " " + uri[0].ToString()); } catch (Exception ex) { //something didn't work so let's report the issue Web.Core.Context.Current.LogMessage("Error Akamai CCU WebService Message: ", ex); } } }
/// <summary> /// Raises the <see cref="E:PreRender"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnPreRender(EventArgs e) { foreach (WizardStep step in wzdDeDup.WizardSteps) { SetStep(step); } RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["OperationComplete"] = "True"; jobProgress["ProcessCompleted"] = "True"; }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; try { Page.Culture = Request.Cookies["CultureInfo"].Value; gClass.LanguageCode = Request.Cookies["LanguageCode"].Value; gClass.OrganizationCode = Request.Cookies["OrganizationCode"].Value; txtHApplicationURL.Value = Request.Url.Scheme + "://" + Request.Url.Host + Request.ApplicationPath + "/"; bodyImportExport.Style.Add("Direction", Request.Cookies["Direction"].Value); if (gClass.IsUserLogoned(Session.SessionID, Request.Cookies["UserPracticeCode"].Value, Request.Url.Host)) { if (!IsPostBack) { //Do not display SelectedFilesCount progress indicator. RadProgressArea1.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount; RadProgressArea1.Localization["UploadedFiles"] = "Processed "; RadProgressArea1.Localization["TotalFiles"] = ""; RadProgressArea1.Localization["CurrentFileName"] = "File: "; RadProgressContext progress = RadProgressContext.Current; //Prevent the secondary progress from appearing when the file is uploaded (FileCount etc.) progress["SecondaryTotal"] = "0"; progress["SecondaryValue"] = "0"; progress["SecondaryPercent"] = "0"; gClass.SaveUserLogFile(Request.Cookies["UserPracticeCode"].Value, Request.Cookies["Logon_UserName"].Value, Request.Url.Host, "Import/Export Data Form", 2, "Browse", "", ""); } } else { gClass.ReturnToLoginPage(Request.Url.Host, Request.Cookies["LanguageCode"].Value, Response); } } catch (Exception err) { string strLanguageCode; try { strLanguageCode = Request.Cookies["LanguageCode"].Value; gClass.AddErrorLogData(Request.Cookies["UserPracticeCode"].Value, Request.Url.Host, Request.Cookies["Logon_UserName"].Value, "Import/Export Page (Second stage)", " (Page_Load function)", err.ToString()); } catch { strLanguageCode = "en-US"; } gClass.ReturnToLoginPage(Request.Url.Host, strLanguageCode, Response); } }
/// <summary> /// Gets the arguements from the handler to set the progress indicator. /// </summary> /// <param name="args">The args.</param> private void InsertTargetHandler(InsertProgressArgs args) { RadProgressContext insertProgress = RadProgressContext.Current; insertProgress["PrimaryPercent"] = Convert.ToString(Math.Round(Decimal.Divide(args.ProcessedCount, args.RecordCount) * 100)); insertProgress["PrimaryValue"] = String.Format("({0})", args.ProcessedCount.ToString()); insertProgress["PrimaryTotal"] = String.Format("({0})", args.RecordCount.ToString()); insertProgress["SecondaryValue"] = String.Format("({0})", args.InsertedCount.ToString()); insertProgress["SecondaryTotal"] = String.Format("({0})", args.ErrorCount.ToString()); insertProgress["ProcessCompleted"] = "False"; Thread.Sleep(1000); }
/// <summary> /// Handles the OnClick event of the cmdAbort control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void cmdAbort_OnClick(object sender, EventArgs e) { string jobId = GetJobId(); DeDupService.AbortJob(jobId); Page.Session["DeDupJob"] = null; RadProgressContext jobProgress = RadProgressContext.Current; jobProgress["OperationComplete"] = "True"; GoToDeDupManager(); }
protected void btnLanzador_Click(object sender, EventArgs e) { int pT = 0; // primary total int pV = 0; // primary value int pP = 0; // primary percent int sT = 0; // secondary total int sV = 0; // secondary value int sP = 0; // secondary percent // this happens for every company RadProgressContext context = RadProgressContext.Current; sT = ctx.Empresas.Count(); context.SecondaryTotal = pT; context.CurrentOperationText = "Generando los informes y documentos..."; string repodir = ConfigurationManager.AppSettings["Repositorio"]; IList <NombreInforme> nombres = CntInforme.GetNombresDeInforme(); pT = nombres.Count; foreach (Empresa empresa in ctx.Empresas) { sV++; sP = (int)(decimal)((sV / sT) * 100.0); context.SecondaryValue = sV; context.SecondaryPercent = sP; // por cada instalacion hay que sacar el informe foreach (Instalacion instalacion in empresa.Instalaciones) { pV = 0; foreach (NombreInforme ninf in nombres) { pV++; pP = (int)(decimal)((pV / pT) * 100.0); context.PrimaryValue = pV; context.PrimaryPercent = pP; CntInforme.ElaborarInformesProgramados((DateTime)rdtFecha.SelectedDate, ninf.Informe, instalacion, repodir, ctx); } } } //Documentos de las Revisiones y Dispositivos por filtro foreach (Filtro filtro in usuario.Filtros) { if (filtro.Tipo == "Revision" || filtro.Tipo == "Dispositivo") { AplicarFiltro(filtro, filtro.Tipo); CrearInforme(filtro, repodir); } } }
/// <summary> /// Called when the dialog is closing. /// </summary> protected override void OnClosing() { RadProgressContext importProgress = RadProgressContext.Current; importProgress["PrimaryPercent"] = "0"; importProgress["PrimaryValue"] = "0"; importProgress["ProcessCompleted"] = "False"; ContextService.RemoveContext("TestResultsInfo"); //hdStartTest.Value = "false"; //DialogService.DialogParameters.Remove("startTest"); base.OnClosing(); }
private void ProcessLanguage(List <TabInfo> pageList, Locale locale, int languageCount, int totalLanguages) { try { RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; progress.PrimaryTotal = totalLanguages; progress.PrimaryValue = languageCount; int total = pageList.Count; for (int i = 0; i <= total - 1; i++) { TabInfo currentTab = pageList[i]; int stepNo = i + 1; progress.SecondaryTotal = total; progress.SecondaryValue = stepNo; float secondaryPercent = ((float)stepNo / (float)total) * 100; progress.SecondaryPercent = Convert.ToInt32(secondaryPercent); float primaryPercent = ((((float)languageCount + ((float)stepNo / (float)total)) / (float)totalLanguages)) * 100; progress.PrimaryPercent = Convert.ToInt32(primaryPercent); progress.CurrentOperationText = string.Format(Localization.GetString("ProcessingPage", LocalResourceFile), locale.Code, stepNo, total, currentTab.TabName); if (!Response.IsClientConnected) { //clear cache DataCache.ClearPortalCache(PortalId, true); //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (total - stepNo) * 100; TabController.Instance.CreateLocalizedCopy(currentTab, locale, false); if ((i % 10) == 0) { KeepConnectionAlive(); } } PortalController.Instance.MapLocalizedSpecialPages(PortalId, locale.Code); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Gets the arguements from the handler to set the progress indicator. /// </summary> /// <param name="args">The args.</param> private void ImportHandler(ImportProgressArgs args) { RadProgressContext importProgress = RadProgressContext.Current; string percent; try { percent = Convert.ToString(Math.Round(Decimal.Divide(args.ProcessedCount, args.RecordCount) * 100)); importProgress["PrimaryPercent"] = percent; } catch (Exception) { percent = "0"; } if (args.ProcessedCount < 2) { if (args.ImportManager != null) { if (args.ImportManager.ImportHistory != null) { Page.Session["importHistoryId"] = args.ImportManager.ImportHistory.Id; } } } importProgress["PrimaryPercent"] = percent; importProgress["PrimaryValue"] = String.Format("({0})", args.ProcessedCount.ToString()); importProgress["PrimaryTotal"] = String.Format("({0})", args.RecordCount.ToString()); importProgress["SecondaryValue"] = args.ImportedCount.ToString(); importProgress["SecondaryTotal"] = String.Format("{0} Duplicates:{1} Merged:{2} ", args.ErrorCount, args.DuplicateCount, args.MergeCount); if (args.ErrorCount > 0) { importProgress["ProcessCompleted"] = "True"; ImportManager importManager = args.ImportManager; // Page.Session["importManager"] as ImportManager; if (importManager != null) { importManager.ImportHistory.ErrorCount = args.ErrorCount; importManager.ImportHistory.ProcessState = Enum.GetName(typeof(ImportProcessState), ImportProcessState.Completed); //importManager.ImportHistory. args.Message SetProcessState(importManager.ImportHistory.Id.ToString(), Enum.GetName(typeof(ImportProcessState), ImportProcessState.Abort), GetLocalResourceObject("AbortedMsg").ToString()); } } else { importProgress["ProcessCompleted"] = "False"; } //Thread.Sleep(10000); }
private static void CargarTipoAnomalias(SqlCeConnection conn, LainsaSci ctx, RadProgressContext context) { var rs = from ta in ctx.TipoAnomalias select ta; string texto = context.CurrentOperationText.ToString(); foreach (TipoAnomalia ta in rs) { String.Format("{0}{1}", texto, ta.TipoAnomaliaId); TTipoAnomalia tta = new TTipoAnomalia(); tta.TipoAnomaliaId = ta.TipoAnomaliaId; tta.Nombre = ta.Nombre; CntSciTerminal.TSave(tta, conn); } }