public void invite_Click(object sender, EventArgs e) { List <string> invitations = new List <string>(); List <string> failures = new List <string>(); ExceptionCollection exceptions = new ExceptionCollection(); foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray())) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim())) { continue; } try { TransitAccount existing = SessionManager.AccountService.FindByEmail( SessionManager.Ticket, email); exceptions.Add(new Exception(string.Format( "<a href='AccountView.aspx?id={0}'>{2} <{3}></a> is a member! " + "<a href='AccountFriendRequestEdit.aspx?pid={0}&ReturnUrl={1}'>» Add to Friends</a>", existing.Id, Request.Url.PathAndQuery, existing.Name, email))); continue; } catch { } try { MailAddress address = new MailAddress(email); TransitAccountInvitation invitation = new TransitAccountInvitation(); invitation.Code = Guid.NewGuid().ToString(); invitation.Email = email; invitation.Message = inputMessage.Text; invitation.AccountId = SessionManager.AccountId; SessionManager.CreateOrUpdate <TransitAccountInvitation>( invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation); invitations.Add(email); } catch (Exception ex) { failures.Add(email); exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex)); } } if (invitations.Count > 0) { noticeManage.Info = string.Format("{0} invitation{1} sent", invitations.Count, invitations.Count == 1 ? string.Empty : "s"); } GetData(sender, e); inputEmailAddress.Text = string.Join("\n", failures.ToArray()); exceptions.Throw(); }
public static void Test(this SmartFormatter formatter, string format, object[][] bunchOfArgs, string[] bunchOfExpected) { var allErrors = new ExceptionCollection(); // We will defer all errors until the end. var numberOfTests = Math.Max(bunchOfArgs.Length, bunchOfExpected.Length); for (int i = 0; i < numberOfTests; i++) { var args = bunchOfArgs[i % bunchOfArgs.Length]; var expected = bunchOfExpected[i % bunchOfExpected.Length]; string actual = null; try { actual = formatter.Format(format, args); Assert.AreEqual(expected, actual); Console.WriteLine("Success: \"{0}\" => \"{1}\"", format, actual); } catch (Exception ex) { Console.WriteLine("Error: \"{0}\" => \"{1}\"", format, actual); allErrors.Add(ex); } } allErrors.ThrowIfNotEmpty(); }
public static void Test(this SmartFormatter formatter, string[] bunchOfFormat, object[] args, string[] bunchOfExpected) { var allErrors = new ExceptionCollection(); var numberOfTests = Math.Max(bunchOfFormat.Length, bunchOfExpected.Length); for (int i = 0; i < numberOfTests; i++) { var format = bunchOfFormat[i % bunchOfFormat.Length]; var expected = bunchOfExpected[i % bunchOfExpected.Length]; string actual = null; try { var specificCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-us"); actual = formatter.Format(specificCulture, format, args); Assert.AreEqual(expected, actual); Console.WriteLine("Success: \"{0}\" => \"{1}\"", format, actual); } catch (Exception ex) { Console.WriteLine("Error: \"{0}\" => \"{1}\"", format, actual); allErrors.Add(ex); } } allErrors.ThrowIfNotEmpty(); }
public static void TestAppend(string[] bunchOfFormat, object[] args, string[] bunchOfExpected) { var allErrors = new ExceptionCollection(); var numberOfTests = Math.Max(bunchOfFormat.Length, bunchOfExpected.Length); for (int i = 0; i < numberOfTests; i++) { var format = bunchOfFormat[i % bunchOfFormat.Length]; var expected = bunchOfExpected[i % bunchOfExpected.Length]; string actual = null; try { var builder = new StringBuilder(); builder.AppendSmart(format, args); actual = builder.ToString(); Assert.AreEqual(expected, actual); Console.WriteLine("Success: \"{0}\" => \"{1}\"", format, actual); } catch (Exception ex) { Console.WriteLine("Error: \"{0}\" => \"{1}\"", format, actual); allErrors.Add(ex); } } allErrors.ThrowIfNotEmpty(); }
public static void Test(this SmartFormatter formatter, string format, object[][] bunchOfArgs, string[] bunchOfExpected) { var allErrors = new ExceptionCollection(); // We will defer all errors until the end. var numberOfTests = Math.Max(bunchOfArgs.Length, bunchOfExpected.Length); for (int i = 0; i < numberOfTests; i++) { var args = bunchOfArgs[i%bunchOfArgs.Length]; var expected = bunchOfExpected[i%bunchOfExpected.Length]; string actual = null; try { actual = formatter.Format(format, args); Assert.AreEqual(expected, actual); Console.WriteLine("Success: \"{0}\" => \"{1}\"", format, actual); } catch (Exception ex) { Console.WriteLine("Error: \"{0}\" => \"{1}\"", format, actual); allErrors.Add(ex); } } allErrors.ThrowIfNotEmpty(); }
public static void Test(this SmartFormatter formatter, string[] bunchOfFormat, object[] args, string[] bunchOfExpected) { var allErrors = new ExceptionCollection(); var numberOfTests = Math.Max(bunchOfFormat.Length, bunchOfExpected.Length); for (int i = 0; i < numberOfTests; i++) { var format = bunchOfFormat[i%bunchOfFormat.Length]; var expected = bunchOfExpected[i%bunchOfExpected.Length]; string actual = null; try { var specificCulture = CultureInfo.CreateSpecificCulture("en-us"); actual = formatter.Format(specificCulture, format, args); Assert.AreEqual(expected, actual); Console.WriteLine("Success: \"{0}\" => \"{1}\"", format, actual); } catch (Exception ex) { Console.WriteLine("Error: \"{0}\" => \"{1}\"", format, actual); allErrors.Add(ex); } } allErrors.ThrowIfNotEmpty(); }
public void invite_Click(object sender, EventArgs e) { List<string> invitations = new List<string>(); List<string> failures = new List<string>(); ExceptionCollection exceptions = new ExceptionCollection(); foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray())) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim())) continue; try { TransitAccount existing = SessionManager.AccountService.FindByEmail( SessionManager.Ticket, email); exceptions.Add(new Exception(string.Format( "<a href='AccountView.aspx?id={0}'>{2} <{3}></a> is a member! " + "<a href='AccountFriendRequestEdit.aspx?pid={0}&ReturnUrl={1}'>» Add to Friends</a>", existing.Id, Request.Url.PathAndQuery, existing.Name, email))); continue; } catch { } try { MailAddress address = new MailAddress(email); TransitAccountInvitation invitation = new TransitAccountInvitation(); invitation.Code = Guid.NewGuid().ToString(); invitation.Email = email; invitation.Message = inputMessage.Text; invitation.AccountId = SessionManager.AccountId; SessionManager.CreateOrUpdate<TransitAccountInvitation>( invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation); invitations.Add(email); } catch (Exception ex) { failures.Add(email); exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex)); } } if (invitations.Count > 0) { noticeManage.Info = string.Format("{0} invitation{1} sent", invitations.Count, invitations.Count == 1 ? string.Empty : "s"); } GetData(sender, e); inputEmailAddress.Text = string.Join("\n", failures.ToArray()); exceptions.Throw(); }
/// <summary> /// Performs the action for each item, catching all exceptions into an ExceptionCollection. /// </summary> public static ExceptionCollection TryAll <TSource>(this IEnumerable <TSource> sources, Action <TSource> action) { var errors = new ExceptionCollection(); foreach (var source in sources) { try { action(source); } catch (Exception ex) { errors.Add(ex); } } return(errors); }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountPicture p = new TransitAccountPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.Hidden = true; int id = SessionManager.CreateOrUpdate <TransitAccountPicture>( p, SessionManager.AccountService.CreateOrUpdateAccountPicture); Size size = t.GetNewSize(new Size(200, 200)); inputBody.Content = string.Format("<a href=AccountPictureView.aspx?id={2}><img border=0 width={0} height={1} src=AccountPicture.aspx?id={2}></a>\n{3}", size.Width, size.Height, id, inputBody.Content); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } exceptions.Throw(); } } catch (Exception ex) { ReportException(ex); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountEventPicture p = new TransitAccountEventPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Picture = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.AccountEventId = RequestId; SessionManager.CreateOrUpdate <TransitAccountEventPicture>( p, SessionManager.EventService.CreateOrUpdateAccountEventPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } gridManage.CurrentPageIndex = 0; gridManage_OnGetDataSource(sender, e); gridManage.DataBind(); exceptions.Throw(); Redirect(string.Format("AccountEventView.aspx?id={0}", RequestId)); } catch (Exception ex) { ReportException(ex); } }
public void send_Click(object Sender, EventArgs e) { if (string.IsNullOrEmpty(inputEmailAddress.Text)) { throw new Exception("Missing E-Mail"); } TransitAccountEmailMessage message = new TransitAccountEmailMessage(); message.Body = GetContent(); message.Subject = inputSubject.Text; message.DeleteSent = true; ExceptionCollection exceptions = new ExceptionCollection(); List <string> invalidemails = new List <string>(); foreach (string address in inputEmailAddress.Text.Split("\n".ToCharArray())) { if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(address.Trim())) { continue; } try { message.MailTo = new MailAddress(address.Trim()).ToString(); SessionManager.AccountService.CreateOrUpdateAccountEmailMessage( SessionManager.Ticket, message); } catch (Exception ex) { invalidemails.Add(address); exceptions.Add(new Exception(string.Format("Error sending message to \"{0}\".\n{1}", address.Trim(), ex.Message), ex)); } } inputEmailAddress.Text = string.Join("\n", invalidemails.ToArray()); exceptions.Throw(); Redirect(Url); }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountPicture p = new TransitAccountPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.Hidden = false; SessionManager.CreateOrUpdate <TransitAccountPicture>( p, SessionManager.AccountService.CreateOrUpdateAccountPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } GetData(sender, e); exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }
private void OnSeqRun() { for (int i = stopIndex; i < Count; i++) { if (IsRun) { try { this[i].Single(); System.Diagnostics.Debug.WriteLine("testing " + i); } catch (Exception exp) { this[i].CleanUp(); ExceptionCollection.Add(exp); IsRun = IsRunWhenException; } if (ProgressReporter != null) { ProgressReporter.Invoke(i); } } else { stopIndex = i; System.Diagnostics.Debug.WriteLine(stopIndex); break; } } if (SeqFinish != null) { SeqFinish.Invoke(); IsRuning = false; } }
public void invite_Click(object sender, EventArgs e) { List<string> invitations = new List<string>(); List<string> failures = new List<string>(); ExceptionCollection exceptions = new ExceptionCollection(); foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray())) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim())) continue; try { // account is a member TransitAccount existing = SessionManager.AccountService.FindByEmail( SessionManager.Ticket, email); TransitAccountGroupAccountInvitation t_instance = new TransitAccountGroupAccountInvitation(); t_instance.AccountId = existing.Id; t_instance.AccountGroupId = GroupId; t_instance.Message = inputMessage.Text; t_instance.RequesterId = SessionManager.Account.Id; SessionManager.GroupService.CreateOrUpdateAccountGroupAccountInvitation( SessionManager.Ticket, t_instance); continue; } catch { } try { MailAddress address = new MailAddress(email); TransitAccountInvitation invitation = new TransitAccountInvitation(); invitation.Code = Guid.NewGuid().ToString(); invitation.Email = email; invitation.Message = inputMessage.Text; invitation.AccountId = SessionManager.AccountId; invitation.AccountGroupId = GroupId; SessionManager.CreateOrUpdate<TransitAccountInvitation>( invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation); invitations.Add(email); } catch (Exception ex) { failures.Add(email); exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex)); } } if (invitations.Count > 0) { ReportInfo(string.Format("{0} invitation{1} sent", invitations.Count, invitations.Count == 1 ? string.Empty : "s")); } inputEmailAddress.Text = string.Join("\n", failures.ToArray()); exceptions.Throw(); }
public void invite_Click(object sender, EventArgs e) { List <string> invitations = new List <string>(); List <string> failures = new List <string>(); ExceptionCollection exceptions = new ExceptionCollection(); foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray())) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim())) { continue; } try { // account is a member TransitAccount existing = SessionManager.AccountService.FindByEmail( SessionManager.Ticket, email); TransitAccountGroupAccountInvitation t_instance = new TransitAccountGroupAccountInvitation(); t_instance.AccountId = existing.Id; t_instance.AccountGroupId = GroupId; t_instance.Message = inputMessage.Text; t_instance.RequesterId = SessionManager.Account.Id; SessionManager.GroupService.CreateOrUpdateAccountGroupAccountInvitation( SessionManager.Ticket, t_instance); continue; } catch { } try { MailAddress address = new MailAddress(email); TransitAccountInvitation invitation = new TransitAccountInvitation(); invitation.Code = Guid.NewGuid().ToString(); invitation.Email = email; invitation.Message = inputMessage.Text; invitation.AccountId = SessionManager.AccountId; invitation.AccountGroupId = GroupId; SessionManager.CreateOrUpdate <TransitAccountInvitation>( invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation); invitations.Add(email); } catch (Exception ex) { failures.Add(email); exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex)); } } if (invitations.Count > 0) { ReportInfo(string.Format("{0} invitation{1} sent", invitations.Count, invitations.Count == 1 ? string.Empty : "s")); } inputEmailAddress.Text = string.Join("\n", failures.ToArray()); exceptions.Throw(); }
public List <Dyncard> fetchDynamics() { List <Dyncard> dynss = new List <Dyncard>(); string jstring = sess.getBiliUserDynamicJson(uid); try { JObject jb = (JObject)JsonConvert.DeserializeObject(jstring); if (jb.Value <int>("code") != 0) { throw new ApiRemoteException(jb); } if (jb == null || jb["data"] == null || jb["data"]["cards"] == null) { return(new List <Dyncard>()); } ExceptionCollection excpts = new ExceptionCollection(); foreach (JToken jobj in jb["data"]["cards"]) { try { JObject j = (JObject)jobj; JObject card = (JObject)JsonConvert.DeserializeObject(j["card"].ToString()); Dyncard dyn = new Dyncard { dynid = j["desc"].Value <long>("dynamic_id"), sendtime = TimestampHandler.GetDateTime(j["desc"].Value <long>("timestamp")), type = j["desc"].Value <int>("type"), view = j["desc"].Value <int>("view"), repost = j["desc"].Value <int>("repost"), like = j["desc"].Value <int>("like"), rid = j["desc"].Value <long>("rid") }; if (j["desc"]["user_profile"]["info"]["uname"] != null)//如果给了更多信息,就直接用上 { dyn.sender = new BiliUser(j["desc"]["user_profile"]["info"].Value <int>("uid"), j["desc"]["user_profile"]["info"].Value <string>("uname"), "未知", j["desc"]["user_profile"].Value <string>("sign"), false, 0, j["desc"]["user_profile"]["info"].Value <string>("face"), j["desc"]["user_profile"]["level_info"].Value <int>("current_level"), 0, new BiliUser.OfficialInfo(), sess); } else//如果没有信息就从缓存抓取 if (BiliUser.userlist.ContainsKey(j["desc"]["user_profile"]["info"].Value <int>("uid"))) { dyn.sender = BiliUser.getUser(j["desc"]["user_profile"]["info"].Value <int>("uid"), sess); //使用用户数据缓存来提高速度 //因为监听的是同一个账号,所以缓存命中率超高 } else//如果缓存未命中,就拿获得的UID抓取剩余信息 { dyn.sender = BiliUser.getUser(j["desc"]["user_profile"]["info"].Value <int>("uid"), sess); } if (j["desc"]["orig_type"] != null) { dyn.origintype = j["desc"].Value <int>("orig_type"); } if (card["origin"] != null) { dyn.card_origin = (JObject)JsonConvert.DeserializeObject(card["origin"].ToString()); } switch (dyn.type) { case 1: //普通动态 case 4: //?出现在转发和普通动态 dyn.dynamic = card["item"].Value <string>("content"); if (dyn.dynamic.Length > 23) { dyn.short_dynamic = dyn.dynamic.Substring(0, 20) + "..."; } else { dyn.short_dynamic = dyn.dynamic; } break; case 2: //图片 dyn.dynamic = card["item"].Value <string>("description"); if (dyn.dynamic.Length > 23) { dyn.short_dynamic = dyn.dynamic.Substring(0, 20) + "..."; } else { dyn.short_dynamic = dyn.dynamic; } break; case 256: //音频 break; case 8: //视频 dyn.vinfo = new Videoinfo { bvid = j["desc"].Value <string>("bvid"), title = card.Value <string>("title"), discription = card.Value <string>("desc") }; if (dyn.vinfo.discription.Length > 23) { dyn.vinfo.short_discription = dyn.vinfo.discription.Substring(0, 20) + "..."; } else { dyn.vinfo.short_discription = dyn.vinfo.discription; } dyn.vinfo.av = j["desc"].Value <int>("rid"); dyn.dynamic = card.Value <string>("dynamic"); break; default: break; } dynss.Add(dyn); } catch (Exception err) { excpts.Add(err); } } if (excpts.Count > 0) { throw excpts; } //while (dynss.Count > 5) //{ // dynss.RemoveAt(5); //} return(dynss); } catch (ExceptionCollection) { throw; } catch (Exception err) { throw new UnexpectedResultException(jstring, err); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) return; ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountStoryPicture p = new TransitAccountStoryPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Picture = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.AccountStoryId = RequestId; SessionManager.CreateOrUpdate<TransitAccountStoryPicture>( p, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } GetData(sender, e); exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) return; ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountPicture p = new TransitAccountPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.Hidden = true; int id = SessionManager.CreateOrUpdate<TransitAccountPicture>( p, SessionManager.AccountService.CreateOrUpdateAccountPicture); Size size = t.GetNewSize(new Size(200, 200)); inputBody.Content = string.Format("<a href=AccountPictureView.aspx?id={2}><img border=0 width={0} height={1} src=AccountPicture.aspx?id={2}></a>\n{3}", size.Width, size.Height, id, inputBody.Content); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }
private void OnSeqRun() { var testStepList = ManualConnectionList[currentConnIndex].TestStepList; for (int i = stopIndex; i < testStepList.Count; i++) { if (IsRun) { if (testStepList[i].IsTest) { try { if (StepStart != null) { StepStart.Invoke(i); } testStepList[i].DetailProgressReport = (traceIndex, markerIndex) => { if (PointFinish != null) { PointFinish.Invoke(i, traceIndex, markerIndex); } }; testStepList[i].RunState = () => GetRunState(); if (!GeneTestSetup.Instance.IsSimulated) { //set path config if (pathConfig == null) { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty"); } else { string configName = testStepList[i].PathConfigName; if (string.IsNullOrWhiteSpace(configName)) { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty"); } else { var config = testStepList[i].GetPathConfigInfo(configName); if (config != null) { string configValue = config.Path; string[] pathConfigList = pathConfig.GetPathConfigNameList(); if (pathConfigList != null && pathConfigList.Contains(configValue)) { pathConfig.SetPathConfig(configValue); } else { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " " + configValue + " path is not found"); throw (new Exception(testStepList[i].DisplayName + " " + configValue + " path is not found")); } } } } } DataUtils.LOGINFO.WriteLog(DateTime.Now.ToString() + testStepList[i].DisplayName + " single start"); testStepList[i].Single(); DataUtils.LOGINFO.WriteLog(DateTime.Now.ToString() + testStepList[i].DisplayName + " single finish"); if (!GeneTestSetup.Instance.IsSimulated) { if (pathConfig == null) { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty"); } else { string configName = testStepList[i].PathConfigName; if (string.IsNullOrWhiteSpace(configName)) { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty"); } else { var config = testStepList[i].GetPathConfigInfo(configName); if (config != null) { string configValue = config.Path; string[] pathConfigList = pathConfig.GetPathConfigNameList(); if (pathConfigList != null && pathConfigList.Contains(configValue)) { pathConfig.PostPathConfig(configValue); } else { DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " " + configValue + " path is not found"); throw (new Exception(testStepList[i].DisplayName + " " + configValue + " path is not found")); } } } } } testStepList[i].CalcStepInfo(); //更新连接步骤中的passfail ManualConnectionList[currentConnIndex].PassFail = Symtant.GeneFunLib.GeneFun.NullBoolAndList(testStepList.Select(x => x.PassFail).ToList()); if (StepFinish != null) { StepFinish.Invoke(i); } } catch (Exception exp) { testStepList[i].CleanUp(); ExceptionCollection.Add(exp); IsRun = IsRunWhenException; } } } else { stopIndex = i; System.Diagnostics.Debug.WriteLine(stopIndex); break; } } if (DXSplashScreen.IsActive) { DXSplashScreen.Close(); } IsRuning = false; if (SeqFinish != null) { SeqFinish.Invoke(); } }
public void send_Click(object Sender, EventArgs e) { if (string.IsNullOrEmpty(inputEmailAddress.Text)) { throw new Exception("Missing E-Mail"); } TransitAccountEmailMessage message = new TransitAccountEmailMessage(); message.Body = GetContent(); message.Subject = inputSubject.Text; message.DeleteSent = true; ExceptionCollection exceptions = new ExceptionCollection(); List<string> invalidemails = new List<string>(); foreach (string address in inputEmailAddress.Text.Split("\n".ToCharArray())) { if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(address.Trim())) continue; try { message.MailTo = new MailAddress(address.Trim()).ToString(); SessionManager.AccountService.CreateOrUpdateAccountEmailMessage( SessionManager.Ticket, message); } catch (Exception ex) { invalidemails.Add(address); exceptions.Add(new Exception(string.Format("Error sending message to \"{0}\".\n{1}", address.Trim(), ex.Message), ex)); } } inputEmailAddress.Text = string.Join("\n", invalidemails.ToArray()); exceptions.Throw(); Redirect(Url); }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) return; ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountGroupPicture p = new TransitAccountGroupPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.AccountGroupId = RequestId; SessionManager.CreateOrUpdate<TransitAccountGroupPicture>( p, SessionManager.GroupService.CreateOrUpdateAccountGroupPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } gridManage.CurrentPageIndex = 0; gridManage_OnGetDataSource(sender, e); gridManage.DataBind(); exceptions.Throw(); Redirect(string.Format("AccountGroupView.aspx?id={0}", RequestId)); } catch (Exception ex) { ReportException(ex); } }