Пример #1
0
        private void SetToNew_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                myTimer.Stop();
                DialogResult result = XtraMessageBox.Show("Set to New?", "Set to New",
                   MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        GridView view;
                        Int32 confirmId = 0;
                        Int32 tradeId = 0;
                        Int32 rqmtId = 0;
                        //if (e.Item.Name == barbtnRqmtSetToNew.Name)
                        //{

                        using (var ts = new TransactionScope())
                        {

                            view = gridViewRqmt;
                            tradeId = Int32.Parse(view.GetRowCellDisplayText(view.FocusedRowHandle, "TradeId").ToString());
                            confirmId = GetContractRowId(tradeId);
                            rqmtId = Int32.Parse(view.GetRowCellDisplayText(view.FocusedRowHandle, "Id").ToString());

                            //ChangeRqmtStatus(view, SEMPRA_RQMT, "NEW", "");
                            string reference = GetTradeRqmtData(rqmtId, "Reference");
                            string rqmtStatus = GetTradeRqmtData(rqmtId, "Status");

                            bool hasBeenSent = false;
                            TradeAuditDal tradeAuditDal = new TradeAuditDal(sqlConnectionStr);
                            hasBeenSent = tradeAuditDal.HasConfirmBeenSent(tradeId);
                            string activeFlag = (hasBeenSent == true) ? "N" : "Y";
                            CallUpdateTradeRqmts(tradeId, rqmtId, SEMPRA_RQMT, "NEW", DateTime.Today, reference, "", true);

                            //without confirmId test inserts rows when none exist.
                            if (confirmId > 0)
                            {
                                string templateName = GetConfirmData(confirmId, "TemplateName");
                                string faxTelexInd = GetConfirmData(confirmId, "FaxTelexInd");
                                string faxTelexNumber = GetConfirmData(confirmId, "FaxTelexNumber");
                                UpdateTradeRqmtConfirmRow(confirmId, tradeId,
                                   rqmtId, templateName, faxTelexInd, faxTelexNumber, CONFIRM_LABEL_CONFIRM, "RESET TO NEW", "CXL", activeFlag);

                                if (hasBeenSent)
                                    UpdateTradeRqmtConfirmRow(0, tradeId,
                                       rqmtId, templateName, faxTelexInd, faxTelexNumber, CONFIRM_LABEL_CONFIRM, "RESET TO NEW", "PREP", "Y");

                                //string filterStr = "Id = " + confirmId.ToString() + " and ActiveFlag = 'Y'";
                                //foreach (DataRow row in confirmDataTable.Select(filterStr))
                                //{
                                //    row.Delete();
                                //    row.AcceptChanges();
                                //}

                            }

                            ts.Complete();
                        }
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show("An error occurred while resetting an Our Paper requirement status to NEW." + Environment.NewLine +
                            "Error CNF-157 in " + FORM_NAME + ".SetToNew_ItemClick(): " + ex.Message,
                          MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            finally
            {
                myTimer.Start();
            }
        }
Пример #2
0
        private bool CallGetTradeAudit()
        {
            bool rowsFound = false;
            try
            {
                string tradeIdStr = "";

                GridView view = gridViewSummary;

                List<TradeAuditDto> tradeAuditList = new List<TradeAuditDto>();
                TradeAuditDal tradeAuditDal = new TradeAuditDal(sqlConnectionStr);

                if (view.SelectedRowsCount == 1)
                {
                    tradeIdStr = view.GetRowCellDisplayText(view.FocusedRowHandle, "TradeId").ToString();
                    int tradeId = Int32.Parse(tradeIdStr);
                    tradeAuditList = tradeAuditDal.GetTradeAudit(tradeId);

                    System.Data.DataTable table = this.dataSet.Tables["AuditDataTable"];
                    table.Clear();
                    if (tradeAuditList.Count > 0)
                    {
                        rowsFound = true;
                        foreach (TradeAuditDto rec in tradeAuditList)
                        {
                            DataRow row = table.NewRow();
                            row["TradeId"] = rec.TradeId;
                            row["TradeRqmtId"] = rec.TradeRqmtId;
                            row["Operation"] = rec.Operation;
                            row["MachineName"] = rec.Machine;
                            row["Timestamp"] = rec.Timestamp;
                            row["Status"] = rec.Status;
                            row["CompletedDt"] = rec.CompletedDt;
                            row["UserId"] = rec.UserId;
                            row["Rqmt"] = rec.Rqmt;
                            table.Rows.Add(row);
                        }
                    }
                }
                return rowsFound;
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while building the Audit Table display data." + Environment.NewLine +
                     "Error CNF-084 in " + FORM_NAME + ".CallGetTradeAudit(): " + ex.Message);
            }
        }