private void 轉申請發行TXTToolStripMenuItem_Click(object sender, EventArgs e) { string fileTSE = "D:\\權證發行_相關Excel\\上傳檔\\TSE申請上傳檔.txt"; string fileOTC = "D:\\權證發行_相關Excel\\上傳檔\\OTC申請上傳檔.txt"; //TXTFileWriter tseWriter = new TXTFileWriter(fileTSE); //TXTFileWriter otcWriter = new TXTFileWriter(fileOTC); int tseCount = 0; int otcCount = 0; int tseReissue = 0; int otcReissue = 0; int tseReward = 0; int otcReward = 0; try { using (StreamWriter tseWriter = new StreamWriter(fileTSE, false, Encoding.GetEncoding("Big5"))) using (StreamWriter otcWriter = new StreamWriter(fileOTC, false, Encoding.GetEncoding("Big5"))) { string sql = @"SELECT a.ApplyKind ,a.Market ,a.WarrantName ,a.UnderlyingID ,a.IssueNum ,a.CR ,IsNull(CASE WHEN a.ApplyKind='2' THEN c.T ELSE b.T END,6) T ,a.Type ,a.CP ,CASE WHEN a.UseReward='Y' THEN '1' ELSE '0' END UseReward ,CASE WHEN a.MarketTmr='Y' THEN '1' Else '0' END MarketTmr FROM [EDIS].[dbo].[ApplyTotalList] a LEFT JOIN [EDIS].[dbo].[ApplyOfficial] b ON a.SerialNum=b.SerialNumber LEFT JOIN [EDIS].[dbo].[WarrantBasic] c ON a.WarrantName=c.WarrantName ORDER BY a.Market desc, a.Type, a.CP, a.UnderlyingID, a.SerialNum";//a.SerialNum //DataView dv = DeriLib.Util.ExecSqlQry(sql, GlobalVar.loginSet.edisSqlConnString); System.Data.DataTable dv = MSSQL.ExecSqlQry(sql, GlobalVar.loginSet.edisSqlConnString); if (dv.Rows.Count > 0) { foreach (DataRow dr in dv.Rows) { string applyKind = dr["ApplyKind"].ToString(); string market = dr["Market"].ToString(); string warrantName = dr["WarrantName"].ToString(); string underlyingID = dr["UnderlyingID"].ToString(); double issueNum = Convert.ToDouble(dr["IssueNum"]); double cr = Convert.ToDouble(dr["CR"]); int t = Convert.ToInt32(dr["T"]); string type = dr["Type"].ToString(); string cp = dr["CP"].ToString(); string useReward = dr["UseReward"].ToString(); string marketTmr = dr["MarketTmr"].ToString(); string markup = " "; int byteLen = System.Text.Encoding.Default.GetBytes(warrantName).Length; warrantName = warrantName + markup.Substring(0, 16 - byteLen); underlyingID = underlyingID.PadRight(12, ' '); string issueNumS = issueNum.ToString().PadLeft(7, '0'); //issueNumS = issueNumS.PadLeft(7, '0'); string crS = (cr * 10000).ToString(); crS = crS.Substring(0, Math.Min(5, crS.Length)); crS = crS.PadLeft(5, '0'); string tS = t.ToString().PadLeft(2, '0'); //tS = tS.PadLeft(2, '0'); string tempType = "1"; if (type == "牛熊證") { if (cp == "P") { tempType = "4"; } else { tempType = "3"; } } else { if (cp == "P") { tempType = "2"; } else { tempType = "1"; } } string writestr = warrantName + underlyingID + issueNumS + crS + tS + tempType + useReward + marketTmr; if (market == "TSE") { //tseWriter.WriteFile(writestr); tseWriter.WriteLine(writestr); tseCount++; if (useReward == "1") { tseReward++; } if (applyKind == "2") { tseReissue++; } } else if (market == "OTC") { //otcWriter.WriteFile(writestr); otcWriter.WriteLine(writestr); otcCount++; if (useReward == "1") { otcReward++; } if (applyKind == "2") { otcReissue++; } } } } } string infoStr = $"TSE 共{tseCount}檔,增額{tseReissue}檔,獎勵{tseReward}檔。\nOTC共{otcCount}檔,增額{otcReissue}檔,獎勵{otcReward}檔。"; GlobalUtility.LogInfo("Info", $"今日共申請{(tseCount + otcCount)}檔權證發行/增額"); MessageBox.Show("轉TXT檔完成!\n" + infoStr); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void 已發權證條件發行ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmIssueByCurrent>(); }
private void 詳細LOGToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmLog>(); }
private void 增額總表ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmReIssueTotal>(); }
private void 修改檔案名稱ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmRename>(); }
private void 發行條件輸入ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmApply>(); }
private void 搶額度總表含增額ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmApplyTotalList>(); }
private void 試算表ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <Frm71>(); }
private void 可增額列表ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmReIssuable>(); }
private void 已發行權證ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmWarrant>(); }
private void put發行檢查ToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmIssueCheckPut>(); }
private void 標的SummaryToolStripMenuItem_Click(object sender, EventArgs e) { GlobalUtility.MenuItemClick <FrmUnderlyingSummary>(); }