internal void load_info() { if (processing) { return; } processing = true; if (curtain2 == null) { return; } labelSystemType.Text = curtain2.type; bunifuMetroTextboxSubtype.Text = curtain2.subtype; 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.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, 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 Fabric Where Type_id = {curtain2.type_id} and Subtype_id = {curtain2.subtype_id};", "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 Additional_equipment Where Type_id = {curtain2.type_id};", "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))); //Task t6 = Task.Run(() => load.Invoke((MethodInvoker)delegate { load.Hide(); })); Thread load_done = new Thread(new ThreadStart(loaded)); load_done.Start(); }
private void add_actions() { comboBoxFabric.SelectionChangeCommitted += (s, e) => { curtain2.fabric_id = comboBoxFabric.SelectedValue.ToString(); CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_data_once_label(labelCategory, labelFabricCategoryId, $"Select * From [DNC_category] fcc Where [fcc].[Category_id] IN (Select Category_id From [DNC_Fabric] ffc Where [ffc].[Fabric_id] = {curtain2.fabric_id}) and [fcc].[Type_id] = {curtain2.type_id} and [fcc].[Subtype_id] = {curtain2.subtype_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(); }; }
private async void load_installations() { CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, 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 boxCurtainType = ""; if (comboBoxCurtainType.InvokeRequired) { comboBoxCurtainType.Invoke((MethodInvoker) delegate { boxCurtainType = comboBoxCurtainType.SelectedValue.ToString(); }); } else { boxCurtainType = comboBoxCurtainType.SelectedValue.ToString(); } string boxCurtainSubType = ""; if (comboBoxCurtainSubtype.InvokeRequired) { comboBoxCurtainSubtype.Invoke((MethodInvoker) delegate { boxCurtainSubType = comboBoxCurtainSubtype.SelectedValue.ToString(); }); } else { boxCurtainSubType = comboBoxCurtainSubtype.SelectedValue.ToString(); } string boxCurtainFabric = ""; if (comboBoxFabric.InvokeRequired) { comboBoxFabric.Invoke((MethodInvoker) delegate { boxCurtainFabric = comboBoxFabric.SelectedValue.ToString(); }); } else { boxCurtainFabric = comboBoxFabric.SelectedValue.ToString(); } CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_FabricCategorydata(this, boxCurtainType, boxCurtainFabric, boxCurtainSubType)); await Task.WhenAll(t1); //update_status(sender, e); }
private async void loadSubtypesAndAdditional(object sender, EventArgs e) { comboBoxCurtainSubtype.DataSource = null; comboBoxCurtainSubtype.Invalidate(); comboBoxEquipment.DataSource = null; comboBoxEquipment.Invalidate(); comboBoxFabric.DataSource = null; comboBoxFabric.Invalidate(); labelFabricCategory.Text = "0$"; labelFabricCategoryId.Text = "0"; setToolTip((Control)sender, comboBoxCurtainType.SelectedItem.ToString().Split(new char[] { '[', ',', ']' }, StringSplitOptions.None)[1]); string boxCurtainType = ""; if (comboBoxCurtainType.InvokeRequired) { comboBoxCurtainType.Invoke((MethodInvoker) delegate { boxCurtainType = comboBoxCurtainType.SelectedValue.ToString(); }); } else { boxCurtainType = comboBoxCurtainType.SelectedValue.ToString(); } CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView>(); Task t1 = Task.Run(() => controler.load_subtypeAndAdditionall(this, boxCurtainType)); comboBoxCurtainSubtype.Enabled = true; comboBoxEquipment.Enabled = true; await Task.WhenAll(t1); //update_status(sender, e); //update_status(comboBoxEquipment, e); }
private void iconButtonNewOrder_Click(object sender, EventArgs e) { #region [Check information before create order] if (!File.Exists(Classes.PathCombiner.join_combine("\\draw_images\\fc\\draw.png"))) { MessageBox.Show("Не вдалось знайти креслення, спробуйте ще раз.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxCurtainType.DataSource == null || comboBoxCurtainType.Items.Count == 0 || comboBoxCurtainType.SelectedValue == null) { MessageBox.Show("Поле \"Тип системи\" не заповнено!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (comboBoxCurtainSubtype.DataSource == null || comboBoxCurtainSubtype.Items.Count == 0 || comboBoxCurtainSubtype.SelectedValue == null) { 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; } 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.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView>(); controler.packing(new Classes.FabricCurtain(), new List <Classes.FabricCurtain2>(), this); MessageBox.Show("Замовлення успішно створено.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
async internal void fillDataBase() { if (bunifuCustomDataGrid1.Rows.Count != 0) { bunifuCustomDataGrid1.Invoke((MethodInvoker) delegate { bunifuCustomDataGrid1.Rows.Clear(); }); } CurtainDesigner.Controllers.IControlerManage <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView> controler = new CurtainDesigner.Controllers.Classes.FabricCurtainControlerManager <Classes.FabricCurtain, List <Classes.FabricCurtain2>, FormFabricCurtainOrder, DataGridView>(); await Task.Run(() => controler.unpacking(Classes.FC_Caontainer.curtains, this.bunifuCustomDataGrid1)); }