private async void load_installations() { CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); await Task.Run(() => controler.load_installations(this)); }
private async void loadFabricCategoryFromBD(object sender, EventArgs e) { setToolTip((Control)sender, comboBoxFabric.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); string boxCurtainFabric = ""; if (comboBoxFabric.InvokeRequired) { comboBoxFabric.Invoke((MethodInvoker) delegate { boxCurtainFabric = comboBoxFabric.SelectedValue.ToString(); }); } else { boxCurtainFabric = comboBoxFabric.SelectedValue.ToString(); } CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_FabricCategorydata(this, boxCurtainFabric)); await Task.WhenAll(t1); }
private void iconButtonNewOrder_Click(object sender, EventArgs e) { #region [Check information before create order] if (!File.Exists(Classes.PathCombiner.join_combine("\\draw_images\\rc\\draw.png"))) { MessageBox.Show("Не вдалось знайти креслення, спробуйте ще раз.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxSide.DataSource == null || comboBoxSide.Items.Count == 0 || comboBoxSide.SelectedValue == null) { MessageBox.Show("Поле \"Керування\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxFabric.DataSource == null || comboBoxFabric.Items.Count == 0 || comboBoxFabric.SelectedValue == null) { MessageBox.Show("Поле \"Тканина\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } double maxWidth = getFabricMaxWidth(comboBoxFabric.SelectedValue.ToString()); if ((double)numericUpDownWidth.Value > maxWidth) { MessageBox.Show("Поле \"Ширина\" перевищує максимальне значення для обраної тканини.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(labelFabricCategory.Text) || labelFabricCategory.Text == "0$" || string.IsNullOrEmpty(labelFabricCategoryId.Text)) { MessageBox.Show("Поле \"Цінова категорія тканини\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxSystemColor.DataSource == null || comboBoxSystemColor.Items.Count == 0 || comboBoxSystemColor.SelectedValue == null) { MessageBox.Show("Поле \"Колір системи\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxEquipment.DataSource == null || comboBoxEquipment.Items.Count == 0 || comboBoxEquipment.SelectedValue == null) { MessageBox.Show("Поле \"Додаткова комплектація\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(labelYardage.Text) || labelYardage.Text == "0") { MessageBox.Show("Поле \"Квадратура(площа)\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxInstallation.DataSource == null || comboBoxInstallation.Items.Count == 0 || comboBoxInstallation.SelectedValue == null) { MessageBox.Show("Поле \"Ціна встановлення\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (numericUpDownCount.Value == 0) { MessageBox.Show("Поле \"Кількість\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(labelCustomer.Text) || string.IsNullOrWhiteSpace(labelCustomer.Text)) { MessageBox.Show("Поле \"Замовник\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(labelPrice.Text) || labelPrice.Text == "[ 0 $ ]") { MessageBox.Show("Поле \"Ціна\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion create_img_id(); CurtainDesigner.Controllers.IControlerManage <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); controler.packing(new Classes.RC(), new List <Classes.RC2>(), this); MessageBox.Show("Замовлення успішно створено.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void add_actions() { comboBoxFabric.SelectionChangeCommitted += (s, e) => { curtain2.fabric_id = comboBoxFabric.SelectedValue.ToString(); CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_data_once_label(labelCategory, labelFabricCategoryId, $"Select * From [RC_category] fcc Where [fcc].[Category_id] IN (Select Category_id From [RC_Fabric] ffc Where [ffc].[Fabric_id] = {curtain2.fabric_id});", "Category_id", "Price")); }; numericUpDownWidth.ValueChanged += (s, e) => { setTooltipsyardage(); update_draw(numericUpDownWidth.Value.ToString() + "м.", numericUpDownHeight.Value.ToString() + "м.", labelYardage.Text + "м."); labelYardage.Text = string.Join(",", Convert.ToString((float)Math.Round(Convert.ToDouble(numericUpDownWidth.Value * numericUpDownHeight.Value), 2, MidpointRounding.AwayFromZero)).Split(',')); }; numericUpDownHeight.ValueChanged += (s, e) => { update_draw(numericUpDownWidth.Value.ToString() + "м.", numericUpDownHeight.Value.ToString() + "м.", labelYardage.Text + "м."); labelYardage.Text = string.Join(",", Convert.ToString((float)Math.Round(Convert.ToDouble(numericUpDownWidth.Value * numericUpDownHeight.Value), 2, MidpointRounding.AwayFromZero)).Split(',')); setTooltipsyardage(); }; comboBoxSide.SelectionChangeCommitted += (s, e) => { setToolTip((Control)s, comboBoxSide.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); update_draw(numericUpDownWidth.Value.ToString() + "м.", numericUpDownHeight.Value.ToString() + "м.", labelYardage.Text + "м."); }; comboBoxSystemColor.SelectionChangeCommitted += (s, e) => { setToolTip((Control)s, comboBoxSystemColor.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); }; comboBoxEquipment.SelectionChangeCommitted += (s, e) => { setToolTip((Control)s, comboBoxEquipment.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); }; comboBoxFabric.SelectionChangeCommitted += (s, e) => { setToolTip((Control)s, comboBoxFabric.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); }; labelCategory.TextChanged += (s, e) => { updatePrice(); }; comboBoxEquipment.SelectedValueChanged += (s, e) => { updatePrice(); }; labelYardage.TextChanged += (s, e) => { updatePrice(); }; comboBoxInstallation.SelectedValueChanged += (s, e) => { updatePrice(); }; numericUpDownCount.ValueChanged += (s, e) => { updatePrice(); }; pictureBoxImg.MouseClick += (s, e) => { if (img_processing) { MessageBox.Show("Зачекайте, будь ласка, програма створює креслення.", "Please, wait..", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FormOpenDraw openDraw = new FormOpenDraw((Bitmap)pictureBoxImg.Image); openDraw.ShowDialog(); }; }
internal void load_info() { if (processing) { return; } processing = true; if (curtain2 == null) { return; } labelFabricCategoryId.Text = curtain2.fabric_category_id; labelCategory.Text = curtain2.fabric_category_price.ToString(); numericUpDownWidth.Value = (decimal)curtain2.width; numericUpDownHeight.Value = (decimal)curtain2.height; numericUpDownCount.Value = curtain2.count; labelYardage.Text = curtain2.yardage.ToString(); labelCustomer_id.Text = curtain2.customer_id; labelCustomer_id.Text = curtain2.customer_id; dateTimePickerDateStart.Value = curtain2.start_order_time; dateTimePickerDateEnd.Value = curtain2.end_order_time; if (File.Exists(Classes.PathCombiner.join_combine(curtain2.picture))) { using (FileStream stream = new FileStream(Classes.PathCombiner.join_combine(curtain2.picture), FileMode.Open)) { img = new Bitmap(stream); } pictureBoxImg.Image = img; label_img_id.Text = curtain2.picture; } numericUpDownPrice.Value = (decimal)curtain2.price; CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_data_once_comboboxes(comboBoxSide, "Select * From Control;", "Control_side", "Control_id", Convert.ToInt32(curtain2.side_id))); Task t2 = Task.Run(() => controler.load_data_once_comboboxes(comboBoxFabric, $"Select * From RC_Fabric;", "Name", "Fabric_id", Convert.ToInt32(curtain2.fabric_id))); Task t3 = Task.Run(() => controler.load_data_once_comboboxes(comboBoxSystemColor, "Select * From System_color;", "Name", "Color_id", Convert.ToInt32(curtain2.system_color_id))); Task t4 = Task.Run(() => controler.load_data_once_comboboxes(comboBoxEquipment, $"Select * From RC_Additional_equipment;", "Equipment", "Equipment_id", Convert.ToInt32(curtain2.equipment_id))); Task t5 = Task.Run(() => controler.load_data_once_comboboxes(comboBoxInstallation, "Select * From Installation;", "Price", "Installation_id", Convert.ToInt32(curtain2.installation_id))); Thread load_done = new Thread(new ThreadStart(loaded)); load_done.Start(); }
async internal void fillDataBase() { if (bunifuCustomDataGrid1.Rows.Count != 0) { bunifuCustomDataGrid1.Invoke((MethodInvoker) delegate { bunifuCustomDataGrid1.Rows.Clear(); }); } CurtainDesigner.Controllers.IControlerManage <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.RCControlerManager <Classes.RC, List <Classes.RC2>, OrderForms.FormRCOrder, DataGridView>(); await Task.Run(() => controler.unpacking(Classes.RC_Container.curtains, this.bunifuCustomDataGrid1)); }