public async IAsyncEnumerable <VisaInfo> GetVisaInfos( DateTime dateFrom, DateTime dateTo, string city, int dailyAmount, Func <DayOfWeek, bool> isWorkingDay, Action eachItemWait) { var currentDate = dateFrom; while (currentDate <= dateTo) { if (!isWorkingDay(currentDate.DayOfWeek)) { currentDate = currentDate.AddDays(1); continue; } for (var i = 1; i <= dailyAmount; i++) { var statementNumber = statementNumberGenerator.Generate(city, currentDate, i); var visaResult = await visaResultLoader.LoadVisaResultByStatementNumber(statementNumber); var visaInfo = new VisaInfo(city, visaResult, statementNumber, currentDate); yield return(visaInfo); eachItemWait(); } currentDate = currentDate.AddDays(1); } }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { var row = dataGridView1.CurrentRow; if (dataGridView1.CurrentCell.ColumnIndex == dataGridView1.Columns["QRCodeImage"].Index) { if (!string.IsNullOrEmpty((string)row.Cells["EnglishName"].Value) && !string.IsNullOrEmpty((string)row.Cells["PassportNo"].Value)) { FrmQRCode frm = new FrmQRCode(row.Cells["EnglishName"].Value + "|" + row.Cells["PassportNo"].Value); frm.ShowDialog(); } } else { VisaInfo model = _bllVisaInfo.GetModel(Guid.Parse(dataGridView1.CurrentRow.Cells["VisaInfo_id"].Value.ToString())); if (model == null) { MessageBoxEx.Show(Resources.FindModelFailedPleaseCheckInfoCorrect); return; } FrmInfoTypeIn frm = new FrmInfoTypeIn(model, LoadDataToDataGridView, _curPage); frm.ShowDialog(); } } }
public void TestCreateFromString() { var date = new DateTime(2017, 04, 23); var expectedInfo = new VisaInfo("City", VisaResult.Success, "number", date); var stringInfo = "City 2017.04.23 number Success"; var actualInfo = new VisaInfo(stringInfo); Assert.That(actualInfo, Is.EqualTo(expectedInfo)); }
private void radButton2_Click(object sender, EventArgs e) { TravelAgency.BLL.VisaInfo bll = new VisaInfo(); this.radGridView1.DataSource = bll.GetListByPageOrderByHasChecked(1, 30); }
private void WriteToFile(VisaInfo info) { File.AppendAllText(fullFileName, $"{info.ToString()}\n"); }
private static void WriteToFile(string fileName, VisaInfo info) { File.AppendAllText(fileName, $"{info.ToString()}\n"); }
public static bool IsOutSigned(VisaInfo model) { return(model.IssuePlace != "云南" && model.IssuePlace != "四川" && model.IssuePlace != "贵州" && model.IssuePlace != "重庆"); }