예제 #1
0
        public DataTable LedgerItemsRaw(int Guarantor, bool IsPulledStatus)
        {
            DataTable       rValdtWorking = new DataTable();
            MySqlConnection con           = new MySqlConnection(this._MySqlConnectionString);

            try
            {
                con.Open();

                MySqlDataAdapter da = new MySqlDataAdapter(PP_ODSQLPullStrings_LedgerItem.PullAll_FromOD(Guarantor, IsPulledStatus), con);

                da.Fill(rValdtWorking);
            }
            catch (Exception exc)
            {
                exc.ToString();
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            for (int i = 0; i < Columns.Length; i++)             // If exception is thrown here I want to know it because it means my columns array is not right.
            {
                rValdtWorking.Columns[i].ColumnName = Columns[i];
            }
            return(rValdtWorking);
        }
예제 #2
0
        /// <summary>
        /// Returns the Number of Guarantors
        /// </summary>
        /// <param name="Guarantor"></param>
        /// <param name="IsPulledStatus"></param>
        /// <returns></returns>
        public int LedgerItemsRawCount(int Guarantor, bool IsPulledStatus)
        {
            DataTable       rValdtWorking   = new DataTable();
            int             ItemsInRawQuery = -1;
            MySqlConnection con             = new MySqlConnection(this._MySqlConnectionString);

            try
            {
                con.Open();
                string command = PP_ODSQLPullStrings_LedgerItem.PullAll_FromOD(Guarantor, IsPulledStatus);
                command = "SELECT Count(Distinct (tb1.Guarantor)) FROM ( " + command + ") as tb1";
                MySqlDataAdapter da = new MySqlDataAdapter(command, con);
                da.Fill(rValdtWorking);
                if (rValdtWorking != null && rValdtWorking.Rows.Count != 0 && rValdtWorking.Columns.Count != 0)
                {
                    if (rValdtWorking.Rows[0][0] != null)
                    {
                        ItemsInRawQuery = Int32.Parse(rValdtWorking.Rows[0][0].ToString());
                    }
                }
            }
            catch (Exception exc)
            {
                exc.ToString();
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(ItemsInRawQuery);
        }