Exemplo n.º 1
0
        private void LoadInitialData()
        {
            string currentTableLoad = "";
            try
            {
                DateTime startTime = DateTime.Now;
                Program.splashForm.ShowLoadProgress("Loading Summary data...");
                currentTableLoad = "SummaryData";

                VPcTradeSummaryDal vpcTradeSummaryDal = new VPcTradeSummaryDal(sqlConnectionStr);
                IList<SummaryData> summaryList;
                //if (isTestMode)
                //    summaryList = vpcTradeSummaryDal.GetAllStub();
                //else

                string tradeIdList = "";
                summaryList = vpcTradeSummaryDal.GetAll(v_PermKeyDBInClauseStr);
                if (summaryList.Count == 0)
                {
                    XtraMessageBox.Show("There are currently no trades for your permission set." + Environment.NewLine +
                        "The application has started normally and is listening for new trade activity.",
                        APP_NAME + " Logon", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                    tradeIdList = vpcTradeSummaryDal.GetTradeIdListString(summaryList);

                //Israel 9/28/2015
                //string filterText = ""; // GetMessageFilterString("G");
                //summaryDataTable = CollectionHelper.ConvertTo<SummaryData>(summaryList, filterText);
                summaryDataTable = CollectionHelper.ConvertTo<SummaryData>(summaryList);
                summaryDataTable.PrimaryKey = new DataColumn[] { summaryDataTable.Columns["Id"] };

                Program.splashForm.ShowLoadProgress("Loading Requirement data...");
                currentTableLoad = "RqmtData";
                VPcTradeRqmtDal vpcTradeRqmtDal = new VPcTradeRqmtDal(sqlConnectionStr);
                IList<RqmtData> rqmtList;
                //if (isTestMode)
                //    rqmtList = vpcTradeRqmtDal.GetAllStub();
                //else

                if (summaryList.Count > 0)
                {
                    rqmtList = vpcTradeRqmtDal.GetAll(tradeIdList);
                    rqmtDataTable = CollectionHelper.ConvertTo<RqmtData>(rqmtList);
                }
                rqmtDataTable.PrimaryKey = new DataColumn[] { rqmtDataTable.Columns["Id"] };

                Program.splashForm.ShowLoadProgress("Loading Confirmation data...");
                currentTableLoad = "TradeRqmtConfirm";
                TradeRqmtConfirmDal tradeRqmtConfirmDal = new TradeRqmtConfirmDal(sqlConnectionStr);
                IList<TradeRqmtConfirm> confirmList;
                //if (isTestMode)
                //    confirmList = tradeRqmtConfirmDal.GetAllStub();
                //else

                if (summaryList.Count > 0)
                {
                    confirmList = tradeRqmtConfirmDal.GetAll(tradeIdList);
                    confirmDataTable = CollectionHelper.ConvertTo<TradeRqmtConfirm>(confirmList);
                }
                confirmDataTable.PrimaryKey = new DataColumn[] { confirmDataTable.Columns["Id"] };

                Program.splashForm.ShowLoadProgress("Loading Base data...");
                currentTableLoad = "RqmtStatusColor";
                RqmtStatusColorsDal rqmtStatusColorsDal = new RqmtStatusColorsDal(sqlConnectionStr);
                IList<RqmtStatusColor> rqmtStatusColorList;
                //if (isTestMode)
                //    rqmtStatusColorList = rqmtStatusColorsDal.GetAllStub();
                //else
                rqmtStatusColorList = rqmtStatusColorsDal.GetAll();
                rqmtStatusColorTable = CollectionHelper.ConvertTo<RqmtStatusColor>(rqmtStatusColorList);

                currentTableLoad = "ColorTranslate";
                ColorTranslateDal colorTranslateDal = new ColorTranslateDal(sqlConnectionStr);
                IList<ColorTranslate> colorTranslateList;
                //if (isTestMode)
                //    colorTranslateList = colorTranslateDal.GetAllStub();
                //else
                colorTranslateList = colorTranslateDal.GetAll();
                colorTranslateTable = CollectionHelper.ConvertTo<ColorTranslate>(colorTranslateList);

                currentTableLoad = "RqmtView";
                RqmtDal rqmtDal = new RqmtDal(sqlConnectionStr);
                IList<RqmtView> rqmtViewList;
                //if (isTestMode)
                //    rqmtViewList = rqmtDal.GetAllStub();
                //else
                rqmtViewList = rqmtDal.GetAll();
                rqmtView = CollectionHelper.ConvertTo<RqmtView>(rqmtViewList);

                currentTableLoad = "RqmtStatusView";
                RqmtStatusDal rqmtStatusDal = new RqmtStatusDal(sqlConnectionStr);
                IList<RqmtStatusView> rqmtStatusViewList;
                //if (isTestMode)
                //    rqmtStatusViewList = rqmtStatusDal.GetAllStub();
                //else
                rqmtStatusViewList = rqmtStatusDal.GetAll();
                rqmtStatusView = CollectionHelper.ConvertTo<RqmtStatusView>(rqmtStatusViewList);

                currentTableLoad = "TradeDataCdtyLkupView";
                CdtyCodeLkupDal cdtyCodeLkupDal = new CdtyCodeLkupDal(sqlConnectionStr);
                IList<BdtaCdtyLkup> cdtyCodeList;
                //if (isTestMode)
                //    cdtyCodeList = cdtyCodeLkupDal.GetAllStub();
                //else
                cdtyCodeList = cdtyCodeLkupDal.GetAll();
                cdtyLkupTbl = CollectionHelper.ConvertTo<BdtaCdtyLkup>(cdtyCodeList);

                currentTableLoad = "TradeDataCptyLkupView";
                CptyInfoDal cptyInfoDal = new CptyInfoDal(sqlConnectionStr);
                IList<BdtaCptyLkup> cptyList;
                //if (isTestMode)
                //    cptyList = cptyInfoDal.GetOpenConfirmLookupStub();
                //else
                cptyList = cptyInfoDal.GetOpenConfirmLookup();
                cptyLkupTbl = CollectionHelper.ConvertTo<BdtaCptyLkup>(cptyList);
                dataSet.Tables.Add(cptyLkupTbl);  // used for inbound panel's cpty ref mapping

                currentTableLoad = "InboundDocsView";
                Program.splashForm.ShowLoadProgress("Loading Inbound Documents...");
                InboundDocsDal inboundDocsDal = new InboundDocsDal(sqlConnectionStr);
                IList<InboundDocsView> inboundDocList;
                //if (isTestMode)
                //    inboundDocList = inboundDocsDal.GetAllStub();
                //else
                inboundDocList = inboundDocsDal.GetAll();
                //Israel 9/18/2015
                //inboundDocDataTable = CollectionHelper.ConvertTo(inboundDocList, ibQry);
                inboundDocDataTable = CollectionHelper.ConvertTo(inboundDocList);
                dataSet.Tables.Add(inboundDocDataTable);

                Program.splashForm.ShowLoadProgress("Loading Associated Documents...");
                currentTableLoad = "AssociatedDoc";
                AssociatedDocsDal associatedDocsDal = new AssociatedDocsDal(sqlConnectionStr);
                IList<AssociatedDoc> associatedDocList;
                //if (isTestMode)
                //    associatedDocList = associatedDocsDal.GetAllStub();
                //else
                associatedDocList = associatedDocsDal.GetAll();
                //assocDocDataTable = CollectionHelper.ConvertTo(associatedDocList, ibQry);
                assocDocDataTable = CollectionHelper.ConvertTo(associatedDocList);
                dataSet.Tables.Add(assocDocDataTable);

                DateTime endTime = DateTime.Now;
                TimeSpan elapsed = endTime - startTime;
                Program.splashForm.ShowLoadProgress("Establishing dataset relationships...");
                DataColumn[] colPk = new DataColumn[1];
                colPk[0] = rqmtStatusColorTable.Columns["Hashkey"];
                rqmtStatusColorTable.PrimaryKey = colPk;

                colPk[0] = colorTranslateTable.Columns["Code"];
                colorTranslateTable.PrimaryKey = colPk;

                rqmtView.DefaultView.RowFilter = "[ActiveFlag] = 'Y' and [DetActRqmtFlag] = 'Y'";
                rqmtView.PrimaryKey = new DataColumn[] { rqmtView.Columns["Code"] };

                addRqmtForm.lookupRqmt.Properties.DataSource = rqmtView.DefaultView;
                addRqmtForm.lookupRqmt.Properties.DisplayMember = "DisplayText";
            }
            catch (Exception except)
            {
                throw new Exception("Table being loaded=" + currentTableLoad + "." + Environment.NewLine +
                    "Error CNF-010 in " + FORM_NAME + ".LoadInitialData(): " + except.Message);
            }
        }
Exemplo n.º 2
0
        private void bbGetAll_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                myTimer.Stop(); //Israel 12/15/2008 - Red X

                getAllForm.settingsDir = this.appSettingsDir;
                getAllForm.InitForm(cdtyLkupTbl, cptyLkupTbl, seCptyLkupTbl);

                if (getAllForm.ShowDialog(this) == DialogResult.OK)
                {
                    string tradingSystem = getAllForm.TradingSystem;
                    //For now, just support a single Id
                    string ticketNo = getAllForm.TicketList;
                    string cptyTradeId = getAllForm.CptyTradeId;
                    string bookingCompanySn = getAllForm.BookingCoSn;
                    string cptySn = getAllForm.CptySn;
                    string cdtyCode = getAllForm.CdtyCode;
                    DateTime tradeStartDate = DateTime.MinValue;
                    DateTime tradeEndDate = DateTime.MinValue;

                    if (!(getAllForm.TradeStartDate == DateTime.MinValue))
                    {
                        tradeStartDate = getAllForm.TradeStartDate;
                    }
                    if (!(getAllForm.TradeEndDate == DateTime.MinValue))
                    {
                        tradeEndDate = getAllForm.TradeEndDate;
                    }

                    List<SummaryData> tradeList = new List<SummaryData>();
                    VPcTradeSummaryDal pcTradeSummaryDal = new VPcTradeSummaryDal(sqlConnectionStr);
                    string tradeIdList = "";

                    //If isSuperUser == true, then permKeyDBInClauseStr will be blank, which will cause the called routine
                    //to ignore the IN clause and simply select all rows that match the other criteria.
                    if (v_IsSuperUser || v_PermKeyDBInClauseStr != "")
                    {
                        tradeList = pcTradeSummaryDal.GetAllSelectedTrades(tradingSystem, bookingCompanySn, cptySn,
                                    cdtyCode, tradeStartDate, tradeEndDate, ticketNo, cptyTradeId, v_PermKeyDBInClauseStr);
                        tradeIdList = pcTradeSummaryDal.GetTradeIdListString(tradeList);
                    }

                    if (tradeList.Count > 0)
                    {

                        List<RqmtData> rqmtList = new List<RqmtData>();
                        VPcTradeRqmtDal pcTradeRqmtDal = new VPcTradeRqmtDal(sqlConnectionStr);
                        rqmtList = pcTradeRqmtDal.GetAll(tradeIdList);

                        List<TradeRqmtConfirm> rqmtConfirmList = new List<TradeRqmtConfirm>();
                        TradeRqmtConfirmDal tradeRqmtConfirmDal = new TradeRqmtConfirmDal(sqlConnectionStr);
                        rqmtConfirmList = tradeRqmtConfirmDal.GetAll(tradeIdList);

                        List<AssociatedDoc> assocDocList = new List<AssociatedDoc>();
                        AssociatedDocsDal assocDocsDal = new AssociatedDocsDal(sqlConnectionStr);
                        //assocDocList = assocDocsDal.GetAllSelectedTrades(tradingSystem, bookingCompanySn, cptySn,
                        //                    cdtyCode, tradeStartDate, tradeEndDate, ticketNo);                    

                        GetAllSelectedTradesResult(tradeList, rqmtList, rqmtConfirmList, assocDocList);

                        barChkNB.Checked = true;
                        barChkQRY.Checked = true;
                        barChkHP.Checked = false;
                        barChkRFA.Checked = false;
                        string faVal = (string)barEditFAComboBox.Items[2];
                        barEditFA.EditValue = faVal;
                    }
                    else
                        XtraMessageBox.Show("No trade was found matching the input criteria.", "Get All",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("An error occurred while getting all selected trades." + Environment.NewLine +
                       "Error CNF-080 in " + FORM_NAME + ".bbGetAll_ItemClick(): " + ex.Message,
                     MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                myTimer.Start(); //Israel 12/15/2008 - Red X
            }
        }