Beispiel #1
0
        private void CallUpdateDetermineActions(DetermineActionsType ADetActionsType)
        {
            try
            {
                string finalApproval = "N";

                string setDetActionsFlag;
                if (ADetActionsType == DetermineActionsType.ResetToNo)
                    setDetActionsFlag = "N";
                else
                    setDetActionsFlag = "R";

                int finalApprovedIgnored = 0;
                string determineActionFlag = "";
                int determineActionRow = 0;
                int notDetermineAction = 0;
                GridView view = gridViewSummary;
                if (view.SelectedRowsCount > 0)
                {
                    //Get the list ahead of time, since the foreach code changes the list's contents/order
                    int[] selectedRows = view.GetSelectedRows();
                    List<DataRow> rows = new List<DataRow>();

                    List<TradeSummaryDto> tradeSummaryList = new List<TradeSummaryDto>();
                    TradeSummaryDto tradeSummaryDto = null;

                    foreach (int rowHandle in selectedRows)
                        rows.Add(view.GetDataRow(rowHandle));

                    foreach (DataRow rowSummary in rows)
                    {
                        finalApproval = rowSummary["FinalApprovalFlag"].ToString();
                        if (finalApproval == "Y")
                        {
                            finalApprovedIgnored++;
                            continue;
                        }

                        determineActionFlag = rowSummary["OpsDetActFlag"].ToString();
                        //boolean allows construction of positive logic
                        bool detActionsOk = false;
                        detActionsOk = (ADetActionsType == DetermineActionsType.ResetToNo &&
                                        (determineActionFlag == "Y" || determineActionFlag == "E" || determineActionFlag == "R")) ||
                                       (ADetActionsType == DetermineActionsType.ResetToReprocess & determineActionFlag == "E");

                        if (!detActionsOk)
                        {
                            notDetermineAction++;
                            continue;
                        }
                        else
                        {
                            tradeSummaryDto = new TradeSummaryDto();
                            tradeSummaryDto.TradeId = Int32.Parse(rowSummary["TradeId"].ToString());
                            tradeSummaryDto.OpsDetActFlag = setDetActionsFlag;
                            tradeSummaryList.Add(tradeSummaryDto);
                            determineActionRow++;
                            //SetRowUpdateSubmitted(rowSummary);
                        }
                    }

                    if (determineActionRow > 0)
                    {
                        TradeSummaryDal tradeSummaryDal = new TradeSummaryDal(sqlConnectionStr);
                        tradeSummaryDal.UpdateDetermineActions(tradeSummaryList);
                    }

                    if (notDetermineAction > 0 || finalApprovedIgnored > 0)
                    {
                        if (ADetActionsType == DetermineActionsType.ResetToNo)
                            XtraMessageBox.Show("Determine Action N rows ignored: " + notDetermineAction.ToString() + Environment.NewLine
                               + "Final Approved ignored: " + finalApprovedIgnored.ToString() + Environment.NewLine
                               + "----------------------------" + Environment.NewLine
                               + "Set Determine Action to No trades processed: " + determineActionRow.ToString() + Environment.NewLine,
                                 "Set Determine Actions to No", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        else
                            XtraMessageBox.Show("Determine Action Y, N or R rows ignored: " + notDetermineAction.ToString() + Environment.NewLine
                               + "Final Approved ignored: " + finalApprovedIgnored.ToString() + Environment.NewLine
                               + "----------------------------" + Environment.NewLine
                               + "Set Determine Action to Reprocess trades processed: " + determineActionRow.ToString() + Environment.NewLine,
                                 "Set Determine Actions to Reprocess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while attempting to update Determine Actions setting(s)." + Environment.NewLine +
                     "Error CNF-073 in " + FORM_NAME + ".CallUpdateDetermineActions(): " + ex.Message);
            }
        }
Beispiel #2
0
        private void CallUpdateFinalApproval(string AApprovalFlag, string AOnlyIfReadyFlag)
        {
            try
            {
                string readyForFinalApprovalFlag = "N";
                string finalApprovalFlag = "N";
                string tradeId = "";
                string notSubmittedLabel = "";
                string submittedLabel = "";
                int updateRowCounter = 0;
                int notSubmitted = 0;

                GridView view = gridViewSummary;
                if (view.SelectedRowsCount > 0)
                {
                    if (AApprovalFlag == "Y" && AOnlyIfReadyFlag == "Y")
                    {
                        notSubmittedLabel = "Not ready or already approved ignored: ";
                        submittedLabel = "Final Approval";
                    }
                    else if (AApprovalFlag == "Y" && AOnlyIfReadyFlag == "N")
                    {
                        notSubmittedLabel = "Already approved ignored: ";
                        submittedLabel = "Force Final Approval";
                    }
                    else if (AApprovalFlag == "N" && AOnlyIfReadyFlag == "N")
                    {
                        notSubmittedLabel = "Already open ignored: ";
                        submittedLabel = "Reopen Final Approval ";
                    }

                    List<TradeSummaryDto> tradeSummaryList = new List<TradeSummaryDto>();
                    TradeSummaryDto tradeSummaryDto = null;

                    //Get the list ahead of time, since the foreach code changes the list's contents/order
                    int[] selectedRows = view.GetSelectedRows();
                    List<DataRow> rows = new List<DataRow>();

                    foreach (int rowHandle in selectedRows)
                        rows.Add(view.GetDataRow(rowHandle));

                    //Israel 10/27/15 -- Invoke SetFinalApprovalFlag
                    TradeApprDto tradeApprData = new TradeApprDto();
                    List<TradeApprDto> tradeApprList = new List<TradeApprDto>();

                    foreach (DataRow rowSummary in rows)
                    {
                        readyForFinalApprovalFlag = rowSummary["ReadyForFinalApprovalFlag"].ToString();
                        finalApprovalFlag = rowSummary["FinalApprovalFlag"].ToString();
                        //finalApprovalFlag = "N";
                        tradeId = rowSummary["TradeId"].ToString();

                        tradeSummaryDto = new TradeSummaryDto();
                        tradeSummaryDto.FinalApprovalFlag = AApprovalFlag;
                        tradeSummaryDto.TradeId = Int32.Parse(tradeId);

                        switch (AApprovalFlag)
                        {
                            case "Y": //Final Approval
                                if (AOnlyIfReadyFlag == "Y") //Regular Final Approval
                                {
                                    //6/9/09 Israel - Don't allow Our Paper status change if still in contract edit mode.
                                    //Set a filter for the edited rqmt
                                    string filterStr = "TradeId = " + tradeId +
                                       " and Rqmt = '" + SEMPRA_RQMT + "'";
                                    bool okToApprove = true;
                                    //Read the RqmtData row(s)
                                    foreach (DataRow row in rqmtDataTable.Select(filterStr))
                                    {
                                        string status = row["Status"].ToString();
                                        if (noEditSempraRqmtStatus.IndexOf(status) > -1)
                                            okToApprove = false;
                                    }
                                    if (readyForFinalApprovalFlag == "Y" &&
                                        finalApprovalFlag == "N" &&
                                        okToApprove)
                                    {
                                        updateRowCounter++;
                                    }
                                    else
                                        notSubmitted++;
                                }
                                else if (AOnlyIfReadyFlag == "N") //Force Final Approval
                                {
                                    if (finalApprovalFlag == "N")
                                    {
                                        updateRowCounter++;
                                    }
                                    else

                                        notSubmitted++;
                                }
                                break;
                            case "N": //Reopen Final Approval
                                if (finalApprovalFlag == "Y")
                                {
                                    updateRowCounter++;
                                }
                                else
                                    notSubmitted++;
                                break;
                            default:
                                throw new Exception("Internal Error: Approval Flag=" + AApprovalFlag + " not found");
                        }
                        if (view.SelectedRowsCount > 0)
                        {
                            tradeSummaryList.Add(tradeSummaryDto);
                            //SetRowUpdateSubmitted(rowSummary);
                        }

                        tradeApprData = new TradeApprDto();
                        tradeApprData.TradeId = Int32.Parse(tradeId);
                        tradeApprData.OnlyIfReadyFlag = AOnlyIfReadyFlag;
                        tradeApprData.ApprovalFlag = AApprovalFlag;
                        tradeApprData.ApprByUserName = p_UserId;
                        tradeApprList.Add(tradeApprData);
                    }

                    if (updateRowCounter > 0 && view.SelectedRowsCount > 0)
                    {
                        Cursor.Current = Cursors.WaitCursor;

                        using (var ts = new TransactionScope())
                        {
                            TradeSummaryDal tradeSummaryDal = new TradeSummaryDal(sqlConnectionStr);
                            int rowsUpdated = 0;
                            rowsUpdated = tradeSummaryDal.UpdateFinalApproval(tradeSummaryList);

                            TradeApprDal tradeApprDal = new TradeApprDal(sqlConnectionStr);
                            int rowsUpdated2 = 0;
                            rowsUpdated2 = tradeApprDal.SetFinalApprovalFlag(tradeApprList);

#if NAVEEN_VAULT
                            UploadDocumentToVault(tradeSummaryList);
#endif
                            ts.Complete();
                        }

                    }
                    if (notSubmitted > 0)
                        XtraMessageBox.Show(notSubmittedLabel + notSubmitted.ToString() + Environment.NewLine
                           + "-----------------------------------------------" + Environment.NewLine
                           + submittedLabel + " submitted: " + updateRowCounter.ToString() + Environment.NewLine,
                           submittedLabel, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("An error occurred while attempting to update one or more Final Approval settings." + Environment.NewLine +
                       "Error CNF-075 in " + FORM_NAME + ".CallUpdateFinalApproval(): " + ex.Message,
                     MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #3
0
        private void CallUpdateTradeCmt(string ATradeCmt)
        {
            try
            {
                GridView view = gridViewSummary;

                //Read through all selected rows.
                int[] selectedRows = view.GetSelectedRows();
                List<DataRow> rows = new List<DataRow>();

                foreach (int rowHandle in selectedRows)
                    rows.Add(view.GetDataRow(rowHandle));

                //Create a data input list to pass to the update process
                TradeSummaryDal tradeSummaryDal = new TradeSummaryDal(sqlConnectionStr);
                List<TradeSummaryDto> rowDataList = new List<TradeSummaryDto>();
                foreach (DataRow row in rows)
                {
                    TradeSummaryDto rowData = new TradeSummaryDto();
                    rowData.TradeId = int.Parse(row["TradeId"].ToString());
                    rowData.Cmt = ATradeCmt;
                    rowDataList.Add(rowData);
                }

                //Update the database
                int rowsUpdated = 0;
                rowsUpdated = tradeSummaryDal.UpdateCmts(rowDataList);

                //Update the current row.
                if (view.SelectedRowsCount == 1)
                {
                    DataRow row = view.GetDataRow(view.FocusedRowHandle);
                    UpdateLocalSummaryData(row, "Cmt", ATradeCmt);
                }
                else if (view.SelectedRowsCount == 0)
                {
                    XtraMessageBox.Show("No trade was selected. Pleaese select a trade." + Environment.NewLine +
                        "Error CNF-063 in " + FORM_NAME + ".CallUpdateTradeCmt().",
                      MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while attempting to update a trade comment." + Environment.NewLine +
                    "Error CNF-064 in " + FORM_NAME + ".CallUpdateTradeCmt(): " + ex.Message);
            }
        }