public Edit_DNC_OrderForm(Classes.DNC2 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 == 29) { Classes.DNC2 DNCurtain = null; List <KeyValuePair <string, object> > keyValuePairs = new List <KeyValuePair <string, object> >(); try { DNCurtain = new Classes.DNC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), type = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnType"].Value.ToString(), type_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnType_id"].Value.ToString(), subtype = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSubtype"].Value.ToString(), subtype_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSubtype_id"].Value.ToString(), fabric_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnFabric"].Value.ToString(), fabric_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnFabric_id"].Value.ToString(), fabric_category_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory"].Value.ToString().Split(' ')[0]), fabric_category_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_id"].Value.ToString(), fabric_category_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_name"].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()), side_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSides"].Value.ToString(), side_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSide_id"].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: DNCurtain.fb_id)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{type}", value: DNCurtain.type)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{subtype}", value: DNCurtain.subtype)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{fabric_name}", value: DNCurtain.fabric_name)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{fabric_category_price}", value: DNCurtain.fabric_category_price)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{system_color_name}", value: DNCurtain.system_color_name)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{width}", value: DNCurtain.width)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{height}", value: DNCurtain.height)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{yardage}", value: DNCurtain.yardage)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{count}", value: DNCurtain.count)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{side_name}", value: DNCurtain.side_name)); get_equipment(keyValuePairs, DNCurtain.equipment_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{equipment_price}", value: DNCurtain.equipment_price)); get_installation(keyValuePairs, DNCurtain.installation_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{installation_price}", value: DNCurtain.installation_price)); get_customer(keyValuePairs, DNCurtain.customer_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{start_order_time}", value: DNCurtain.start_order_time)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{end_order_time}", value: DNCurtain.end_order_time)); load_img(keyValuePairs, DNCurtain.picture, DNCurtain.width, DNCurtain.height, DNCurtain.yardage, DNCurtain.side_name); //keyValuePairs.Add(new KeyValuePair<string, object>(key: "{picture}", value: fabricCurtain.picture)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{price}", value: DNCurtain.price)); } catch (Exception ex) { MessageBox.Show($"Помилка при відображенні форми друкування.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } printOrder.FormSelectPrint formSelect = new printOrder.FormSelectPrint(keyValuePairs, Classes.ClassPatternPath.DNC_PATTERN); formSelect.ShowDialog(); } else if (e.ColumnIndex == 30) { Classes.DNC2 DNCurtain = null; try { DNCurtain = new Classes.DNC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), type = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnType"].Value.ToString(), type_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnType_id"].Value.ToString(), subtype = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSubtype"].Value.ToString(), subtype_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSubtype_id"].Value.ToString(), fabric_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnFabric"].Value.ToString(), fabric_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnFabric_id"].Value.ToString(), fabric_category_price = (float)Convert.ToDouble(bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory"].Value.ToString().Split(' ')[0]), fabric_category_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_id"].Value.ToString(), fabric_category_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnCategory_name"].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()), side_name = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSides"].Value.ToString(), side_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnSide_id"].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_DNC_OrderForm edit_DNC_Order = new EditOrderForms.Edit_DNC_OrderForm(DNCurtain); edit_DNC_Order.DialogResult = DialogResult.None; edit_DNC_Order.load_info(); edit_DNC_Order.ShowDialog(); if (edit_DNC_Order.DialogResult == DialogResult.OK) { fillDataBase(); } } catch (Exception ex) { MessageBox.Show($"Помилка при редагуванні.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (e.ColumnIndex == 31) { DialogResult dialog = MessageBox.Show("Ви дійсно бажаєте видалити цей об'єкт?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.No) { return; } EditOrderForms.Edit_DNC_OrderForm edit_DNC_Order = new EditOrderForms.Edit_DNC_OrderForm(); edit_DNC_Order.removeCurtain( bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), this ); } }