public Edit_PC_OrderForm(Classes.PC2 obj) { InitializeComponent(); img_processing = false; processing = true; this.tip = new ToolTip(); curtain2 = obj; show_load(); add_actions(); setTooltipsyardage(); processing = false; }
private void bunifuCustomDataGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 20) { Classes.PC2 PCurtain = null; List <KeyValuePair <string, object> > keyValuePairs = new List <KeyValuePair <string, object> >(); try { PCurtain = new Classes.PC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), category_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory"].Value.ToString().Split(' ')[0]), category_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_id"].Value.ToString(), system_color_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSystemColor"].Value.ToString(), system_color_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnColor_id"].Value.ToString(), width = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnWidth"].Value.ToString()), height = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnHeight"].Value.ToString()), yardage = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnYardage"].Value.ToString()), count = Convert.ToInt32(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCount"].Value.ToString()), equipment_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEquipment_price"].Value.ToString().ToString().Split(' ')[0]), equipment_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEquipment"].Value.ToString(), installation_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnInstallation_price"].Value.ToString().ToString().Split(' ')[0]), installation_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnInstallation"].Value.ToString(), customer_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCustomer"].Value.ToString(), start_order_time = Convert.ToDateTime(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnStartDate"].Value), end_order_time = Convert.ToDateTime(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEndDate"].Value), picture = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnPicture"].Value.ToString(), price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnPrice"].Value.ToString().ToString().Split(' ')[0]) }; keyValuePairs.Add(new KeyValuePair <string, object>(key: "{fb_id}", value: PCurtain.fb_id)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{category_price}", value: PCurtain.category_price)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{system_color_name}", value: PCurtain.system_color_name)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{width}", value: PCurtain.width)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{height}", value: PCurtain.height)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{yardage}", value: PCurtain.yardage)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{count}", value: PCurtain.count)); get_equipment(keyValuePairs, PCurtain.equipment_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{equipment_price}", value: PCurtain.equipment_price)); get_installation(keyValuePairs, PCurtain.installation_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{installation_price}", value: PCurtain.installation_price)); get_customer(keyValuePairs, PCurtain.customer_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{start_order_time}", value: PCurtain.start_order_time)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{end_order_time}", value: PCurtain.end_order_time)); load_img(keyValuePairs, PCurtain.picture, PCurtain.width, PCurtain.height, PCurtain.yardage); //keyValuePairs.Add(new KeyValuePair<string, object>(key: "{picture}", value: fabricCurtain.picture)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{price}", value: PCurtain.price)); } catch (Exception ex) { MessageBox.Show($"Помилка при відображенні форми друкування.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } printOrder.FormSelectPrint formSelect = new printOrder.FormSelectPrint(keyValuePairs, Classes.ClassPatternPath.PC_PATTERN); formSelect.ShowDialog(); } else if (e.ColumnIndex == 21) { Classes.PC2 PCurtain = null; try { PCurtain = new Classes.PC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), category_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory"].Value.ToString().Split(' ')[0]), category_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_id"].Value.ToString(), system_color_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSystemColor"].Value.ToString(), system_color_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnColor_id"].Value.ToString(), width = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnWidth"].Value.ToString()), height = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnHeight"].Value.ToString()), yardage = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnYardage"].Value.ToString()), count = Convert.ToInt32(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCount"].Value.ToString()), equipment_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEquipment_price"].Value.ToString().ToString().Split(' ')[0]), equipment_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEquipment"].Value.ToString(), installation_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnInstallation_price"].Value.ToString().ToString().Split(' ')[0]), installation_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnInstallation"].Value.ToString(), customer_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCustomer"].Value.ToString(), start_order_time = Convert.ToDateTime(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnStartDate"].Value), end_order_time = Convert.ToDateTime(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnEndDate"].Value), picture = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnPicture"].Value.ToString(), price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnPrice"].Value.ToString().ToString().Split(' ')[0]) }; EditOrderForms.Edit_PC_OrderForm edit_PC_Order = new EditOrderForms.Edit_PC_OrderForm(PCurtain); edit_PC_Order.DialogResult = DialogResult.None; edit_PC_Order.load_info(); edit_PC_Order.ShowDialog(); if (edit_PC_Order.DialogResult == DialogResult.OK) { fillDataBase(); } } catch (Exception ex) { MessageBox.Show($"Помилка при редагуванні.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (e.ColumnIndex == 22) { DialogResult dialog = MessageBox.Show("Ви дійсно бажаєте видалити цей об'єкт?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.No) { return; } EditOrderForms.Edit_PC_OrderForm edit_PC_Order = new EditOrderForms.Edit_PC_OrderForm(); edit_PC_Order.removeCurtain( bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), this ); } }