//public string CoreBankingPoolCall(string arr_company_code, string arr_file_name, string arr_userid) //{ // try // { // string[] p_company_code = new string[1]; // p_company_code[0] = arr_company_code; // string[] p_file_name = new string[1]; // p_file_name[0] = arr_file_name; // string[] p_userid = new string[1]; // p_userid[0] = arr_userid; // int[] arrSize = new int[1]; // arrSize[0] = 1000; // Oracle.DataAccess.Client.OracleConnection conn = new Oracle.DataAccess.Client.OracleConnection(ConnectionString); // conn.Open(); // Oracle.DataAccess.Client.OracleCommand cmd = conn.CreateCommand(); // cmd.CommandText = "corebank_system_sym_pub"; // cmd.CommandType = CommandType.StoredProcedure; // cmd.BindByName = true; // cmd.ArrayBindCount = 1; // cmd.Parameters.Add("p_company_code", OracleDbType.Varchar2, p_company_code, ParameterDirection.Input); // cmd.Parameters.Add("p_file_name", OracleDbType.Varchar2, p_file_name, ParameterDirection.Input); // cmd.Parameters.Add("p_userid", OracleDbType.Varchar2, p_userid, ParameterDirection.Input); // cmd.Parameters.Add("p_retval", OracleDbType.Varchar2, "", ParameterDirection.Output).ArrayBindSize = arrSize; // int result = cmd.ExecuteNonQuery(); // string p_return = ((Oracle.DataAccess.Types.OracleString[])(cmd.Parameters["p_retval"].Value))[0].ToString(); // } // catch (Exception ex) // { // return ex.Message; // } // return ""; //} public string force_updation(GridView gv, string User_ID, string type, int count, string company_code, string file_name) { string retval = ""; string[] retCount; try { int updateCount = 0; string[] arr = new string[count]; int m = 0; for (int i = 0; i < count; i++) { //if (((HiddenField)gv.Rows[i].FindControl("hf_BranchCode")).Value != "" && ((TextBox)gv.Rows[i].FindControl("txtaccountno_symbol")).Text != "") if (((TextBox)gv.Rows[i].FindControl("txtBranchCode")).Text != "Branch not found" && ((TextBox)gv.Rows[i].FindControl("txtBranchCode")).Text != "" && ((TextBox)gv.Rows[i].FindControl("txtaccountno_symbol")).Text != "" && //((TextBox)gv.Rows[i].FindControl("txtSymbolTitle")).Text != "Account Title not found." && ((TextBox)gv.Rows[i].FindControl("txtSymbolTitle")).Text != "Symbol Title" && ((TextBox)gv.Rows[i].FindControl("txtSymbolTitle")).Text != "") { arr[i] = m.ToString(); updateCount++; } else { arr[i] = "N"; } m++; } string[] p_Rowid = new string[updateCount]; string[] p_branch_code = new string[updateCount]; string[] p_Account_no = new string[updateCount]; string[] p_benename = new string[updateCount]; string[] P_Userid = new string[updateCount]; string[] P_type = new string[updateCount]; string[] P_company_code = new string[updateCount]; string[] p_file_name = new string[updateCount]; int[] arrSize = new int[updateCount]; retCount = new string[updateCount]; int u = 0; for (int i = 0; i < count; i++) { if (arr[i].ToString() != "N") { arrSize[u] = 1000; p_Rowid[u] = gv.Rows[i].Cells[0].Text; //p_branch_code[u] = (((HiddenField)gv.Rows[Convert.ToInt32(arr[i])].FindControl("hf_BranchCode")).Value == "" ? gv.Rows[i].Cells[3].Text : ((HiddenField)gv.Rows[i].FindControl("hf_BranchCode")).Value); p_branch_code[u] = (((TextBox)gv.Rows[Convert.ToInt32(arr[i])].FindControl("txtBranchCode")).Text == "" ? gv.Rows[i].Cells[3].Text : ((TextBox)gv.Rows[i].FindControl("txtBranchCode")).Text); p_Account_no[u] = (((TextBox)gv.Rows[Convert.ToInt32(arr[i])].FindControl("txtaccountno_symbol")).Text == "" ? gv.Rows[i].Cells[1].Text : ((TextBox)gv.Rows[i].FindControl("txtaccountno_symbol")).Text); p_benename[u] = ((TextBox)gv.Rows[Convert.ToInt32(arr[i])].FindControl("txtSymbolTitle")).Text; //(((TextBox)gv.Rows[Convert.ToInt32(arr[i])].FindControl("txtSymbolTitle")).Text == "" ? gv.Rows[i].Cells[1].Text : ((TextBox)gv.Rows[i].FindControl("txtaccountno_symbol")).Text); P_Userid[u] = User_ID; P_type[u] = type; P_company_code[u] = company_code; p_file_name[u] = file_name; u++; } } if (p_Rowid.Length > 0) { Oracle.DataAccess.Client.OracleConnection conn = new Oracle.DataAccess.Client.OracleConnection(ConnectionString); conn.Open(); Oracle.DataAccess.Client.OracleTransaction trans = conn.BeginTransaction(); Oracle.DataAccess.Client.OracleCommand cmd = conn.CreateCommand(); cmd.CommandText = "sp_force_Updation"; cmd.CommandType = CommandType.StoredProcedure; cmd.BindByName = true; cmd.ArrayBindCount = updateCount; cmd.Parameters.Add("p_rowid", OracleDbType.Varchar2, p_Rowid, ParameterDirection.Input); cmd.Parameters.Add("p_branch_code", OracleDbType.Varchar2, p_branch_code, ParameterDirection.Input); cmd.Parameters.Add("p_Account_no", OracleDbType.Varchar2, p_Account_no, ParameterDirection.Input); cmd.Parameters.Add("p_benename", OracleDbType.Varchar2, p_benename, ParameterDirection.Input); cmd.Parameters.Add("P_Userid", OracleDbType.Varchar2, P_Userid, ParameterDirection.Input); cmd.Parameters.Add("P_type", OracleDbType.Varchar2, P_type, ParameterDirection.Input); cmd.Parameters.Add("p_company_code", OracleDbType.Varchar2, P_company_code, ParameterDirection.Input); cmd.Parameters.Add("p_file_name", OracleDbType.Varchar2, p_file_name, ParameterDirection.Input); cmd.Parameters.Add("p_retval", OracleDbType.Varchar2, "", ParameterDirection.Output).ArrayBindSize = arrSize; int result = cmd.ExecuteNonQuery(); for (int i = 0; i < updateCount; i++) { retCount[i] = ((Oracle.DataAccess.Types.OracleString[])(cmd.Parameters["p_retval"].Value))[i].ToString(); if (retCount[i].ToString().StartsWith("0") == true) //Error { trans.Rollback(); conn.Close(); return(retCount[i]); } } trans.Commit(); conn.Close(); retval = retCount[0]; } } catch (Exception ex) { retval = "0;" + ex.Message; } return(retval); }
/// <summary> /// Executes the command. /// </summary> /// <param name="dbCommand">The current sql command.</param> /// <param name="commandText">The command text to execute.</param> /// <param name="commandType">The command type.</param> /// <param name="connectionString">The connection string to use.</param> /// <param name="values">The collection of sql parameters to include.</param> /// <returns>-1 if command execution failed.</returns> public Int32 ExecuteCommand(ref DbCommand dbCommand, string commandText, CommandType commandType, string connectionString, params DbParameter[] values) { // Initial connection objects. dbCommand = null; Int32 returnValue = -1; OracleClient.OracleConnection orlConnection = null; OracleClient.OracleTransaction orlTransaction = null; try { // Create a new connection. using (orlConnection = new OracleClient.OracleConnection(connectionString)) { // Open the connection. orlConnection.Open(); // Start a new transaction. orlTransaction = orlConnection.BeginTransaction(); // Create the command and assign any parameters. dbCommand = new OracleClient.OracleCommand(DataTypeConversion.GetSqlConversionDataTypeNoContainer( ConnectionContext.ConnectionDataType.OracleDataType, commandText), orlConnection); dbCommand.CommandType = commandType; dbCommand.Transaction = orlTransaction; if (values != null) { foreach (OracleClient.OracleParameter sqlParameter in values) { dbCommand.Parameters.Add(sqlParameter); } } // Execute the command. returnValue = dbCommand.ExecuteNonQuery(); // Commit the transaction. orlTransaction.Commit(); // Close the database connection. orlConnection.Close(); } // Return true. return(returnValue); } catch (Exception ex) { try { // Attempt to roll back the transaction. if (orlTransaction != null) { orlTransaction.Rollback(); } } catch { } // Throw a general exception. throw new Exception(ex.Message, ex.InnerException); } finally { if (orlConnection != null) { orlConnection.Close(); } } }
public string DataPublishTrans(int count, DataTable dt, string Company_code, string FielName, string User_ID, string type) { string retval = ""; string[] retCount = new string[count]; try { string[] arr_company_Code = new string[count]; string[] arr_FielName = new string[count]; string[] P_Trans_type = new string[count]; string[] P_Rowid = new string[count]; string[] p_bank_code = new string[count]; string[] p_branch_code = new string[count]; string[] P_Userid = new string[count]; string[] P_type = new string[count]; int[] arrSize = new int[count]; for (int i = 0; i < count; i++) { arrSize[i] = 1000; arr_company_Code[i] = Company_code; arr_FielName[i] = FielName; P_Trans_type[i] = dt.Rows[i]["TRANS_TYPE"].ToString(); P_Rowid[i] = dt.Rows[i]["ROWID"].ToString(); p_bank_code[i] = ""; p_branch_code[i] = ""; P_Userid[i] = User_ID; P_type[i] = type; } Oracle.DataAccess.Client.OracleConnection conn = new Oracle.DataAccess.Client.OracleConnection(ConnectionString); conn.Open(); Oracle.DataAccess.Client.OracleTransaction trans = conn.BeginTransaction(); Oracle.DataAccess.Client.OracleCommand cmd = conn.CreateCommand(); cmd.CommandText = "sp_Data_Publish"; cmd.CommandType = CommandType.StoredProcedure; cmd.BindByName = true; cmd.ArrayBindCount = count; cmd.Parameters.Add("P_company_code", OracleDbType.Varchar2, arr_company_Code, ParameterDirection.Input); cmd.Parameters.Add("P_FILE_NAME", OracleDbType.Varchar2, arr_FielName, ParameterDirection.Input); cmd.Parameters.Add("P_Trans_type", OracleDbType.Varchar2, P_Trans_type, ParameterDirection.Input); cmd.Parameters.Add("P_Rowid", OracleDbType.Varchar2, P_Rowid, ParameterDirection.Input); cmd.Parameters.Add("p_bank_code", OracleDbType.Varchar2, p_bank_code, ParameterDirection.Input); cmd.Parameters.Add("p_branch_code", OracleDbType.Varchar2, p_branch_code, ParameterDirection.Input); cmd.Parameters.Add("P_Userid", OracleDbType.Varchar2, P_Userid, ParameterDirection.Input); cmd.Parameters.Add("P_type", OracleDbType.Varchar2, P_type, ParameterDirection.Input); cmd.Parameters.Add("v_retval", OracleDbType.Varchar2, "", ParameterDirection.Output).ArrayBindSize = arrSize; #region int result = cmd.ExecuteNonQuery(); for (int i = 0; i < count; i++) { retCount[i] = ((Oracle.DataAccess.Types.OracleString[])(cmd.Parameters["v_retval"].Value))[i].ToString(); if (retCount[i].ToString().StartsWith("04") == false) { trans.Rollback(); conn.Close(); return(retCount[i]); } } string val = postLeadger(arr_company_Code[0], arr_FielName[0], P_Trans_type[0], P_Rowid[0], p_bank_code[0], p_branch_code[0], P_Userid[0], "14"); if (val.StartsWith("04")) { trans.Commit(); conn.Close(); //CoreBankingPoolCall(arr_company_Code[0], arr_FielName[0], P_Userid[0]); retval = retCount[0]; } else { trans.Rollback(); conn.Close(); return(val); } #endregion } catch (Exception ex) { retval = ex.Message; } return(retval); }