private Int32 UpdateTradeRqmtConfirmRow(Int32 AId, Int32 ATradeId, Int32 ARqmtId, string ATemplateName, string AFaxTelexInd, string AFaxTelexNumber, string AConfirmLabel, string AConfirmCmt, string ANextStatusCode, string AActiveFlag) { //string agreementInfo = ""; try { TradeRqmtConfirm tradeRqmtConfirmData = new TradeRqmtConfirm(); tradeRqmtConfirmData.Id = AId; tradeRqmtConfirmData.TradeId = ATradeId; tradeRqmtConfirmData.RqmtId = ARqmtId; tradeRqmtConfirmData.TemplateName = ATemplateName; tradeRqmtConfirmData.NextStatusCode = ANextStatusCode; tradeRqmtConfirmData.ConfirmLabel = AConfirmLabel; tradeRqmtConfirmData.ConfirmCmt = AConfirmCmt; tradeRqmtConfirmData.FaxTelexInd = AFaxTelexInd; tradeRqmtConfirmData.FaxTelexNumber = AFaxTelexNumber; tradeRqmtConfirmData.ConfirmLabel = AConfirmLabel; tradeRqmtConfirmData.ConfirmCmt = AConfirmCmt; tradeRqmtConfirmData.ActiveFlag = AActiveFlag; TradeRqmtConfirmDal tradeRqmtConfirmDal = new TradeRqmtConfirmDal(sqlConnectionStr); Int32 spProcReturnValue = 0; //Israel 11/05/2015 -- Restored Insert capability if (AId == 0) spProcReturnValue = tradeRqmtConfirmDal.Insert(tradeRqmtConfirmData); else { spProcReturnValue = tradeRqmtConfirmDal.Update(tradeRqmtConfirmData); } if (spProcReturnValue > 0) { if (AId == 0) { DataRow row = confirmDataTable.NewRow(); //row["Id"] = [email protected]; row["Id"] = spProcReturnValue; row["RqmtId"] = ARqmtId; row["TradeId"] = ATradeId; //row["TemplateId"] = 0; row["NextStatusCode"] = ANextStatusCode; row["ConfirmLabel"] = AConfirmLabel; row["ConfirmCmt"] = AConfirmCmt; row["FaxTelexInd"] = AFaxTelexInd; row["FaxTelexNumber"] = AFaxTelexNumber; row["XmitStatusInd"] = ""; row["XmitAddr"] = ""; row["XmitCmt"] = ""; //row["XmitTimeStampgmt"] = System.DBNull.Value; row["TemplateName"] = ATemplateName; row["TemplateCategory"] = ""; row["TemplateTypeInd"] = ""; row["FinalApprovalFlag"] = ""; row["ActiveFlag"] = AActiveFlag; confirmDataTable.Rows.Add(row); } else { string filterStr = "Id = " + AId.ToString(); foreach (DataRow row in confirmDataTable.Select(filterStr)) { row.BeginEdit(); //row["TemplateId"] = 0; row["TemplateName"] = ATemplateName; row["NextStatusCode"] = ANextStatusCode; row["ConfirmLabel"] = AConfirmLabel; row["ConfirmCmt"] = AConfirmCmt; row["FaxTelexInd"] = AFaxTelexInd; row["FaxTelexNumber"] = AFaxTelexNumber; row.AcceptChanges(); row.EndEdit(); } } return spProcReturnValue; } else { //XtraMessageBox.Show("Error Updating: " + [email protected]); XtraMessageBox.Show("Error Updating TradeRqmtConfirm."); return -1; } } catch (Exception ex) { throw new Exception("An error occurred while attempting to update a Confirm using the following values:" + Environment.NewLine + "Confirm Id: " + AId.ToString() + ", Trade Id: " + ATradeId.ToString() + ", Rqmt Id: " + ARqmtId.ToString() + ", Template Name: " + ATemplateName + Environment.NewLine + "Transmission Method: " + AFaxTelexInd + ", Transmission Send-To Address: " + AFaxTelexNumber + ", Active Flag: " + AActiveFlag + Environment.NewLine + "Error CNF-129 in " + FORM_NAME + ".UpdateTradeRqmtConfirmRow(): " + ex.Message); } }
private void CopyDataToBeUpdated() { sumDataCacheCopy.Clear(); rqmtDataCacheCopy.Clear(); assDocDataCacheCopy.Clear(); inbDocViewCacheCopy.Clear(); tradeRqmtConfirmCacheCopy.Clear(); foreach (SummaryData data in sumDataCache) { SummaryData copyData = new SummaryData(); copyData = data; sumDataCacheCopy.Add(copyData); } foreach (RqmtData data in rqmtDataCache) { RqmtData copyData = new RqmtData(); copyData = data; rqmtDataCacheCopy.Add(copyData); } foreach (AssociatedDoc data in assDocDataCache) { AssociatedDoc copyData = new AssociatedDoc(); copyData = data; assDocDataCacheCopy.Add(copyData); } foreach (InboundDocsView data in inbDocViewCache) { InboundDocsView copyData = new InboundDocsView(); copyData = data; inbDocViewCacheCopy.Add(copyData); } foreach (TradeRqmtConfirm data in tradeRqmtConfirmCache) { TradeRqmtConfirm copyData = new TradeRqmtConfirm(); copyData = data; tradeRqmtConfirmCacheCopy.Add(copyData); } }
public Int32 Update(TradeRqmtConfirm pData) { string updateSql = DBUtils.SCHEMA_NAME + "PKG_RQMT_CONFIRM$p_update_rqmt_confirm"; Int32 rowsUpdated = 0; using (SqlConnection conn = new SqlConnection(sqlConnStr)) { using (SqlCommand cmd = new SqlCommand(updateSql, conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@p_id", System.Data.SqlDbType.Int).Value = pData.Id; cmd.Parameters.Add("@p_rqmt_id", System.Data.SqlDbType.Int).Value = pData.RqmtId; cmd.Parameters.Add("@p_trade_id", System.Data.SqlDbType.Int).Value = pData.TradeId; cmd.Parameters.Add("@p_template_name", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.TemplateName); cmd.Parameters.Add("@p_confirm_cmt", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.ConfirmCmt); cmd.Parameters.Add("@p_fax_telex_ind", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.FaxTelexInd); cmd.Parameters.Add("@p_fax_telex_number", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.FaxTelexNumber); cmd.Parameters.Add("@p_confirm_label", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.ConfirmLabel); cmd.Parameters.Add("@p_next_status_code", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.NextStatusCode); cmd.Parameters.Add("@p_active_flag", System.Data.SqlDbType.VarChar).Value = pData.ActiveFlag; conn.Open(); rowsUpdated = cmd.ExecuteNonQuery(); } } return rowsUpdated; }
public void Test_TradeRqmtConfirmDal() { messageSeqNo = 0; TradeRqmtConfirmDal tradeRqmtConfirmDal = new TradeRqmtConfirmDal(sqlConnectionString); List<TradeRqmtConfirm> rqmtConfirmDataList = new List<TradeRqmtConfirm>(); rqmtConfirmDataList = tradeRqmtConfirmDal.GetAll(); expectedCount = 2; actualCount = rqmtConfirmDataList.Count; Assert.AreEqual(expectedCount, actualCount, "Selected list count."); TradeRqmtConfirm trcData = new TradeRqmtConfirm(); trcData.Id = 9; trcData.RqmtId = 10; trcData.TradeId = 15; trcData.TemplateName = ""; trcData.ConfirmCmt = "Test..."; trcData.FaxTelexInd = ""; trcData.FaxTelexNumber = ""; trcData.ConfirmLabel = "CONFIRM"; trcData.NextStatusCode = ""; trcData.ActiveFlag = "Y"; tradeRqmtConfirmDal.Update(trcData); }
public Int32 Insert(TradeRqmtConfirm pData) { string updateSql = DBUtils.SCHEMA_NAME + "PKG_RQMT_CONFIRM$p_insert_rqmt_confirm"; Int32 rowsInserted = 0; Int32 seqNo = 0; string seqName = "SEQ_TRADE_RQMT_CONFIRM"; seqNo = DBUtils.GetNextSequence(sqlConnStr, seqName); using (SqlConnection conn = new SqlConnection(sqlConnStr)) { using (SqlCommand cmd = new SqlCommand(updateSql, conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@p_id", System.Data.SqlDbType.Int).Value = seqNo; cmd.Parameters.Add("@p_rqmt_id", System.Data.SqlDbType.Int).Value = pData.RqmtId; cmd.Parameters.Add("@p_trade_id", System.Data.SqlDbType.Int).Value = pData.TradeId; cmd.Parameters.Add("@p_template_name", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.TemplateName); cmd.Parameters.Add("@p_confirm_cmt", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.ConfirmCmt); cmd.Parameters.Add("@p_fax_telex_ind", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.FaxTelexInd); cmd.Parameters.Add("@p_fax_telex_number", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.FaxTelexNumber); cmd.Parameters.Add("@p_confirm_label", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.ConfirmLabel); cmd.Parameters.Add("@p_next_status_code", System.Data.SqlDbType.VarChar).Value = DBUtils.ValueStringOrDBNull(pData.NextStatusCode); conn.Open(); rowsInserted = cmd.ExecuteNonQuery(); } } if (rowsInserted == 0) return rowsInserted; else return seqNo; }