/// <summary> 发送消息 </summary> /// <param name="message">消息内容</param> /// <param name="flush">清空缓冲池</param> /// <returns>一个任务。</returns> public async Task Send(DMessage message, bool flush = true) { var buffer = await GetByteBuffer(message, _address.Gzip); if (flush) { await _context.WriteAndFlushAsync(buffer); } else { await _context.WriteAsync(buffer); } }
/// <summary> 发送消息 </summary> /// <param name="message">消息内容</param> /// <param name="flush"></param> /// <returns>一个任务。</returns> public async Task Send(DMessage message, bool flush = true) { var buffer = await GetByteBuffer(message, _address.Gzip); //Counter.Send(buffer.ReadableBytes); if (flush) { //Counter.Call(); await _channel.WriteAndFlushAsync(buffer); } else { await _channel.WriteAsync(buffer); } }
public static readonly String m_newline = Environment.NewLine; //$NON-NLS-1$ public static void doShowStats(DebugCLI cli) { /* we do some magic casting */ Session session = cli.Session; System.Text.StringBuilder sb = new System.Text.StringBuilder(); try { PlayerSession p = (PlayerSession)session; DMessageCounter cnt = p.MessageCounter; sb.Append(LocalizationManager.getLocalizedTextString("key16")); //$NON-NLS-1$ sb.Append(m_newline); for (int i = 0; i <= DMessage.InSIZE; i++) { long amt = cnt.getInCount(i); if (amt > 0) { sb.Append('\n'); sb.Append(DMessage.inTypeName(i)); sb.Append(" = "); //$NON-NLS-1$ sb.Append(amt); } } sb.Append("\n\n"); //$NON-NLS-1$ sb.Append(LocalizationManager.getLocalizedTextString("key17")); //$NON-NLS-1$ sb.Append("\n"); //$NON-NLS-1$ for (int i = 0; i <= DMessage.OutSIZE; i++) { long amt = cnt.getOutCount(i); if (amt > 0) { sb.Append('\n'); sb.Append(DMessage.outTypeName(i)); sb.Append(" = "); //$NON-NLS-1$ sb.Append(amt); } } sb.Append('\n'); cli.output(sb.ToString()); } catch (NullReferenceException) { throw new InvalidOperationException(); } }
private void initialProcessing(int idx) { readyDataGrieView(); if (loadExistingAccountData()) { viewData(idx); buttonGrpEnabled(); buttonNew.Enabled = false; } else { DMessage.DataNotExistence("空の状態で表示します。"); buttonGrpDisabled(); buttonNew.Enabled = true; } }
private void loadEstimateData() { BillingOp blo = new BillingOp(); string wParam = "WHERE TaskEntryID = " + Convert.ToString(ted.TaskEntryID) + " ORDER BY VersionNo DESC"; DataTable dt = blo.UsingParamater_Select("D_Estimate", wParam); if (dt == null) { DMessage.SelectInvalid(); return; } DataRow dr = dt.Rows[0]; EstimateData estd = new EstimateData(dr); blo = new BillingOp(); wParam = " WHERE EstimateID = " + Convert.ToString(estd.EstimateID); dt = blo.UsingParamater_Select("D_EstimateCont", wParam); if (dt == null) { DMessage.SelectInvalid(); return; } edit_Labels(); readyDgv(dt.Rows.Count); for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; dataGridView1.Rows[i].Cells["ItemCode"].Value = Convert.ToString(dr["ItemCode"]); dataGridView1.Rows[i].Cells["Item"].Value = Convert.ToString(dr["Item"]); dataGridView1.Rows[i].Cells["ItemDetail"].Value = Convert.ToString(dr["ItemDetail"]); dataGridView1.Rows[i].Cells["Unit"].Value = Convert.ToString(dr["Unit"]); if (Convert.ToString(dr["Unit"]) != "") { dataGridView1.Rows[i].Cells["CQuantity"].Value = decPointFormat(Convert.ToDecimal(dr["Quantity"])); dataGridView1.Rows[i].Cells["CCost"].Value = decFormat(Convert.ToDecimal(dr["Cost"])); dataGridView1.Rows[i].Cells["CAmount"].Value = decFormat(Convert.ToDecimal(dr["Cost"]) * Convert.ToDecimal(dr["Quantity"])); dataGridView1.Rows[i].Cells["Quantity"].Value = dataGridView1.Rows[i].Cells["CQuantity"].Value; dataGridView1.Rows[i].Cells["Amount"].Value = dataGridView1.Rows[i].Cells["CAmount"].Value; } } reCalculateAll(); return; }
private void buttonAdd_Click(object sender, EventArgs e) { ted.TaskEntryID = 0; if (!string.IsNullOrEmpty(textBoxTaskName.Text)) { if (string.IsNullOrEmpty(labelTaskCode.Text) || ted == null) { ted.TaskEntryID = 0; ted.TaskCode = ""; ted.TaskName = comboBoxCostType.Text + textBoxTaskName.Text; ted.CostType = ""; ted.LeaderMCode = ""; //ted.PartnerCode = Convert.ToString( comboBoxPartner.SelectedValue ); ted.PartnerCode = ""; ted.SalesMCode = ""; ted.ContractDate = DateTime.MinValue; ted.StartDate = DateTime.MinValue; ted.EndDate = DateTime.MinValue; ted.TaskID = 0; ted.TaskIndID = 0; //ted.PartnerName = comboBoxPartner.Text; ted.PartnerName = textBoxPartner.Text; ted.TaskPlace = string.IsNullOrEmpty(textBoxTaskPlace.Text) ? "" : textBoxTaskPlace.Text; } if (string.IsNullOrEmpty(ted.TaskName)) { MessageBox.Show("業務名が指定されていません。"); return; } if (string.IsNullOrEmpty(ted.PartnerName)) { MessageBox.Show("取引先名を空白にはできません。"); return; } int entryID = ted.InsertTaskEntryData(ted); if (entryID < 0) { DMessage.DataExistence(); } ted.TaskEntryID = entryID; } this.Close(); }
public async Task Send(DMessage message, bool flush = true) { if (!(message is MessageResult result)) { return; } var data = await _encoder.EncodeAsync(result, _gzip); var contentLength = data.Length; _response.Headers.Add("Content-Type", "application/json"); _response.Headers.Add("Content-Length", contentLength.ToString()); await _response.Body.WriteAsync(data, 0, data.Length); if (flush) { await _response.Body.FlushAsync(); } }
private void initialProcessing() { readyDataGridView(dataGridViewL, dataGridViewR, dataGridViewT); if (loadExistingOsResultsData()) { cpg = 0; loadOsResultsContData(ord[cpg]); loadOsResultsSumData(ord[cpg]); reCalculateAll(dataGridViewL, dataGridViewR, dataGridViewT); viewOsResultsData(0); edit_lblPageNo(); buttonGrpEnabled(); buttonNew.Enabled = false; } else { DMessage.DataNotExistence("空の状態で表示します。"); buttonGrpDisabled(); buttonNew.Enabled = true; } }
static void Main(string[] args) { DMessage manyMessage; manyMessage = SayHello; manyMessage("Chandan"); manyMessage = SayGoodBye; manyMessage("Dharmesh"); DMessage multiMessage = new DMessage(SayHello); multiMessage += SayGoodBye; multiMessage += SayGoodBye; multiMessage("Chandan"); multiMessage("Dharmesh"); MessageWizard(SayHello); MessageWizard(SayGoodBye); }
public async Task Send(DMessage message, bool flush = true) { if (!(message is InvokeMessage invokeMessage)) { return; } var uri = new Uri(new Uri(_address.ToString()), "micro/executor"); var client = _clientFactory.CreateClient(); var req = new HttpRequestMessage(HttpMethod.Post, uri.AbsoluteUri); if (invokeMessage.Headers != null) { foreach (var header in invokeMessage.Headers) { req.Headers.Add(header.Key, header.Value); } } var codec = _provider.GetClientCodec(_address.Codec); var data = await codec.EncodeAsync(message, _address.Gzip); req.Content = new ByteArrayContent(data); if (_address.Gzip) { req.Content.Headers.ContentEncoding.Add("gzip"); } var resp = await client.SendAsync(req); if (!resp.IsSuccessStatusCode) { throw new SpearException($"服务请求异常,状态码{(int)resp.StatusCode}"); } var content = await resp.Content.ReadAsByteArrayAsync(); var result = await codec.DecodeAsync <MessageResult>(content, _address.Gzip); await _listener.OnReceived(this, result); }
// Wakamatsu 20170302 private void dateTimePicker_ValueChanged(object sender, EventArgs e) { if (iniPro) { return; } DateTimePicker dtp = ( DateTimePicker )sender; if (dtp.Name == "dateTimePickerTO") { if (dateTimePickerTO.Value < dateTimePickerFR.Value) { DMessage.Contradiction("日付の前後関係が"); dateTimePickerTO.Value = DateTime.Now; } } // Wakamatsu 20170302 dataGridView1.Rows.Clear(); dataGridView1.Rows.Add(iniRCnt); // Wakamatsu 20170302 }
static void Main(string[] args) { DMessage message = SayHello; message("Chandan"); message = SayGoodBye; message("Chandan"); Action <string> actionMessage = SayHello; actionMessage("Chandan"); actionMessage = SayGoodBye; actionMessage("Chandan"); MessageWizard(SayHello); MessageWizard(SayGoodBye); MessageWizard((name) => Console.WriteLine("OLA, {0}", name)); Func <int, double> f = (x) => x + x * x; Console.WriteLine("Answer is {0}", f(10)); Predicate <int> predicate = (x) => { if (x > 5) { return(true); } else { return(false); } }; Console.WriteLine("Predicate Answer = {0}", predicate(6)); }
private async Task ListenerOnReceived(IMessageSender sender, DMessage message) { if (!_resultDictionary.TryGetValue(message.Id, out var task)) { return; } if (message is MessageResult result) { if (result.Code != 200) { task.TrySetException(new SpearException(result.Message, result.Code)); } else { task.SetResult(result); } } if (_executor != null && message is InvokeMessage invokeMessage) { await _executor.Execute(sender, invokeMessage); } }
private void frmCache_Load(object sender, EventArgs e) { m_thread_message = DbMessage; m_closed = Connection_Closed; }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile() { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) try { using (oWBook = new XLWorkbook(fileName)) { if (tncA == null || tncA.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } // 編集 oWSheet = oWBook.Worksheet(1); // シートを開く readyExcelRows(tncA.Length, 4); int sNo = 5; for (int i = 0; i < tncA.Length; i++) { using (IXLRange SetRange = oWSheet.Range("A5:M5")) // テンプレートデータ行コピー/ペースト SetRange.CopyTo(oWSheet.Cell(sNo + i, 1)); if (i == 0) { officeName = tncA[i].OfficeName; oWSheet.Cell(2, 3).Value = DateTime.Today; oWSheet.Cell(3, 3).Value = officeName; } oWSheet.Cell(sNo + i, 1).Value = i + 1; oWSheet.Cell(sNo + i, 2).Value = tncA[i].TaskCode; oWSheet.Cell(sNo + i, 3).Value = tncA[i].TaskName; oWSheet.Cell(sNo + i, 4).Value = tncA[i].VersionNo; oWSheet.Cell(sNo + i, 5).Value = tncA[i].IssueDate; oWSheet.Cell(sNo + i, 6).Value = tncA[i].SalesMName; oWSheet.Cell(sNo + i, 7).Value = tncA[i].SalesMInputDate; oWSheet.Cell(sNo + i, 8).Value = tncA[i].Approval; oWSheet.Cell(sNo + i, 9).Value = tncA[i].ApprovalDate; oWSheet.Cell(sNo + i, 10).Value = tncA[i].MakeOrder; oWSheet.Cell(sNo + i, 11).Value = tncA[i].MakeOrderDate; oWSheet.Cell(sNo + i, 12).Value = tncA[i].ConfirmAdm; oWSheet.Cell(sNo + i, 13).Value = tncA[i].ConfirmDate; if (i != 0) { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.TopBorder = XLBorderStyleValues.Hair; } if (i == tncA.Length - 1) { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.BottomBorder = XLBorderStyleValues.Thin; } else { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.BottomBorder = XLBorderStyleValues.Hair; } } } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } Cursor.Current = Cursors.Default; // マウスカーソルを戻す System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf出力にする場合は、上記 System.DiafnosticsのLineをコメントアウトし、下記DateTime以下のコメントを外す。 // pdf file 出力 //DateTime now = DateTime.Now; //outputFile = System.IO.Path.GetDirectoryName( tempFile ) + @"\業務引継書承認未完了一覧表_" + officeName + "_" + "_" + now.ToString( "yyMMddHHmmss" ); //PublishExcelToPdf etp = new PublishExcelToPdf(); //etp.ExcelToPDF( tempFile, outputFile ); //if( File.Exists( tempFile ) ) File.Delete( tempFile ); }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile(string proc) { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) // Wakamatsu 20170313 try { using (oWBook = new XLWorkbook(fileName)) { // 編集 switch (procList.IndexOf(proc)) { case 0: case 1: if (pod == null || pod.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } //MessageBox.Show("Excel書込み開始"); if (proc == payoff) { oWSheet = oWBook.Worksheet(1); // シートを開く editOsPayOff(pod); // 起案書発行 } else { // Wakamatsu 20170313 //decimal sum = 0M; //int page = pod.Length / posRow; //if (pod.Length % posRow > 0) page++; //for (int i = 0; i < page; i++) //{ // oWSheet = oWBook.Worksheet(i + 1); // シートを開く // oWSheet.Cell(3, 5).Value = "'" + (i + 1).ToString() + "/" + page.ToString(); // sum = editOsPayOffS(pod, posRow * i, sum); // 起案書発行 //} oWSheet = oWBook.Worksheet(1); // シートを開く oWSheet.Cell(3, 5).Value = "'1/1"; editOsPayOffS(pod, posRow, 0); // 起案書発行 // Wakamatsu 20170313 } break; case 2: if (pmd == null || pmd.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } //MessageBox.Show("Excel書込み開始"); oWSheet = oWBook.Worksheet(1); // シートを開く editOsPayment(pmd); // 調書発行 break; default: break; } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } } catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } // Wakamatsu 20170313 Cursor.Current = Cursors.Default; // マウスカーソルを戻す //System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf file 出力 DateTime now = DateTime.Now; outputFile = System.IO.Path.GetDirectoryName(tempFile) + @"\" + pNameList[procList.IndexOf(proc)] + "_" + itemCode + "_" + now.ToString("yyMMddHHmmss"); PublishExcelToPdf etp = new PublishExcelToPdf(); // Wakamatsu 20170313 //etp.ExcelToPDF(tempFile, outputFile); if (etp.ExcelToPDF(tempFile, outputFile) == true) { if (File.Exists(tempFile)) { File.Delete(tempFile); } } }
private void button_Click(object sender, EventArgs e) { Button btn = ( Button )sender; if (btn.Name == "buttonClose") { this.Close(); return; } if (btn.Name == "buttonStoreMWorkItems") { if (formImpMWorkItems == null || formImpMWorkItems.IsDisposed) { formImpMWorkItems = new FormImpMWorkItems(hp); formImpMWorkItems.Show(); } else { MessageBox.Show(msgAlready); } return; } TaskEntryData itd = new TaskEntryData(); if (btn.Name == "buttonAdd") { //itd.OfficeCode = Convert.ToString( comboBoxOffice.SelectedValue ); //itd.Department = Convert.ToString( comboBoxDepartment.SelectedValue ); //itd.OfficeName = comboBoxOffice.Text; //itd.DepartName = comboBoxDepartment.Text; //labelTaskEntryID.Text = ""; } else { if (labelTaskEntryID.Text == "" || labelTaskEntryID.Text == "0") { DMessage.DataNotEnough(); return; } itd = itd.SelectTaskEntryData(Convert.ToInt32(labelTaskEntryID.Text)); itd.MemberCode = hp.MemberCode; itd.TaxRate = hp.TaxRate; itd.AdminCostRate = hp.AdminCostRate; itd.OthersCostRate = hp.OthersCostRate; itd.Expenses = hp.Expenses; itd.OfficeCode = Conv.OfficeCode; itd.Department = Conv.DepartCode; itd.PartnerName = labelPartner.Text; } switch (btn.Name) { case "buttonEstimate": formEstimate = new FormEstimate(itd); formEstimate.Show(); break; case "buttonPlanning": formPlanning = new FormPlanning(itd); formPlanning.Show(); break; case "buttonOsDetail": formOutsource = new FormOutsource(itd); formOutsource.Show(); break; case "buttonContract": formContract = new FormContract(itd); formContract.Show(); break; case "buttonRegular": formRegular = new FormRegular(itd); formRegular.Show(); break; case "buttonVolumeInvoice": formVolumeInvoice = new FormVolumeInvoice(itd); formVolumeInvoice.Show(); break; case "buttonInvoice": formInvoice = new FormInvoice(itd); formInvoice.Show(); break; //case "buttonDetail": // displayDetailLabel(ted); // break; case "buttonAdd": itd.OfficeCode = Conv.OfficeCode; itd.Department = Conv.DepartCode; itd.OfficeName = Conv.Office; itd.DepartName = Conv.Depart; labelTaskEntryID.Text = ""; itd = FormTaskEntry.DispData(itd); displayDetailLabel(itd); comboBoxCostType.Text = itd.CostType; textBoxTaskName.Text = itd.TaskName; labelPartner.Text = itd.PartnerName; labelTaskPlace.Text = itd.TaskPlace; labelTaskCode.Text = itd.TaskCode; labelTaskEntryID.Text = Convert.ToString(itd.TaskEntryID); // ? 仮版 : 正式版 labelTaskName.Text = (labelTaskCode.Text.Trim() == "") ? "": itd.TaskName; ListFormDataOp lo = new ListFormDataOp(); etcd = lo.SelectTaskEntryNameData(itd.OfficeCode, itd.Department, null); buttonTask.Enabled = string.IsNullOrEmpty(labelTaskCode.Text.Trim()) ? true : false; buttonTask.Visible = string.IsNullOrEmpty(labelTaskCode.Text.Trim()) ? true : false; break; case "buttonTask": if (String.IsNullOrEmpty(textBoxTaskName.Text)) { MessageBox.Show("対応する見積・計画用業務名がありません"); return; } tcds = FormTaskCodeNameList.ReceiveItems(tcd); if (!writeTaskCodeToTaskEntryData()) { return; } if (!displayTaskData(tcds)) { return; } break; default: break; } }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile() { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) // Wakamatsu 20170315 try { using (oWBook = new XLWorkbook(fileName)) { if (tla == null || tla.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } // 編集 oWSheet = oWBook.Worksheet(1); // シートを開く // Wakamatsu 20170315 //readyExcelRows(tla.Length, 5); readyExcelRows(tla.Length, 4); int sNo = 5; for (int i = 0; i < tla.Length; i++) { // Wakamatsu 20170315 using (IXLRange SetRange = oWSheet.Range("A5:I5")) // テンプレートデータ行コピー/ペースト SetRange.CopyTo(oWSheet.Cell(sNo + i, 1)); // Wakamatsu 20170315 if (i == 0) { officeName = tla[i].OfficeName; departName = tla[i].DepartName; // Wakamatsu 20170315 //oWSheet.Cell(1, 7).Value = DateTime.Today; oWSheet.Cell(2, 2).Value = DateTime.Today; oWSheet.Cell(3, 2).Value = officeName + " " + departName; // Wakamatsu 20170315 } oWSheet.Cell(sNo + i, 1).Value = tla[i].TaskCode; oWSheet.Cell(sNo + i, 2).Value = tla[i].TaskName; oWSheet.Cell(sNo + i, 3).Value = tla[i].PartnerName; oWSheet.Cell(sNo + i, 4).Value = tla[i].Contract; oWSheet.Cell(sNo + i, 5).Value = tla[i].StartDate; oWSheet.Cell(sNo + i, 6).Value = tla[i].EndDate; oWSheet.Cell(sNo + i, 7).Value = tla[i].SalesM; oWSheet.Cell(sNo + i, 8).Value = tla[i].LeaderM; oWSheet.Cell(sNo + i, 9).Value = tla[i].IssueDate; // Wakamatsu 20170315 if (i != 0) { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.TopBorder = XLBorderStyleValues.Hair; } if (i == tla.Length - 1) { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.BottomBorder = XLBorderStyleValues.Thin; } else { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.BottomBorder = XLBorderStyleValues.Hair; } // Wakamatsu 20170315 } } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } // Wakamatsu 20170315 catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } // Wakamatsu 20170315 Cursor.Current = Cursors.Default; // マウスカーソルを戻す //System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf file 出力 DateTime now = DateTime.Now; outputFile = System.IO.Path.GetDirectoryName(tempFile) + @"\業務一覧表_" + officeName + "_" + departName + "_" + now.ToString("yyMMddHHmmss"); PublishExcelToPdf etp = new PublishExcelToPdf(); etp.ExcelToPDF(tempFile, outputFile); if (File.Exists(tempFile)) { File.Delete(tempFile); } }
protected async Task <IByteBuffer> GetByteBuffer(DMessage message, bool gzip) { var data = await _messageEncoder.EncodeAsync(message, gzip); return(Unpooled.WrappedBuffer(data)); }
private void textBox_KeyDown(object sender, KeyEventArgs e) { if (iniPro) { return; } TextBox tb = (TextBox)sender; if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab) { switch (tb.Name) { case "textBoxSlipNo": if (textBoxSlipNo.Text == "") { DMessage.ValueErrMsg(); return; } if (!DHandling.IsNumeric(textBoxSlipNo.Text)) { DMessage.ValueErrMsg(); return; } if (curSlipNo == Convert.ToInt32(textBoxSlipNo.Text)) { return; } if (!dispCostReportData(Convert.ToInt32(textBoxSlipNo.Text))) { MessageBox.Show("指定された伝票番号のデータはありません"); return; } curSlipNo = Convert.ToInt32(textBoxSlipNo.Text); break; case "textBoxTaskCode": if (!dispTaskInformation(textBoxTaskCode.Text)) { MessageBox.Show("指定された業務番号のデータはありません"); } break; default: break; } } if ((e.Modifiers & Keys.Control) != Keys.Control) { return; // Ctrlキーが押下された時のみ以下処理 } switch (e.KeyCode) { case Keys.A: chooseTaskCodeNameData(); break; default: break; } }
public static void MessageWizard(DMessage message) { Console.WriteLine("Inside Message Wizard"); message("CHAMP Work Done"); }