Exemplo n.º 1
0
        ///<Summary>
        ///Select all rows
        ///This method returns all data rows in the table sales_reports
        ///</Summary>
        ///<returns>
        ///List-IDAOSalesReports.
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public static List <IDAOSalesReports> SelectAll()
        {
            Doing(null);
            MySqlCommand command = new MySqlCommand();

            command.CommandText = "ctpr_sales_reports_getall";
            command.CommandType = CommandType.StoredProcedure;
            MySqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable        dt         = new DataTable("sales_reports");
            MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command);

            try
            {
                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);


                List <IDAOSalesReports> objList = new List <IDAOSalesReports>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOSalesReports retObj = new DAOSalesReports();
                        retObj._groupBy         = Convert.IsDBNull(row["group_by"]) ? null : (string)row["group_by"];
                        retObj._display         = Convert.IsDBNull(row["display"]) ? null : (string)row["display"];
                        retObj._title           = Convert.IsDBNull(row["title"]) ? null : (string)row["title"];
                        retObj._filterRowSource = Convert.IsDBNull(row["filter_row_source"]) ? null : (string)row["filter_row_source"];
                        retObj._default         = Convert.IsDBNull(row["default"]) ? null : (string)row["default"];
                        retObj._ctrVersion      = Convert.IsDBNull(row["ctr_version"]) ? null : (string)row["ctr_version"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 2
0
        ///<Summary>
        ///Select one row by primary key(s)
        ///This method returns one row from the table sales_reports based on the primary key(s)
        ///</Summary>
        ///<returns>
        ///IDAOSalesReports
        ///</returns>
        ///<parameters>
        ///string groupBy
        ///</parameters>
        public static IDAOSalesReports SelectOne(string groupBy)
        {
            Doing(null);
            MySqlCommand command = new MySqlCommand();

            command.CommandText = "ctpr_sales_reports_getone";
            command.CommandType = CommandType.StoredProcedure;
            MySqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable        dt         = new DataTable("sales_reports");
            MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command);

            try
            {
                command.Parameters.Add(new MySqlParameter("?P_GROUP_BY", MySqlDbType.VarChar, 150, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)groupBy ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);


                DAOSalesReports retObj = null;
                if (dt.Rows.Count > 0)
                {
                    retObj                  = new DAOSalesReports();
                    retObj._groupBy         = Convert.IsDBNull(dt.Rows[0]["group_by"]) ? null : (string)dt.Rows[0]["group_by"];
                    retObj._display         = Convert.IsDBNull(dt.Rows[0]["display"]) ? null : (string)dt.Rows[0]["display"];
                    retObj._title           = Convert.IsDBNull(dt.Rows[0]["title"]) ? null : (string)dt.Rows[0]["title"];
                    retObj._filterRowSource = Convert.IsDBNull(dt.Rows[0]["filter_row_source"]) ? null : (string)dt.Rows[0]["filter_row_source"];
                    retObj._default         = Convert.IsDBNull(dt.Rows[0]["default"]) ? null : (string)dt.Rows[0]["default"];
                    retObj._ctrVersion      = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? null : (string)dt.Rows[0]["ctr_version"];
                }
                return(retObj);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 3
0
        ///<Summary>
        ///Select all rows by filter criteria
        ///This method returns all data rows in the table using criteriaquery api sales_reports
        ///</Summary>
        ///<returns>
        ///List-IDAOSalesReports.
        ///</returns>
        ///<parameters>
        ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake
        ///</parameters>
        public static List <IDAOSalesReports> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
        {
            Doing(null);
            MySqlCommand command = new MySqlCommand();

            command.CommandText = "ctpr_sales_reports_getbycriteria";
            command.CommandType = CommandType.StoredProcedure;
            MySqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable        dt         = new DataTable("sales_reports");
            MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command);

            try
            {
                string whereClause = GetSelectionCriteria(listCriterion);
                string orderClause = GetSelectionOrder(listOrder);
                string skipClause  = GetSelectionSkip(dataSkip);
                string takeClause  = GetSelectionTake(dataTake);
                command.Parameters.Add(new MySqlParameter("?P_SKİPCLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)skipClause ?? (object)DBNull.Value));
                command.Parameters.Add(new MySqlParameter("?P_TAKECLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)takeClause ?? (object)DBNull.Value));
                command.Parameters.Add(new MySqlParameter("?P_WHERECLAUSE", MySqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)whereClause ?? (object)DBNull.Value));
                command.Parameters.Add(new MySqlParameter("?P_ORDERCLAUSE", MySqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)orderClause ?? (object)DBNull.Value));
                command.Parameters.Add(new MySqlParameter("?P_SKİPCLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)skipClause ?? (object)DBNull.Value));
                command.Parameters.Add(new MySqlParameter("?P_TAKECLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)takeClause ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);


                List <IDAOSalesReports> objList = new List <IDAOSalesReports>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOSalesReports retObj = new DAOSalesReports();
                        retObj._groupBy         = Convert.IsDBNull(row["group_by"]) ? null : (string)row["group_by"];
                        retObj._display         = Convert.IsDBNull(row["display"]) ? null : (string)row["display"];
                        retObj._title           = Convert.IsDBNull(row["title"]) ? null : (string)row["title"];
                        retObj._filterRowSource = Convert.IsDBNull(row["filter_row_source"]) ? null : (string)row["filter_row_source"];
                        retObj._default         = Convert.IsDBNull(row["default"]) ? null : (string)row["default"];
                        retObj._ctrVersion      = Convert.IsDBNull(row["ctr_version"]) ? null : (string)row["ctr_version"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }