Exemple #1
0
 public virtual IDictionary <string, IList <object> > SelectAllByCriteriaProjection(IList <IDataProjection> listProjection, IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
 {
     return(DAOCustomers.SelectAllByCriteriaProjection(listProjection, listCriterion, listOrder, dataSkip, dataTake));
 }
        ///<Summary>
        ///Select all rows by filter criteria
        ///This method returns all data rows in the table using criteriaquery api IdentityRole
        ///</Summary>
        ///<returns>
        ///IList-IDAOIdentityRole.
        ///</returns>
        ///<parameters>
        ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake
        ///</parameters>
        public static IList <IDAOIdentityRole> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
        {
            Doing(null);
            SqlCommand command = new SqlCommand();

            command.CommandText = GetSelectionCriteria(InlineProcs.ctprIdentityRole_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake);
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("IdentityRole");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

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

                List <IDAOIdentityRole> objList = new List <IDAOIdentityRole>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOIdentityRole retObj = new DAOIdentityRole();
                        retObj._ıd         = Convert.IsDBNull(row["Id"]) ? (Int32?)null : (Int32?)row["Id"];
                        retObj._name       = Convert.IsDBNull(row["Name"]) ? null : (string)row["Name"];
                        retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
        ///<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();
            }
        }
        ///<Summary>
        ///Select specific fields of all rows using criteriaquery api
        ///This method returns specific fields of all data rows in the table using criteriaquery apiIdentityRole
        ///</Summary>
        ///<returns>
        ///IDictionary-string, IList-object..
        ///</returns>
        ///<parameters>
        ///IList<IDataProjection> listProjection, IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake
        ///</parameters>
        public static IDictionary <string, IList <object> > SelectAllByCriteriaProjection(IList <IDataProjection> listProjection, IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
        {
            Doing(null);
            SqlCommand command = new SqlCommand();

            command.CommandText = GetSelectionCriteria(InlineProcs.ctprIdentityRole_SelectAllByCriteriaProjection, listProjection, listCriterion, listOrder, dataSkip, dataTake);
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("IdentityRole");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

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

                IDictionary <string, IList <object> > dict = new Dictionary <string, IList <object> >();
                foreach (IDataProjection projection in listProjection)
                {
                    IList <object> lst = new List <object>();
                    dict.Add(projection.Member, lst);
                    foreach (DataRow row in dt.Rows)
                    {
                        if (string.Compare(projection.Member, "Id", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["Id"]) ? (Int32?)null : (Int32?)row["Id"]);
                        }
                        if (string.Compare(projection.Member, "Name", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["Name"]) ? null : (string)row["Name"]);
                        }
                    }
                }
                return(dict);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
        ///<Summary>
        ///Select specific fields of all rows using criteriaquery api
        ///This method returns specific fields of all data rows in the table using criteriaquery apisales_reports
        ///</Summary>
        ///<returns>
        ///IDictionary-string, IList-object..
        ///</returns>
        ///<parameters>
        ///IList<IDataProjection> listProjection, IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake
        ///</parameters>
        public static IDictionary <string, IList <object> > SelectAllByCriteriaProjection(IList <IDataProjection> listProjection, IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
        {
            Doing(null);
            MySqlCommand command = new MySqlCommand();

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

            command.Connection = staticConnection;

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

            try
            {
                string fieldsField = GetProjections(listProjection);
                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_FİELDSFİELD", MySqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)fieldsField ?? (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);


                IDictionary <string, IList <object> > dict = new Dictionary <string, IList <object> >();
                foreach (IDataProjection projection in listProjection)
                {
                    IList <object> lst = new List <object>();
                    dict.Add(projection.Member, lst);
                    foreach (DataRow row in dt.Rows)
                    {
                        if (string.Compare(projection.Member, "group_by", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["group_by"]) ? null : (string)row["group_by"]);
                        }
                        if (string.Compare(projection.Member, "display", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["display"]) ? null : (string)row["display"]);
                        }
                        if (string.Compare(projection.Member, "title", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["title"]) ? null : (string)row["title"]);
                        }
                        if (string.Compare(projection.Member, "filter_row_source", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["filter_row_source"]) ? null : (string)row["filter_row_source"]);
                        }
                        if (string.Compare(projection.Member, "default", true) == 0)
                        {
                            lst.Add(Convert.IsDBNull(row["default"]) ? null : (string)row["default"]);
                        }
                    }
                }
                return(dict);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }