public Edit_RC_OrderForm(Classes.RC2 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 == 25) { Classes.RC2 fabricCurtain = null; List <KeyValuePair <string, object> > keyValuePairs = new List <KeyValuePair <string, object> >(); try { fabricCurtain = new Classes.RC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].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: fabricCurtain.fb_id)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{fabric_name}", value: fabricCurtain.fabric_name)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{fabric_category_price}", value: fabricCurtain.fabric_category_price)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{system_color_name}", value: fabricCurtain.system_color_name)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{width}", value: fabricCurtain.width)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{height}", value: fabricCurtain.height)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{yardage}", value: fabricCurtain.yardage)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{count}", value: fabricCurtain.count)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{side_name}", value: fabricCurtain.side_name)); get_equipment(keyValuePairs, fabricCurtain.equipment_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{equipment_price}", value: fabricCurtain.equipment_price)); get_installation(keyValuePairs, fabricCurtain.installation_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{installation_price}", value: fabricCurtain.installation_price)); get_customer(keyValuePairs, fabricCurtain.customer_id); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{start_order_time}", value: fabricCurtain.start_order_time)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{end_order_time}", value: fabricCurtain.end_order_time)); load_img(keyValuePairs, fabricCurtain.picture, fabricCurtain.width, fabricCurtain.height, fabricCurtain.yardage, fabricCurtain.side_name); //keyValuePairs.Add(new KeyValuePair<string, object>(key: "{picture}", value: fabricCurtain.picture)); keyValuePairs.Add(new KeyValuePair <string, object>(key: "{price}", value: fabricCurtain.price)); } catch (Exception ex) { MessageBox.Show($"Помилка при відображенні форми друкування.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } printOrder.FormSelectPrint formSelect = new printOrder.FormSelectPrint(keyValuePairs, Classes.ClassPatternPath.RC_PATTERN); formSelect.ShowDialog(); } else if (e.ColumnIndex == 26) { Classes.RC2 fabricCurtain = null; try { fabricCurtain = new Classes.RC2() { fb_id = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].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_RC_OrderForm edit_RC_Order = new EditOrderForms.Edit_RC_OrderForm(fabricCurtain); edit_RC_Order.DialogResult = DialogResult.None; edit_RC_Order.load_info(); edit_RC_Order.ShowDialog(); if (edit_RC_Order.DialogResult == DialogResult.OK) { fillDataBase(); } } catch (Exception ex) { MessageBox.Show($"Помилка при редагуванні.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (e.ColumnIndex == 27) { DialogResult dialog = MessageBox.Show("Ви дійсно бажаєте видалити цей об'єкт?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.No) { return; } EditOrderForms.Edit_RC_OrderForm edit_RC_Order = new EditOrderForms.Edit_RC_OrderForm(); edit_RC_Order.removeCurtain( bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(), this ); } }