示例#1
0
        public void CreateFinalFeedView(CapitalFrm cform) //Display DGV on FINAL Feed tab
        {
            //Clear
            cform.dgvFinalView.Rows.Clear();
            cform.dgvFinalView.Refresh();

            //Variables
            string sent_unid;
            double sent_amt;
            bool   fundCI, fundQA, fundQE, fundQO, fundQM;

            fundCI = fundQA = fundQE = fundQO = fundQM = false;

            Connection connection = new Connection();
            GetSQL     sql        = new GetSQL();

            //loop through feed view and use merge to insert if unmatched
            for (int i = 0; i < cform.dgvFeedView.Rows.Count; ++i)
            {
                //Construct Unid
                sent_unid = (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.portfolio].Value + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                OdbcDataReader dataReader = connection.RunQuery(sql.Lookup_Sent_Info(sent_unid));
                //Retrieve amount sent
                if (dataReader.HasRows)
                {
                    sent_amt = Convert.ToDouble(dataReader["SENT_AMT"]);
                }
                else
                {
                    sent_amt = 0;
                }

                //If box checked and it has not been sent an amount
                if ((treasArray.Contains((string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.portfolio].Value) == false) &&
                    ((bool)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fSent_Box].Value == true) &&
                    sent_amt == 0
                    )
                {
                    cform.dgvFinalView.Rows.Add(
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTypology].Value,          // Typology
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fPortfolio].Value,         // Portfolio
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fCpty].Value,              // CPTY
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fInst].Value,              // INST
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fFx].Value,                // FX
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTpr].Value,               // TPR
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTdate].Value,             // TDATE
                        Convert.ToDouble(cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTamount].Value), // TAMOUNT
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTfx].Value,               // TFX
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTtrans].Value,            // Ttrans
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fTcomment].Value,          // TCOMMENT
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fStrategy].Value,          // STRATEGY
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fBrktype].Value,           // BRKTYPE
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fBrksrce].Value,           // BRKSRCE
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fBrkdest].Value,           // BRKDEST
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fUnique_Id].Value,         // UNIQUE_ID
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fFund].Value,              // FUND
                        (string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fAcct_Num].Value           // ACCT_NUM
                        );

                    //set fund bools
                    switch ((string)cform.dgvFeedView.Rows[i].Cells[(int)Capital.fFund].Value)
                    {
                    case "CI":
                        fundCI = true;
                        break;

                    case "QA":
                        fundQA = true;
                        break;

                    case "QE":
                        fundQE = true;
                        break;

                    case "QO":
                        fundQO = true;
                        break;

                    case "QM":
                        fundQM = true;
                        break;
                    }
                }
                // close
                dataReader.Close();
            }

            //Call enrich feed for treasury
            if (fundCI == true)
            {
                sent_unid = "CAXTON INTL" + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                EnrichFinalFeed(cform, sent_unid, "CI");
            }
            if (fundQA == true)
            {
                sent_unid = "QA-TREASURY" + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                EnrichFinalFeed(cform, sent_unid, "QA");
            }
            if (fundQE == true)
            {
                sent_unid = "QE-TREASURY" + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                EnrichFinalFeed(cform, sent_unid, "QE");
            }
            if (fundQO == true)
            {
                sent_unid = "QO-TREASURY" + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                EnrichFinalFeed(cform, sent_unid, "QO");
            }
            if (fundQM == true)
            {
                sent_unid = "QM-TREASURY" + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                if (sent_unid.Length >= 31)
                {
                    sent_unid = sent_unid.Substring(0, 31);
                }
                EnrichFinalFeed(cform, sent_unid, "QM");
            }
            //Select tab
            cform.CapitalTabs.SelectTab(2);
        }
示例#2
0
        public void EnrichFinalFeed(CapitalFrm cform, string sent_unid, string fund) //Add fund level totals with updated amounts
        {
            double tAmount;
            string tTpr;

            tAmount = 0;

            Connection     connection = new Connection();
            GetSQL         sql        = new GetSQL();
            OdbcDataReader dataReader = connection.RunQuery(sql.Lookup_Sent_Info(sent_unid));

            //If fund matches update amount for items beign sent
            for (int i = 0; i < cform.dgvFinalView.Rows.Count; ++i)
            {
                if (fund == (string)cform.dgvFinalView.Rows[i].Cells[(int)Capital.fFund].Value)
                {
                    if ((string)cform.dgvFinalView.Rows[i].Cells[(int)Capital.fTpr].Value == "PAY")
                    {
                        tAmount = tAmount - Convert.ToDouble(cform.dgvFinalView.Rows[i].Cells[(int)Capital.fTamount].Value);
                    }
                    else
                    {
                        tAmount = tAmount + Convert.ToDouble(cform.dgvFinalView.Rows[i].Cells[(int)Capital.fTamount].Value);
                    }
                }
            }

            //Update direction of TPR
            if (tAmount > 0)
            {
                tTpr = "PAY";
            }
            else
            {
                tTpr = "RECEIVE";
            }

            int nRowIndex = 0;

            //loop through and update amounts
            //apply to feed
            if (dataReader.HasRows)
            {
                nRowIndex = cform.dgvFinalView.Rows.Count;
                cform.dgvFinalView.Rows.Add(
                    (string)dataReader["TYPOLOGY"],                         // Typology
                    (string)dataReader["PORTFOLIO"],                        // Portfolio
                    (string)dataReader["CPTY"],                             // CPTY
                    (string)dataReader["INST"],                             // INST
                    (string)dataReader["FX"],                               // FX
                    tTpr,                                                   // TPR
                    ((DateTime)dataReader["TDATE"]).ToString("MM/dd/yyyy"), // TDATE
                    Math.Abs(tAmount),                                      // TAMOUNT
                    (string)dataReader["TFX"],                              // TFX
                    dataReader["TTRANS"].ToString(),                        // Ttrans
                    (string)dataReader["TCOMMENT"],                         // TCOMMENT
                    (string)dataReader["STRATEGY"],                         // STRATEGY
                    dataReader["BRKTYPE"].ToString(),                       // BRKTYPE
                    (string)dataReader["BRKSRCE"],                          // BRKSRCE
                    (string)dataReader["BRKDEST"],                          // BRKDEST
                    (string)dataReader["UNIQUE_ID"],                        // UNIQUE_ID
                    (string)dataReader["FUND"],                             // FUND
                    (string)dataReader["ACCT_NUM"]                          // ACCT_NUM
                    );
                cform.dgvFinalView.Rows[nRowIndex].DefaultCellStyle.BackColor = Color.Beige;
            }

            // close
            dataReader.Close();
        }
