This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION fn_CalBondDateFactor(@code VARCHAR(40), @settlement smalldatetime, @opt smallint) | |
RETURNS @payDays TABLE(payIntDays INT, unPayIntDays INT, payIntPeriodDays INT) | |
BEGIN | |
--付息期間起迄日 | |
DECLARE @startPeriodDate smalldatetime, @endPeriodDate smalldatetime | |
SELECT @startPeriodDate = startDay, @endPeriodDate = endDay | |
FROM fn_GetBondReturnInterval(@code) | |
WHERE @settlement BETWEEN startDay AND endDay | |
--判斷是否月底付息 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*--------------------------------- | |
@tradeno 交易單號 | |
@opt : 0 直線法, 1 利息法 | |
---------------------------------*/ | |
CREATE FUNCTION fn_CalPrum(@tradeno varchar(40), @opt smallint) | |
RETURNS @discount TABLE (sday smalldatetime, eday smalldatetime, qty numeric(20,5), payint numeric(20,5), in_int numeric(20,5), out_int numeric(20,5), prum numeric(20,5), dailyPrum numeric(20,5), amount numeric(20,5)) | |
BEGIN | |
DECLARE @r numeric(20,10), @y numeric(20,10), @code varchar(40), @qty numeric(20,5), @payint numeric(20,5), @amount numeric(20,5), @calDate smalldatetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<string> SplitCsvLine(string line) | |
{ | |
List<string> result = new List<string>(); | |
string[] word = line.Split(','); | |
bool hasOddQuota = false; | |
for (int i = 0; i < word.Length; i++) | |
{ | |
StringBuilder sb = new StringBuilder(word[i]); | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetIsincode(string country, string cusip) | |
{ | |
string s = (country + cusip).ToUpper(); | |
StringBuilder sb = new StringBuilder(); | |
foreach (char c in s) | |
{ | |
if (c <= 'Z' && c >= 'A') sb.Append(((c - 'A') + 10).ToString()); | |
else sb.Append(c.ToString()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @name NVARCHAR(20) = N'王小明' | |
DECLARE @mask_name NVARCHAR(20) | |
SELECT @mask_name = STUFF(@name, 2, LEN(@name)-1, REPLICATE ('*' , LEN(@name)-1)) | |
PRINT @mask_name | |
-- @mask_name = 王** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--REFERENCE:http://stackoverflow.com/a/19348687 | |
DECLARE @table TABLE(idx INT, name VARCHAR(10)) | |
INSERT @table VALUES(0, 'hjwu01') | |
INSERT @table VALUES(0, 'hjwu02') | |
INSERT @table VALUES(0, 'hjwu03') | |
INSERT @table VALUES(1, 'hjwu11') | |
INSERT @table VALUES(1, 'hjwu12') | |
INSERT @table VALUES(2, 'hjwu21') | |
INSERT @table VALUES(2, 'hjwu22') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ref : http://stackoverflow.com/a/105402 | |
using System; | |
public class CSharpLab | |
{ | |
public enum myColor | |
{ | |
gray = 0, | |
grey = 0, | |
black, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading; | |
public class CSharpLab | |
{ | |
public static void Test() | |
{ | |
string[] chtInt = new string[]{"零","壹","貳","參","肆","伍","陸","柒","捌","玖"}; | |
string[] moneyUnit1 = new string[] {"拾","佰","仟",}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @candy TABLE (buydate SMALLDATETIME, name VARCHAR(10), piece INT) | |
INSERT @candy VALUES ('2014-09-01', 'candy1', 10) | |
INSERT @candy VALUES ('2014-09-01', 'candy2', 20) | |
INSERT @candy VALUES ('2014-10-01', 'candy2', 40) | |
INSERT @candy VALUES ('2014-10-01', 'candy3', 80) | |
DECLARE @delta TABLE (name VARCHAR(10), sep_count INT, oct_count INT) | |
INSERT @delta | |
SELECT name, piece, 0 FROM @candy WHERE buydate = '2014-09-01' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Net; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Forms; | |
namespace ftpTEST | |
{ | |
public class Form1 : Form | |
{ |