protected void RefreshProgress(object sender, AjaxEventArgs e) { int progress = CurrentStep; int maxCount = CurrentStepCount; if (progress >= 0) { prgProcess.UpdateProgress(Convert.ToSingle(progress) / Convert.ToSingle(maxCount), string.Format("任务处理中({0}/{1})...", progress.ToString(), maxCount)); } else if (progress == -2) { ScriptManager1.AddScript("{0}.stopTask('longactionprogress');", TaskManager1.ClientID); prgProcess.UpdateProgress(1, "任务被取消!"); } else { ScriptManager1.AddScript("{0}.stopTask('longactionprogress');", TaskManager1.ClientID); prgProcess.UpdateProgress(1, "任务完成!"); } }
private void ReSendPayment(string dataType) { CurrentStep = 0; CurrentStepCount = 0; prgProcess.Text = ""; int clientChannleID = Convert.ToInt32(this.hidClientChannelID.Text); SPClientChannelSettingWrapper clientChannelSetting = SPClientChannelSettingWrapper.FindById(clientChannleID); if (!(clientChannelSetting.SyncData.HasValue && clientChannelSetting.SyncData.Value)) { Ext.Msg.Alert("错误", "该通道无法同步数据"); prgProcess.Hide(); return; } int maxChangeCount = Convert.ToInt32(hidMaxChangeCount.Text); int recordCount = 0; DataSet ds = SPPaymentInfoWrapper.FindAllPaymentIDByDateAndType(System.DateTime.Now.Date, System.DateTime.Now.Date, clientChannleID, dataType, maxChangeCount); List <UrlSendTask> tasks = new List <UrlSendTask>(); foreach (DataRow dr in ds.Tables[0].Rows) { SPPaymentInfoWrapper payment = SPPaymentInfoWrapper.FindById(dr[SPPaymentInfoWrapper.PROPERTY_NAME_ID]); if (payment != null && CheckPaymentIsDataType(payment, dataType)) { payment.IsIntercept = false; payment.IsSycnData = true; payment.SycnRetryTimes = 0; payment.SucesssToSend = false; SPPaymentInfoWrapper.Update(payment); tasks.Add(payment.BulidSendTask()); } } if (tasks.Count <= 0) { Ext.Msg.Alert("错误", "没有需要重发的数据"); prgProcess.Hide(); return; } ThreadPool.QueueUserWorkItem(LongAction, tasks); ScriptManager1.AddScript("{0}.startTask('longactionprogress');", TaskManager2.ClientID); }
protected void btnResetIntercept_Click(object sender, AjaxEventArgs e) { try { CurrentStep = 0; CurrentStepCount = 0; prgProcess.Text = ""; int clientChannleID = Convert.ToInt32(this.hidClientChannelID.Text); SPClientChannelSettingWrapper clientChannelSetting = SPClientChannelSettingWrapper.FindById(clientChannleID); if (!(clientChannelSetting.SyncData.HasValue && clientChannelSetting.SyncData.Value)) { Ext.Msg.Alert("错误", "该通道无法同步数据"); winProgress.Hide(); return; } int maxChangeCount = Convert.ToInt32(hidMaxChangeCount.Text); int recordCount = 0; DataSet ds = SPPaymentInfoWrapper.FindAllPaymentIDByDateAndType(System.DateTime.Now.Date, System.DateTime.Now.Date, clientChannleID, DataType.Intercept.ToString(), maxChangeCount); List <UrlSendTask> tasks = new List <UrlSendTask>(); foreach (DataRow dr in ds.Tables[0].Rows) { SPPaymentInfoWrapper payment = SPPaymentInfoWrapper.FindById(dr[SPPaymentInfoWrapper.PROPERTY_NAME_ID]); if (payment != null && payment.IsIntercept.HasValue && payment.IsIntercept.Value) { payment.IsIntercept = false; payment.IsSycnData = true; payment.SycnRetryTimes = 0; payment.SucesssToSend = false; SPPaymentInfoWrapper.Update(payment); tasks.Add(payment.BulidSendTask()); } } ThreadPool.QueueUserWorkItem(LongAction, tasks); ScriptManager1.AddScript("{0}.startTask('longactionprogress');", TaskManager1.ClientID); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; } }