示例#3
0
        public void DisplayFeedView(CapitalFrm cform) //Display DGV on Feed tab
        {
            //Clear
            cform.dgvFeedView.Rows.Clear();
            cform.dgvFeedView.Refresh();

            Connection connection = new Connection();
            GetSQL     sql        = new GetSQL();
            //Variables
            string cpty, tpr, strat, sent_unid, sent_date;
            double amt, sent_amt;
            bool   send_bool;


            //loop through capital view to create feed view
            for (int i = 0; i < cform.dgvCostView.Rows.Count; ++i)
            {
                //If MTD has a value add to feed
                if (Convert.ToDouble(cform.dgvCostView.Rows[i].Cells[(int)Capital.mtd].Value) != 0)
                {
                    //----Set variables
                    switch ((string)cform.dgvCostView.Rows[i].Cells[(int)Capital.trader].Value)
                    {
                    case "CI":
                        cpty  = "CXI";
                        strat = "CAP USAGE";
                        break;

                    case "QA":
                    case "QE":
                    case "QO":
                    case "QM":
                        cpty  = "SCF";
                        strat = "CAP USAGE";
                        break;

                    default:
                        cpty  = "SCF";
                        strat = "ADJUSTMENTS";
                        break;
                    }

                    sent_unid = (string)cform.dgvCostView.Rows[i].Cells[(int)Capital.portfolio].Value + ":" + cform.dateCB.Text.ToUpper() + " CAP USAGE";
                    if (sent_unid.Length >= 31)
                    {
                        sent_unid = sent_unid.Substring(0, 31);
                    }
                    OdbcDataReader dataReader = connection.RunQuery(sql.Lookup_Sent_Info(sent_unid));

                    if (dataReader.HasRows)
                    {
                        sent_date = ((DateTime)dataReader["Sent_ON"]).ToString("MM/dd/yyyy");
                        sent_amt  = Convert.ToDouble(dataReader["SENT_AMT"]);
                    }
                    else
                    {
                        sent_date = null;
                        sent_amt  = 0;
                    }

                    if (Convert.ToDouble(cform.dgvCostView.Rows[i].Cells[(int)Capital.mtd].Value) > 0)
                    {
                        tpr = "RECEIVE";
                        amt = Convert.ToDouble(cform.dgvCostView.Rows[i].Cells[(int)Capital.mtd].Value);
                    }
                    else
                    {
                        tpr = "PAY";
                        amt = (Convert.ToDouble(cform.dgvCostView.Rows[i].Cells[(int)Capital.mtd].Value) * -1);
                    }

                    if (sent_date == null)
                    {
                        send_bool = true;
                    }
                    else if ((treasArray.Contains((string)cform.dgvCostView.Rows[i].Cells[(int)Capital.portfolio].Value) == false) &&
                             (Math.Abs(amt) > Math.Abs(sent_amt)))
                    {
                        send_bool = true;
                    }
                    else
                    {
                        send_bool = false;
                    }

                    // Fill out feed DGV
                    cform.dgvFeedView.Rows.Add("IMPUTED INTEREST",                                                      //Typology
                                               (string)cform.dgvCostView.Rows[i].Cells[(int)Capital.portfolio].Value,   //Portfolio
                                               cpty,                                                                    //cpty
                                               "IMPIT",                                                                 //Inst
                                               "USD",                                                                   //FX
                                               tpr,                                                                     //TPR
                                               DateTime.Now.ToString("MM/dd/yyyy"),                                     //TDATE
                                               amt,                                                                     //AMOUNT
                                               "USD",                                                                   //TFX
                                               "",                                                                      //TTRANS
                                               cform.dateCB.Text.ToUpper() + " CAP USAGE",                              //TCOMMENT
                                               strat,                                                                   //STRATEGY
                                               "",                                                                      //BRKTYPE
                                               (string)cform.dgvCostView.Rows[i].Cells[(int)Capital.portfolio].Value,   //BRKSRC
                                               "ADJLAA",                                                                //BRKDEST
                                               "COSTOFCAP_SCF_" + DateTime.Now.ToString("yymmddhhMMss") + i.ToString(), //UNID
                                               (string)cform.dgvCostView.Rows[i].Cells[(int)Capital.fund].Value,        //FUND
                                               "CAXT",                                                                  //ACCT
                                               sent_date,
                                               sent_amt,
                                               send_bool
                                               );
                    // close
                    dataReader.Close();
                }
            }
        }