private void DetailOrderView_Load(object sender, EventArgs e) { product = controller.getProductbyId(order.product_id); product_color = controller.getColorbyId(order.color_id); InitData(); }
private void Clb_color_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.Index >= 0 && cb_Color_Selected != null) { Product_Color_Model color = (Product_Color_Model)clb_color.Items[e.Index]; if (e.NewValue == CheckState.Checked) { cb_Color_Selected.Items.Add(color); } else if (e.NewValue == CheckState.Unchecked) { foreach (Product_Color_Model item in cb_Color_Selected.Items) { if (item.Id == color.Id) { cb_Color_Selected.Items.Remove(item); break; } } } if (cb_Color_Selected.SelectedIndex == -1) { cb_Color_Selected.SelectedIndex = 0; } } }
public List <Product_Color_Model> getColorList() { List <Product_Color_Model> result = new List <Product_Color_Model>(); try { DataTable dt = DBHandler.selectDataBase(ref conn, "`order_product_color`", "*", string.Empty); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { Product_Color_Model item = new Product_Color_Model() { Id = (long)dt.Rows[i]["color_id"], Name = (string)dt.Rows[i]["color_name"], Colors = Functions.GenerateColor((string)dt.Rows[i]["color_value"]), ColorCode = (string)dt.Rows[i]["color_value"], colorofstyle = (long)dt.Rows[i]["colorofstyle"] }; result.Add(item); } } } catch (Exception ex) { LogFile.writeLog(LogFile.DIR, "Exception" + LogFile.getTimeStringNow() + ".txt", LogFile.Filemode.GHIDE, ex.Message); } return(result); }
private string getColorList() { string result = string.Empty; result += "var color_pro = {"; string ColorUseList = pn_Image.getColorList(); foreach (string item in ColorUseList.Split(',')) { Product_Color_Model color = lstColor.Where(c => c.Id == long.Parse(item)).FirstOrDefault(); if (color != null) { result += "c" + color.Id + ":\"" + color.ColorCode + "\","; } } result += "};"; return(result); }
public ImageStyle(Size ParentSize) : base() { this.Size = new Size(ParentSize.Width, 630); ColorPanel = new Panel(); ColorPanel.Location = new Point(0, 0); ColorPanel.Size = new Size(530, 630); this.Controls.Add(ColorPanel); Stylepic = new PictureBox(); Stylepic.Location = new Point(0, 0); Stylepic.Size = new Size(530, 630); ColorPanel.Controls.Add(Stylepic); lb_Name = new LablewithConsolasfont(); lb_Name.BackColor = Color.White; lb_Name.Location = new Point(540, 20); lb_Name.Size = new Size(100, 20); this.Controls.Add(lb_Name); lb_ColorList = new LablewithConsolasfont(); lb_ColorList.Location = new Point(lb_Name.Location.X, lb_Name.Location.Y + lb_Name.Size.Height + 10); lb_ColorList.Size = new Size(100, 20); lb_ColorList.Text = "Color List: "; this.Controls.Add(lb_ColorList); clb_color = new CustomCheckListBox(); clb_color.Location = new Point(lb_ColorList.Location.X, lb_ColorList.Location.Y + lb_ColorList.Size.Height); clb_color.DisplayMember = "Name"; clb_color.ItemCheck += Clb_color_ItemCheck; clb_color.Size = new Size(150, 400); clb_color.CheckOnClick = true; this.Controls.Add(clb_color); cb_Color_Selected = new ComboBox(); cb_Color_Selected.Location = new Point(clb_color.Location.X, clb_color.Location.Y + clb_color.Size.Height); cb_Color_Selected.Size = new Size(150, 40); cb_Color_Selected.DisplayMember = "Name"; cb_Color_Selected.DropDownStyle = ComboBoxStyle.DropDownList; cb_Color_Selected.SelectedIndexChanged += Cb_Color_Selected_SelectedIndexChanged; Product_Color_Model DefaultItem = new Product_Color_Model() { Id = -1, Name = "(Default)", Colors = Color.Black }; cb_Color_Selected.Items.Add(DefaultItem); cb_Color_Selected.SelectedIndex = 0; this.Controls.Add(cb_Color_Selected); btn_FronImage = new Button(); btn_FronImage.Location = new Point(cb_Color_Selected.Location.X, cb_Color_Selected.Location.Y + cb_Color_Selected.Size.Height); btn_FronImage.Size = new Size(70, 40); btn_FronImage.Click += Btn_FronImage_Click; btn_FronImage.Text = "Trước"; this.Controls.Add(btn_FronImage); btn_BehideImage = new Button(); btn_BehideImage.Location = new Point(btn_FronImage.Location.X + btn_FronImage.Width + 10, btn_FronImage.Location.Y); btn_BehideImage.Size = new Size(70, 40); btn_BehideImage.Text = "Sau"; btn_BehideImage.Click += Btn_BehideImage_Click; this.Controls.Add(btn_BehideImage); }