Ejemplo n.º 1
0
        public void createStockBuyOrder(string referenceNumber, string shares, string orderType, string expiryDay, string allOrNone, string highPrice, string stopPrice)
        {
            HKeInvestData myHKeInvestData = new HKeInvestData();
            var           trans           = myHKeInvestData.beginTransaction();
            string        sql             = string.Format("INSERT INTO [StockOrderBuy] VALUES ({0}, '{1}', {2}, '{3}',",
                                                          shares,
                                                          orderType,
                                                          int.Parse(expiryDay),
                                                          allOrNone);

            if (orderType == "limit")
            {
                sql += highPrice + ", NULL, '" + referenceNumber + "')";
            }
            else if (orderType == "stop")
            {
                sql += "NULL, " + stopPrice + ", '" + referenceNumber + "')";
            }
            else if (orderType == "stop limit")
            {
                sql += highPrice + "," + stopPrice + ", '" + referenceNumber + "')";
            }
            else
            {
                sql += "NULL, NULL, '" + referenceNumber + "')";
            }
            myHKeInvestData.setData(sql, trans);
            myHKeInvestData.commitTransaction(trans);
        }
Ejemplo n.º 2
0
        public void createUnitTrustBuyOrder(string referenceNumber, string amount)
        {
            HKeInvestData myHKeInvestData = new HKeInvestData();
            var           trans           = myHKeInvestData.beginTransaction();
            string        sql             = string.Format("INSERT INTO [UnitTrustOrderBuy] VALUES ({0}, '{1}')", decimal.Parse(amount), referenceNumber);

            myHKeInvestData.setData(sql, trans);
            myHKeInvestData.commitTransaction(trans);
        }
Ejemplo n.º 3
0
        public void createBondSellOrder(string referenceNumber, string shares)
        {
            HKeInvestData myHKeInvestData = new HKeInvestData();
            var           trans           = myHKeInvestData.beginTransaction();
            string        sql             = string.Format("INSERT INTO [BondOrderSell] VALUES ({0}, '{1}')", decimal.Parse(shares), referenceNumber);

            myHKeInvestData.setData(sql, trans);
            myHKeInvestData.commitTransaction(trans);
        }
Ejemplo n.º 4
0
 public string getUserAccountNumber(HttpSessionState session, string userName)
 {
     if (session["accountNumber"] == null)
     {
         HKeInvestData myHKeInvestData = new HKeInvestData();
         string        sql             = "SELECT accountNumber FROM dbo.Account WHERE userName='******'";
         DataTable     dtAccountNumber = myHKeInvestData.getData(sql);
         if (dtAccountNumber.Rows.Count == 1)
         {
             session["accountNumber"] = dtAccountNumber.Rows[0].Field <string>("accountNumber");
         }
         else
         {
             session["accountNumber"] = "";
         }
     }
     return((string)session["accountNumber"]);
 }
Ejemplo n.º 5
0
        public void createNewOrder(string accountNumber, string referenceNumber, string name, string code)
        {
            string  status     = "pending";
            decimal serviceFee = 0;
            string  date       = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt");

            HKeInvestData myHKeInvestData = new HKeInvestData();
            var           trans           = myHKeInvestData.beginTransaction();
            string        sql             = string.Format("INSERT INTO [Order] VALUES ('{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}')",
                                                          referenceNumber,
                                                          name,
                                                          status,
                                                          serviceFee,
                                                          code,
                                                          date,
                                                          accountNumber);

            myHKeInvestData.setData(sql, trans);
            myHKeInvestData.commitTransaction(trans);
        }
Ejemplo n.º 6
0
 public string getClientName(string accountNumber)
 {
     if (accountNumber == null || accountNumber.Equals(""))
     {
         return("");
     }
     else
     {
         HKeInvestData myHKeInvestData = new HKeInvestData();
         string        sql             = "SELECT lastName,firstName FROM dbo.[Client] WHERE accountNumber='" + accountNumber + "';";
         DataTable     dtName          = myHKeInvestData.getData(sql);
         if (dtName.Rows.Count == 1)
         {
             return(dtName.Rows[0].Field <string>("firstName").Trim() + " " + dtName.Rows[0].Field <string>("lastName").Trim());
         }
         else
         {
             return("");
         }
     }
 }