private async void LoadCategories()
        {
            var categories = await ProductRepository.SingleInstance.FetchAllCategoriesAsync();

            CategoryRepeater.DataSource = categories;
            CategoryRepeater.DataBind();
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (UoW.Create())
     {
         IList <FlattenedCategoryProjection> categories = CategoryProjections.GetAll();
         CategoryRepeater.DataSource = categories;
         CategoryRepeater.DataBind();
     }
 }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)  // do this setup once, on the first visit
     {
         var controller = new ProductController();
         var data       = controller.AllProductsCategory();
         CategoryRepeater.DataSource = data;
         CategoryRepeater.DataBind();
     }
 }
Example #4
0
        private void LoadCategories()
        {
            List <string> CategoryList = new List <string>
            {
                Constants.OrderStatus.Pending.ToString(),
                          Constants.OrderStatus.Cancelled.ToString(),
                          Constants.OrderStatus.Finished.ToString()
            };
            var categories = CategoryList;

            CategoryRepeater.DataSource = categories;
            CategoryRepeater.DataBind();
        }
Example #5
0
        private void LoadCategories()
        {
            List <string> NotificationTypes = new List <string>
            {
                Constants.NotificationTypeDefinitions.DELETE_USER,
                Constants.NotificationTypeDefinitions.CREATED_NEW_USER,
                Constants.NotificationTypeDefinitions.UPDATED_USER,
                Constants.NotificationTypeDefinitions.CANCELLED_ORDER,
                Constants.NotificationTypeDefinitions.FINISHED_ORDER,
                Constants.NotificationTypeDefinitions.SOLD_ITEM,
                Constants.NotificationTypeDefinitions.ADDED_PRODUCT,
                Constants.NotificationTypeDefinitions.UPDATED_PRODUCT
            };

            CategoryRepeater.DataSource = NotificationTypes;
            CategoryRepeater.DataBind();
        }
        private void BindCategoryRepeater()
        {
            String cs = ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString1"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                using (SqlCommand cmd = new SqlCommand("select * from ProductCategoryTable", con))
                {
                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                    {
                        DataTable dt = new DataTable();
                        sda.Fill(dt);

                        CategoryRepeater.DataSource = dt;
                        CategoryRepeater.DataBind();
                    }
                }
            }
        }
Example #7
0
        private void SearchPopulateRepeater()
        {
            string searchText = (string)Session["searchBarText"];

            var           connectionString = ConfigurationManager.ConnectionStrings["AdventureWorksLT2012"].ConnectionString;
            SqlConnection sqlConnection    =
                new SqlConnection(connectionString);

            string sqlQuery = "SELECT * FROM dbo.CustomView WHERE Name LIKE '%" + searchText + "%'";

            SqlCommand    sqlCommand    = new SqlCommand(sqlQuery, sqlConnection);
            SqlDataReader sqlDataReader = null;

            try
            {
                sqlConnection.Open();
                sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess);
                CategoryRepeater.DataSource = sqlDataReader;
                CategoryRepeater.DataBind();
            }
            catch (Exception hh)
            {
                //Label1.Text = "Failed to get items from data base";
                //Label1.Visible = true;
                Response.Write(hh);
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                    sqlDataReader.Dispose();
                }
                sqlCommand.Dispose();
                sqlConnection.Close();
                sqlConnection.Dispose();
            }
        }
Example #8
0
        private void GetsAndPopulateRepeater()
        {
            int pCID = 0;

            int.TryParse((string)Session["ProductCategoryID"], out pCID);

            var           connectionString = ConfigurationManager.ConnectionStrings["AdventureWorksLT2012"].ConnectionString;
            SqlConnection sqlConnection    =
                new SqlConnection(connectionString);

            SqlCommand    sqlCommand    = new SqlCommand(CheckIfNull(pCID), sqlConnection);
            SqlDataReader sqlDataReader = null;

            try
            {
                sqlConnection.Open();
                sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess);
                CategoryRepeater.DataSource = sqlDataReader;
                CategoryRepeater.DataBind();
            }
            catch (Exception hh)
            {
                //Label1.Text = "Failed to get items from data base";
                //Label1.Visible = true;
                Response.Write(hh);
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                    sqlDataReader.Dispose();
                }
                sqlCommand.Dispose();
                sqlConnection.Close();
                sqlConnection.Dispose();
            }
        }