public void RepeatedDisposal_DoesNotThrow() { var mockConnectionPoolManager = InitMockConnectionPoolManager(); var connection = new AseConnection("Data Source=myASEserver;Port=5000;Database=foo;Uid=myUsername;Pwd=myPassword;", mockConnectionPoolManager); connection.Open(); connection.Dispose(); connection.Dispose(); }
protected virtual void Dispose(bool disposing) { if (disposing) { conn.Dispose(); conn = null; GC.SuppressFinalize(this); } }
public Account getAccountStatus(string AcctNo) { // BVN = "2014225"; Account account = new Account(); //string result = ""; LogWriter logWriter = new LogWriter(); AseCommand cmd = null; AseConnection conn = null; string sqlquery = null; string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; List <Account> accountDetailList = new List <Account>(); try { conn = new AseConnection(cnstring); sqlquery = " SELECT status as status from phoenix..dp_acct WHERE acct_no = '" + AcctNo + "'"; cmd = new AseCommand(sqlquery, conn); cmd.CommandTimeout = 0; conn.Open(); AseDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (reader == null) { logWriter.WriteErrorLog(string.Format("Reader empty !", "reader is empty")); account.AccountStatus = ""; } while (reader.Read()) { account.AccountStatus = reader["status"].ToString(); } } catch (Exception ex) { logWriter.WriteErrorLog(string.Format("Exception Message! / {0}", ex.Message)); } finally { //cmd.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(account); }
public List <Branch> GetBranchList() { List <Branch> brList = new List <Branch>(); AseCommand cmd = null; AseConnection conn = null; string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; try { conn = new AseConnection(cnstring); string sqlquery = "select branch_no,name_1 from phoenix..ad_gb_branch where status = 'Active' order by name_1"; cmd = new AseCommand(sqlquery, conn); cmd.CommandTimeout = 0; conn.Open(); AseDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { Branch br = new Branch(); br.BranchNo = Convert.ToInt16(reader["branch_no"].ToString()); br.BranchName = reader["name_1"].ToString(); brList.Add(br); } reader.Close(); } catch (Exception ex) { throw; } finally { cmd.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(brList); }
public List <Account> getAccounts(string BVN) { // BVN = "2014225"; LogWriter logWriter = new LogWriter(); AseCommand cmd = null; AseConnection conn = null; string sqlquery = null; string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; List <Account> accountDetailList = new List <Account>(); try { conn = new AseConnection(cnstring); // sqlquery = "select acct_no as AcctNo, Acct_name as AcctName from zenbase..zib_kyc_cust_information where bvn = '" + BVN + "' union select acct_no as AcctNo , Acct_name as AcctName from zenbase..zib_kyc_cust_information_wk where bvn = '" + BVN + "'"; sqlquery = "select acct_no as AcctNo, Acct_name as AcctName from zenbase..zib_kyc_cust_information where bvn = '" + BVN + "'"; cmd = new AseCommand(sqlquery, conn); cmd.CommandTimeout = 0; logWriter.WriteErrorLog(string.Format("Exception Message! / {0}", "before conn open")); conn.Open(); if (conn.State == System.Data.ConnectionState.Open) { logWriter.WriteErrorLog(string.Format("Conection section / {0}", "connection open")); } else { logWriter.WriteErrorLog(string.Format("Conection section / {0}", "connection closed")); } logWriter.WriteErrorLog(string.Format("execute Section / {0}", "Before execute")); AseDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); logWriter.WriteErrorLog(string.Format("execute Section / {0}", "after execute")); if (reader == null) { logWriter.WriteErrorLog(string.Format("reader section / {0}", "Reader is null")); } else { logWriter.WriteErrorLog(string.Format("reader section / {0}", "Reader is not null")); } while (reader.Read()) { Account account = new Account(); // account.AccountNo = AcctNo; account.AccountNumber = reader["AcctNo"].ToString(); account.AccountName = reader["AcctName"].ToString(); if (account.AccountNumber != "" || account.AccountNumber != null) { account.AccountStatus = getAccountStatus(account.AccountNumber).AccountStatus; } else { account.AccountStatus = ""; } accountDetailList.Add(account); } } catch (Exception ex) { logWriter.WriteErrorLog(string.Format("Exception Message! / {0}", ex.Message)); } finally { //cmd.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(accountDetailList); }
public Account getCorporateAccountInfo(string acct_no, string initiator_number) { List <Loan> loans = new List <Loan>(); Account acct = null; AseConnection conn = null; AseCommand command = null; AseDataReader reader = null; StringBuilder s = new StringBuilder(); StringBuilder output = new StringBuilder(); string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; string sqltext = "zsp_cust_information"; //string sqltext = "select title_1,acct_no,acct_type,a.rsm_id as 'AccountRSMID'"; //sqltext += ",(select name from phoenix..ad_gb_rsm where employee_id = a.rsm_id) as 'AccountRSMName'"; //sqltext += ",b.rsm_id as 'RIMRSMID'"; //sqltext += ",(select name from phoenix..ad_gb_rsm where employee_id = b.rsm_id) as 'RIMRSMName'"; //sqltext += ",(select user_name from phoenix..ad_gb_rsm where employee_id = b.rsm_id) as 'RIMUSerName'"; //sqltext += ",(select d.staff_id from phoenix..ad_gb_rsm c, zib_applications_users d where c.user_name = d.user_id and "; //sqltext += "employee_id = b.rsm_id) as 'StaffNo' "; //sqltext += "from phoenix..dp_acct a, phoenix..rm_acct b "; //sqltext += "where a.acct_no = @corperateacct_no ";// -----'1020041488' //sqltext += "and a.rim_no = b.rim_no "; try { using (conn = new AseConnection(cnstring)) { conn.Open(); using (command = new AseCommand(sqltext, conn)) { command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@psCorperateacct_no", acct_no); command.Parameters.AddWithValue("@initiator_staffnumber", initiator_number); reader = command.ExecuteReader(); while (reader.Read()) { acct = new Account(); acct.account_name = reader["title_1"].ToString(); acct.acct_no = reader["acct_no"].ToString(); acct.acct_type = reader["acct_type"].ToString(); acct.domicile_branch_no = reader["BranchNo"].ToString(); acct.domicile_branch_name = reader["BranchName"].ToString(); acct.rim_no = reader["RIMNO"].ToString(); acct.rsm_id = reader["AccountRSMID"].ToString(); acct.rsm_name = reader["AccountRSMName"].ToString(); acct.rimrsm_id = reader["RIMRSMID"].ToString(); acct.rimrsm_name = reader["RIMRSMName"].ToString(); acct.rimrsm_username = reader["RIMUSerName"].ToString(); acct.rsm_staffno = reader["StaffNo"].ToString(); //New properties to be returned// acct.sex = reader["sex"].ToString(); //acct.marital_status = reader["familystatus"].ToString(); acct.dob = reader["date_of_birth"].ToString(); acct.home_address = reader["home_address"].ToString(); acct.state_of_origin = reader["state_of_origin"].ToString(); acct.phonenumber = reader["phone_number"].ToString(); acct.email = reader["email_address"].ToString(); acct.next_of_kin = reader["next_of_kin"].ToString(); //New property to be returned - bvn - 03 NOV 2015// acct.bvn = reader["bvn"].ToString(); acct.acct_type_desc = reader["acct_type_desc"].ToString(); //New property to be returned - bvn - 25 OCT 2016// acct.initiator_branch = reader["initiator_branch"].ToString(); acct.initiator_branchcode = reader["initiator_branchcode"].ToString(); acct.initiator_phoenix_username = reader["initiator_phoenix_username"].ToString(); acct.initiator_phoenix_employee_id = reader["initiator_phoenix_employee_id"].ToString(); acct.initiator_phoenix_status = reader["initiator_phoenix_status"].ToString(); } } } } catch (Exception ex) { throw; } finally { command.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(acct); }
public GlobalLimit getRimInfo(string schemerimno, string schemeclasscode) { GlobalLimit gLimit = null; AseConnection conn = null; AseCommand command = null; AseDataReader reader = null; StringBuilder s = new StringBuilder(); StringBuilder output = new StringBuilder(); string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; string sqltext = "zsp_loans_GlobalLimit"; //string sqltext = "select sum(amt) as 'GlobalLimit'"; //sqltext += ",sum(undisbursed) as 'GlobalBalance'"; //sqltext += ",rsm_id as 'RIMRSMID' "; //sqltext += "from phoenix..ln_umb "; //sqltext += "where rim_no = @SchemeRimNo "; //sqltext += "and class_code = @SchemeClassCode "; //sqltext += "and status = 'Active' "; try { using (conn = new AseConnection(cnstring)) { conn.Open(); using (command = new AseCommand(sqltext, conn)) { //command.Parameters.AddWithValue("@SchemeRimNo", int.Parse(schemerimno)); //command.Parameters.AddWithValue("@SchemeClassCode", int.Parse(schemeclasscode)); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@pnSchemeRimNo", int.Parse(schemerimno)); command.Parameters.AddWithValue("@pnSchemeClassCode", int.Parse(schemeclasscode)); reader = command.ExecuteReader(); while (reader.Read()) { gLimit = new GlobalLimit(); gLimit.Limit = reader["GlobalLimit"].ToString(); gLimit.GlobalBalance = reader["GlobalBalance"].ToString(); } } } } catch (Exception ex) { throw; } finally { command.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(gLimit); }
public List <Loan> getApplicantLoans(string acct_no) { List <Loan> loans = new List <Loan>(); Loan loan = null; AseConnection conn = null; AseCommand command = null; AseDataReader reader = null; StringBuilder s = new StringBuilder(); StringBuilder output = new StringBuilder(); string cnstring = ConfigurationManager.ConnectionStrings["phoenixConnectionString"].ConnectionString; string sqltext = "zsp_cust_exist_loans"; //string sqltext = "select (select description from phoenix..ad_ln_cls where class_code = a.class_code) as 'FacilityType',a.acct_no"; //sqltext += ",a.amt as 'FacilityAmount'"; //sqltext += ",a.period as 'RepaymentFreq'"; //sqltext += ",a.last_pmt_amt as 'LastRepaymentAmount'"; //sqltext += ",a.nxt_pmt_amt as 'NextRepaymentAmount'"; //sqltext += ",a.col_bal as 'CurrentBalance'"; //sqltext += ",a.mat_dt as 'FacilityMaturityDate'"; //sqltext += " from phoenix..ln_display a, phoenix..dp_acct b "; //sqltext += "where b.acct_no = @applicantacct_no ";// -----'1020041488' //sqltext += "and a.rim_no = b.rim_no "; //sqltext += "and a.class_code != 585 "; //sqltext += "and a.col_bal != 0 "; //sqltext += "and a.status != 'Closed' "; try { using (conn = new AseConnection(cnstring)) { conn.Open(); using (command = new AseCommand(sqltext, conn)) { command.CommandType = System.Data.CommandType.StoredProcedure; //command.Parameters.AddWithValue("@applicantacct_no", acct_no); //AseParameter param = new AseParameter(); //param.ParameterName = "@applicantacct_no"; //param.Value = acct_no; AseParameter param = new AseParameter(); param.ParameterName = "@psApplicantacct_no"; param.Value = acct_no; command.Parameters.Add(param); reader = command.ExecuteReader(); while (reader.Read()) { loan = new Loan(); loan.FacilityType = reader["FacilityType"].ToString(); loan.acct_no = reader["acct_no"].ToString(); loan.FacilityAmount = reader["FacilityAmount"].ToString(); loan.RepaymentFreq = reader["RepaymentFreq"].ToString(); loan.LastRepaymentAmount = reader["LastRepaymentAmount"].ToString(); loan.NextRepaymentAmount = reader["NextRepaymentAmount"].ToString(); loan.FacilityMaturityDate = reader["FacilityMaturityDate"].ToString(); loan.CurrentBalance = reader["CurrentBalance"].ToString(); loans.Add(loan); } } } } catch (Exception ex) { throw; } finally { command.Dispose(); if (conn.State != System.Data.ConnectionState.Closed) { conn.Close(); conn.Dispose(); } } return(loans); }
public static void Main(string[] args) { var ConnectionSybase = "Data Source=10.1.1.36;Port=5000;Database=cafardb;Uid=sa;Pwd=cafsyb;Charset=cp850;"; var ConnectionMaster = "Data Source=10.1.4.10;Port=5000;Database=master;Uid=sa;Pwd=cafsybweb;Charset=cp850;"; var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); logger.Info("Prueba - Iniciando Backup and Restore diario"); Console.WriteLine("Prueba - Iniciando Backup and Restore diario"); using (Process p = Process.GetCurrentProcess()) p.PriorityClass = ProcessPriorityClass.High; try { using (AseConnection _connectionSybase = new AseConnection(ConnectionSybase)) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); try { _connectionSybase.Open(); } catch (Exception ex) { logger.Error("Error al conectarse con RDC-W2K12"); Console.WriteLine("Error al conectarse con RDC-W2K12"); logger.Error(ex.Message); Console.WriteLine(ex.Message); } if (_connectionSybase.State == System.Data.ConnectionState.Open) { var backupDiario = "cafardb" + DateTime.Now.Date.ToString("yyyyMMdd"); var pathBackupProd = "C:\\Users\\Administrator\\Desktop\\COMPARTIDO RDC-W2K12\\" + backupDiario; logger.Info("Conexión establecida"); Console.WriteLine("Conexión establecida"); if (File.Exists(pathBackupProd)) { logger.Error("Ya existe " + pathBackupProd); Console.WriteLine("Ya existe " + pathBackupProd); } else { var sqlBackup = "dump database cafardb to " + '"' + pathBackupProd + '"' + " with notify = client"; var command = _connectionSybase.CreateCommand(); command.CommandText = sqlBackup; logger.Info("Iniciando dump"); Console.WriteLine("Iniciando dump"); try { void captureResult(object sender, AseInfoMessageEventArgs aseInfoMessageEventArgs) { Console.WriteLine(aseInfoMessageEventArgs.Message); } _connectionSybase.InfoMessage += captureResult; command.ExecuteNonQuery(); logger.Info("Dump finalizado"); Console.WriteLine("Dump finalizado"); var pathBackupWeb = "\\\\10.1.2.10\\compartidosybase15\\" + backupDiario; if (File.Exists(pathBackupWeb)) { logger.Error("Ya existe " + pathBackupWeb); Console.WriteLine("Ya existe " + pathBackupWeb); } else { logger.Info("Copiando backup en SYBASE15"); Console.WriteLine("Copiando backup en SYBASE15"); File.Copy(pathBackupProd, pathBackupWeb); logger.Info("Copia de backup finalizada"); Console.WriteLine("Copia de backup finalizada"); try { using (AseConnection connectionMaster = new AseConnection(ConnectionMaster)) { logger.Info("Conectando a Sybase15"); Console.WriteLine("Conectando a Sybase15"); var sqlRestore = "load database CafarWeb from " + '"' + pathBackupWeb + '"'; connectionMaster.Open(); logger.Info("Conexion Establecida con Sybase15"); Console.WriteLine("Conexion Establecida con Sybase15"); var procesos = connectionMaster.Query <Procces>("sp_who sa").ToList(); var procesoSaCafarNov = procesos.Where(x => x.dbname == "CafarNov" || x.dbname == "CafarWeb"); if (procesoSaCafarNov.Any()) { logger.Info("Limpiando procesos sa en SYBASE15"); Console.WriteLine("Limpiando procesos sa en SYBASE15"); } foreach (Procces proceso in procesoSaCafarNov) { try { connectionMaster.Execute("kill " + proceso.spid); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } //_connectionWeb.Open(); logger.Info("Iniciando Restore"); Console.WriteLine("Iniciando Restore"); connectionMaster.Execute(sqlRestore); logger.Info("Restore Finalizado en Web"); Console.WriteLine("Restore Finalizado en Web"); connectionMaster.Execute("Online database CafarWeb"); logger.Info("Bases de Datos puesta OnLine"); Console.WriteLine("Bases de Datos puesta OnLine"); connectionMaster.Close(); connectionMaster.Dispose(); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } _connectionSybase.Close(); } } } catch (Exception ex) { logger.Error(ex.Message); logger.Error("Error"); Console.WriteLine(ex.Message); } }
public void ExecuteData(procedure type, string flashAcctNum, string dtcAcctNum) { AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd=null; if (type.Equals(procedure.ADD_FLSH)) { oCmd = new AseCommand("ADD_FLSH", oCon); AseParameter oParam0 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam0.Value = strHandler; oCmd.Parameters.Add(oParam0); } if (type.Equals(procedure.RemoveMapping)) { oCmd = new AseCommand("RemoveMapping", oCon); AseParameter oParam0 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam0.Value = strHandler; oCmd.Parameters.Add(oParam0); } oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam1 = new AseParameter("@flash_number", AseDbType.VarChar, 25); oParam1.Value = flashAcctNum; oCmd.Parameters.Add(oParam1); AseParameter oParam2 = new AseParameter("@dtc_number", AseDbType.VarChar, 25); oParam2.Value = dtcAcctNum; oCmd.Parameters.Add(oParam2); oCon.Open(); oCmd.ExecuteNonQuery(); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-ExeuteData():", ex); oCon.Close(); oCon.Dispose(); oCon = null; throw; } }
public DataSet GetConsolidateReport(string strType) { DataSet dsReport = new DataSet(); //string strOut = string.Empty; string strCon = ConfigurationSettings.AppSettings["ConnectionSybaseMCM_STAGE"]; AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd; if (strType == "1")//Equity trades oCmd = new AseCommand("FLSH_DTC_RCN_ECEPTION_ALL", oCon); else//FI trades oCmd = new AseCommand("RCN_EXCEPTION_DETAILS_FI_ALL", oCon); oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam.Value = strHandler; oCmd.Parameters.Add(oParam); AseDataAdapter oAseAdp = new AseDataAdapter(oCmd); oAseAdp.Fill(dsReport); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-GetConsolidateReport():", ex); oCon.Close(); oCon.Dispose(); oCon = null; dsReport = null; throw; } return dsReport; }
private void btnExecutar_Click(object sender, EventArgs e) { using (AseConnection conn = new AseConnection(ConfigurationManager.AppSettings["DBConn"])) { String query = MontaQuerySpWho(cbbUsuario.SelectedItem.ToString(), txbNomeMaquina.Text); AseCommand cmd = new AseCommand(query, conn); try { conn.Open(); AseDataReader dtReader = cmd.ExecuteReader(); grvResultado.DataSource = dtReader; lblQtdLinhas.Text = String.Format("Qtd. Linhas: {0}", grvResultado.Rows.Count); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); conn.Dispose(); } lblDataHoraUltimoRefresh.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); } } }
public DataSet GetData(procedure type) { DataSet dsReport = new DataSet(); string strOut = string.Empty; AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd = null; if (type.Equals(procedure.FLSH_RPT)) { oCmd = new AseCommand("FLSH_RPT", oCon); } if (type.Equals(procedure.DISTINCT_DTC)) { oCmd = new AseCommand("DISTINCT_DTC", oCon); } oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam1 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam1.Value = strHandler; oCmd.Parameters.Add(oParam1); AseDataAdapter oAseAdp = new AseDataAdapter(oCmd); oAseAdp.Fill(dsReport); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-GetData():", ex); oCon.Close(); oCon.Dispose(); oCon = null; if (ex.Message == "No Flash Record found") { dsReport = null; return dsReport; } throw; } return dsReport; }
public void ExecuteData(procedure type, string forFlashValue, string dtcTicket, string flashTicket, string updatedDtcValue) { AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd = null; if (type.Equals(procedure.UpdateMappingBoth)) { oCmd = new AseCommand("UpdateMappingForBoth", oCon); AseParameter oParam3 = new AseParameter("@newFlash_number", AseDbType.VarChar, 25); oParam3.Value = flashTicket; oCmd.Parameters.Add(oParam3); AseParameter oParam4 = new AseParameter("@newDtc_number", AseDbType.VarChar, 25); oParam4.Value = updatedDtcValue; oCmd.Parameters.Add(oParam4); } oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam1 = new AseParameter("@flash_number", AseDbType.VarChar, 25); oParam1.Value = forFlashValue; oCmd.Parameters.Add(oParam1); AseParameter oParam2 = new AseParameter("@dtc_number", AseDbType.VarChar, 25); oParam2.Value = dtcTicket; oCmd.Parameters.Add(oParam2); oCon.Open(); oCmd.ExecuteNonQuery(); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-Exeute Data():", ex); oCon.Close(); oCon.Dispose(); oCon = null; throw; } }
public int CheckMappingData(string dtcTicket, string flashTicket) { int noOfRowReturned; AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd; oCmd = new AseCommand("CheckMapping", oCon); oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam0 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam0.Value = strHandler; oCmd.Parameters.Add(oParam0); AseParameter oParam2 = new AseParameter("@dtc_number", AseDbType.VarChar, 25); oParam2.Value = dtcTicket; oCmd.Parameters.Add(oParam2); AseParameter oParam3 = new AseParameter("@flash_number", AseDbType.VarChar, 25); oParam3.Value = flashTicket; oCmd.Parameters.Add(oParam3); oCon.Open(); noOfRowReturned = Convert.ToInt32(oCmd.ExecuteScalar()); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-CekMapping():", ex); oCon.Close(); oCon.Dispose(); oCon = null; if (ex.Message == "No Flash Record found") { return 0; } throw; } return noOfRowReturned; }
/// <summary> /// calling the stored procedure MCM_STAGE..FLSH_DTC_RCN_RPT /// prepare the comparison report and returns the data with exception and success /// </summary> public DataSet dsExceptionReport(string strTradeDate, int PageSize, string strType) { DataSet dsReport = new DataSet(); string strOut = string.Empty; string strCon = ConfigurationSettings.AppSettings["ConnectionSybaseMCM_STAGE"]; AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd; if (strType == "1")//Equity trades oCmd = new AseCommand("FLSH_DTC_RCN_RPT", oCon); else//FI trades oCmd = new AseCommand("FLSH_DTC_RCN_RPT_FI", oCon); oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam = new AseParameter("@trade_dt", AseDbType.DateTime); oParam.Value = Convert.ToDateTime(strTradeDate).ToShortDateString(); oCmd.Parameters.Add(oParam); AseParameter oParam1 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam1.Value = strHandler; oCmd.Parameters.Add(oParam1); AseDataAdapter oAseAdp = new AseDataAdapter(oCmd); oAseAdp.Fill(dsReport); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-dsExceptionReport():", ex); oCon.Close(); oCon.Dispose(); oCon = null; if (ex.Message == "No Broker Record for that date") { dsReport = null; return dsReport; } throw; } return dsReport; }
private void FillList() { AseConnection oCon = new AseConnection(strCon); SuggestionListFlash = ""; SuggestionListDtc = ""; try { string strHandler = Convert.ToString(Utility.GetFromSession("Handler")); int intTimeout; AseCommand oCmd; oCmd = new AseCommand("FLSH_RPT_ALL", oCon); oCmd.CommandType = CommandType.StoredProcedure; AseParameter oParam1 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam1.Value = strHandler; oCmd.Parameters.Add(oParam1); intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; oCon.Open(); AseDataReader reader = oCmd.ExecuteReader(); while (reader.Read()) { if (string.IsNullOrEmpty(SuggestionListFlash)) { flashList.Insert(0, reader["flashAccountNumber"].ToString()); SuggestionListFlash += "\"" + reader["flashAccountNumber"].ToString() + "\""; } else { flashList.Add(reader["flashAccountNumber"].ToString()); SuggestionListFlash += ", \"" + reader["flashAccountNumber"].ToString() + "\""; } } hdnFlash.Value = SuggestionListFlash; oCmd.CommandTimeout = intTimeout; oCmd = new AseCommand("DISTINCT_DTC_ALL", oCon); oCmd.CommandType = CommandType.StoredProcedure; AseParameter oParam2 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam2.Value = strHandler; oCmd.Parameters.Add(oParam2); intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; oCon.Open(); reader = oCmd.ExecuteReader(); while (reader.Read()) { if (string.IsNullOrEmpty(SuggestionListDtc)) { dtcList.Insert(0, reader["dtcAccountNumber"].ToString()); SuggestionListDtc += "\"" + reader["dtcAccountNumber"].ToString() + "\""; } else { dtcList.Add(reader["dtcAccountNumber"].ToString()); SuggestionListDtc += ", \"" + reader["dtcAccountNumber"].ToString() + "\""; } } hdnDtc.Value = SuggestionListDtc; oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-while filling autoomplete data:", ex); oCon.Close(); oCon.Dispose(); oCon = null; throw; } }
public DataSet GetData(procedure type, string flashAcctNum,string dtcAcctNum) { DataSet dsReport = new DataSet(); string strOut = string.Empty; string strCon = ConfigurationSettings.AppSettings["ConnectionSybaseMCM_STAGE"]; AseConnection oCon = new AseConnection(strCon); try { string strHandler = Convert.ToString(GetFromSession("Handler")); int intTimeout; AseCommand oCmd = null; if (type.Equals(procedure.SEARCH_FLSH_SINGLE))//Equity trades { oCmd = new AseCommand("SEARCH_FLSH_SINGLE", oCon); AseParameter oParam2 = new AseParameter("@flash_number", AseDbType.VarChar, 25); oParam2.Value = flashAcctNum; oCmd.Parameters.Add(oParam2); AseParameter oParam1 = new AseParameter("@dtc_number", AseDbType.VarChar, 25); oParam1.Value = dtcAcctNum; oCmd.Parameters.Add(oParam1); } if (type.Equals(procedure.SEARCH_NONACTIVE))//Equity trades { oCmd = new AseCommand("SEARCH_NotActive", oCon); AseParameter oParam2 = new AseParameter("@flash_number", AseDbType.VarChar, 25); oParam2.Value = flashAcctNum; oCmd.Parameters.Add(oParam2); AseParameter oParam1 = new AseParameter("@dtc_number", AseDbType.VarChar, 25); oParam1.Value = dtcAcctNum; oCmd.Parameters.Add(oParam1); } oCmd.CommandType = CommandType.StoredProcedure; intTimeout = oCmd.CommandTimeout; oCmd.CommandTimeout = 0; AseParameter oParam0 = new AseParameter("@recon_handle", AseDbType.VarChar, 25); oParam0.Value = strHandler; oCmd.Parameters.Add(oParam0); AseDataAdapter oAseAdp = new AseDataAdapter(oCmd); oAseAdp.Fill(dsReport); oCmd.CommandTimeout = intTimeout; oCmd.Dispose(); oCon.Close(); oCon.Dispose(); oCmd = null; oCon = null; } catch (Exception ex) { log.Info("Exception occured-GetData():", ex); oCon.Close(); oCon.Dispose(); oCon = null; if (ex.Message == "No Flash Record found") { dsReport = null; return dsReport; } throw; } return dsReport; }