private void ProductForm_Load(object sender, EventArgs e) { keyName = this.Text; DataSet ds_image_desain = new DataSet(); DBSql.DoGetData("select url_design_img from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'", ds_image_desain); if (ds_image_desain.Tables[0].Rows.Count > 0) { if (!String.IsNullOrEmpty(ds_image_desain.Tables[0].Rows[0][0].ToString())) { if (ds_image_desain.Tables[0].Rows[0][0].ToString() != "-") { string url = "http://ultimindserver.mywire.org:3000/img_file/designs/" + ds_image_desain.Tables[0].Rows[0][0].ToString(); r_image = new RequestImage(); r_image.loadFromUrlAsync(url, delegate(Image img) { if (img != null) { pic_product.Image = img; } else { pic_product.Image = Properties.Resources.img_error; } }); } DataSet ds = DBSql.DoGetData("select design_id from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'"); design_id = ds.Tables[0].Rows[0][0].ToString(); DataSet ds_colors = DBSql.DoGetData("select color_desc, url_color_img, part_no, design_id from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'"); for (int i = 0; i < ds_colors.Tables[0].Rows.Count; i++) { list_colors.Items.Add(ds_colors.Tables[0].Rows[i][0].ToString()); list_colors_img.Add(ds_colors.Tables[0].Rows[i][1].ToString()); list_part.Add(ds_colors.Tables[0].Rows[i][2].ToString()); } } else { pic_product.Image = Properties.Resources.img_error; } } else { MessageBox.Show("Data Tidak ditemukan"); return; } }
private void list_colors_Click(object sender, EventArgs e) { lbl_part_no.Text = list_part[list_colors.SelectedIndex].ToString(); txt_color_name.Text = list_colors.SelectedItem.ToString(); if (list_colors_img[list_colors.SelectedIndex].ToString() == "-") { return; } string url = "http://ultimindserver.mywire.org:3000/img_file/colors/" + list_colors_img[list_colors.SelectedIndex].ToString(); r_image = new RequestImage(); r_image.loadFromUrlAsync(url, delegate(Image img) { if (img != null) { pic_colors.Image = img; } else { pic_colors.Image = Properties.Resources.img_error; } }); //MessageBox.Show(list_colors_img[list_colors.SelectedIndex].ToString()); }