Example #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            bicycleBL = new BicycleBL();
            categoryBL = new CategoryBL();
            subCategoryBL = new SubCategoryBL();
            producerBL = new ProducerBL();
            sizeBL = new SizeBL();
            colorBL = new ColorBL();
            if (Session["listBike"] != null)
            {

                listBike = (List<Bicycles>)Session["listBike"];
                // ColorSelector.SelectedValue = Session["listBike"].ToString();
            }
            else
            {
                listBike = bicycleBL.getAllBike();
            }
            List<Producer> listProducer = producerBL.getAllProducer();
            List<Category> listCategory = categoryBL.getAllCategory();
            List<SubCategory> listSubCategory = subCategoryBL.getAllSubCategory();
            List<Size> listSize = sizeBL.getAllSizes();
            List<Color> listColor = colorBL.getAllColor();
            if (!Page.IsPostBack)
            {

                selected_producer.Items.Clear();
                selected_producer.Items.Add(new ListItem("שם היצרן", "-1"));
                foreach (Producer p in listProducer)
                {
                    selected_producer.Items.Add(new ListItem(p._producer, p._id.ToString()));
                }
                selected_Category_Main.Items.Clear();
                selected_Category_Main.Items.Add(new ListItem("בחר קטגוריה", "-1"));
                foreach (Category c in listCategory)
                {
                    selected_Category_Main.Items.Add(new ListItem(c._category, c._id.ToString()));
                }
                selected_SubCategory_main.Items.Clear();
                selected_SubCategory_main.Items.Add(new ListItem("בחר תת קטגוריה", "-1"));
                foreach (SubCategory s in listSubCategory)
                {
                    selected_SubCategory_main.Items.Add(new ListItem(s._subCategory, s._id.ToString()));
                }
                selected_Size.Items.Clear();
                selected_Size.Items.Add(new ListItem("בחר גודל", "-1"));
                foreach (Size si in listSize)
                {
                    selected_Size.Items.Add(new ListItem(si._size, si._id.ToString()));
                }
                selected_Color.Items.Clear();
                selected_Color.Items.Add(new ListItem("בחר צבע", "-1"));
                foreach (Color c in listColor)
                {
                    selected_Color.Items.Add(new ListItem(c._color, c._id.ToString()));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] == null)
            {
                Response.Redirect("../Pages/Main");
            }

            List<etgarPlus.Classes.Bicycles> bikeListCheck;
            etgarPlus.Logic.ProducerBL producerBL = new etgarPlus.Logic.ProducerBL();
            List<etgarPlus.Classes.Producer> lisProducer = producerBL.getAllProducer();

            etgarPlus.Logic.CategoryBL categoryBL = new etgarPlus.Logic.CategoryBL();
            List<etgarPlus.Classes.Category> listCategory = categoryBL.getAllCategory();

            etgarPlus.Logic.SubCategoryBL subCategoryBL = new etgarPlus.Logic.SubCategoryBL();
            List<etgarPlus.Classes.SubCategory> listSubCategory = subCategoryBL.getAllSubCategory();

            etgarPlus.Logic.SizeBL sizeBL = new etgarPlus.Logic.SizeBL();
            List<etgarPlus.Classes.Size> lisSize = sizeBL.getAllSizes();

            etgarPlus.Logic.ColorBL bicycleBL = new etgarPlus.Logic.ColorBL();
            List<etgarPlus.Classes.Color> lisColor = bicycleBL.getAllColor();

            foreach (etgarPlus.Classes.Producer p in lisProducer)
            {
                selected_producer.Items.Add(new ListItem(p._producer, p._id.ToString()));
            }
            selected_producer.Items.Add(new ListItem("אחר", "-2"));
            foreach (etgarPlus.Classes.Category c in listCategory)
            {
                selected_Category.Items.Add(new ListItem(c._category, c._id.ToString()));
            }
            selected_Category.Items.Add(new ListItem("אחר", "-2"));
            foreach (etgarPlus.Classes.SubCategory s in listSubCategory)
            {
                selected_SubCategory.Items.Add(new ListItem(s._subCategory, s._id.ToString()));
            }
            selected_SubCategory.Items.Add(new ListItem("אחר", "-2"));

            foreach (etgarPlus.Classes.Size si in lisSize)

            {
                selected_Size.Items.Add(new ListItem(si._size, si._id.ToString()));

            }
            selected_Size.Items.Add(new ListItem("אחר", "-2"));

            foreach (etgarPlus.Classes.Color c in lisColor)
            {
                selected_Color.Items.Add(new ListItem(c._color, c._id.ToString()));

            }
            selected_Color.Items.Add(new ListItem("אחר", "-2"));

            createTable(1);
            createTable(2);
            createProdTable();
        }
        protected void createProdTable()
        {
            //newClientDiv.Style.Add("display", "none");
                //allClientDiv.Style.Add("display", "none");
                Table table1 = new Table();
                table1 = allProductTable;
                List<Bicycles> BicyclesList = new List<Bicycles>();
                BicycleBL bike = new BicycleBL();
                CategoryBL category = new CategoryBL();
                SubCategoryBL subCategory = new SubCategoryBL();
                ProducerBL producer = new ProducerBL();
                ColorBL color = new ColorBL();
                SizeBL size = new SizeBL();
                BicyclesList = bike.getAllBike();
                for (int i = 0; i < BicyclesList.Count; i++)
                {
                    TableRow dr = new TableRow();
                    TableCell cell = new TableCell();
                    //שם יצרן
                    cell.Text = producer.GetProducer(BicyclesList[i]._Name).ToString();
                    dr.Cells.Add(cell);
                    //cell = new TableCell();
                    //cell.Text = "דגם";
                    //dr.Cells.Add(cell);
                    //קטגוריה ראשית
                    cell = new TableCell();
                    cell.Text = category.getCategoryById(BicyclesList[i]._MainCategoryId).ToString();
                    dr.Cells.Add(cell);
                    //קטגוריה משנית
                    cell = new TableCell();
                    cell.Text = subCategory.GetSubCategory(BicyclesList[i]._SubCategoryId).ToString();
                    dr.Cells.Add(cell);
                    //מידה
                    cell = new TableCell();
                    cell.Text = size.getSize(BicyclesList[i]._size).ToString();
                    dr.Cells.Add(cell);
                    //צבע
                    cell = new TableCell();
                    cell.Text = color.getColorById(BicyclesList[i]._colorId).ToString();
                    dr.Cells.Add(cell);
                    //כמות
                    cell = new TableCell();
                    cell.Text = BicyclesList[i]._Quantity.ToString();
                    dr.Cells.Add(cell);
                    //מחיר
                    cell = new TableCell();
                    cell.Text = BicyclesList[i]._RegularPrice.ToString();
                    dr.Cells.Add(cell);

                    table1.Rows.Add(dr);

            }
        }