Ejemplo n.º 1
0
        public Edit_HC_OrderForm(Classes.HC2 obj)
        {
            InitializeComponent();

            img_processing = false;
            processing     = true;
            this.tip       = new ToolTip();
            curtain2       = obj;
            show_load();
            add_actions();
            setTooltipsyardage();
            processing = false;
        }
Ejemplo n.º 2
0
        private void bunifuCustomDataGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 23)
            {
                Classes.HC2 fabricCurtain = null;
                List <KeyValuePair <string, object> > keyValuePairs = new List <KeyValuePair <string, object> >();

                try
                {
                    fabricCurtain = new Classes.HC2()
                    {
                        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(),
                        type_price         = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnTypePrice"].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: "{type}", value: fabricCurtain.type));
                    keyValuePairs.Add(new KeyValuePair <string, object>(key: "{type_price}", value: fabricCurtain.type_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.HC_PATTERN);
                formSelect.ShowDialog();
            }
            else if (e.ColumnIndex == 24)
            {
                Classes.HC2 fabricCurtain = null;
                try
                {
                    fabricCurtain = new Classes.HC2()
                    {
                        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(),
                        type_price         = bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["ColumnTypePrice"].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_HC_OrderForm edit_HC_Order = new EditOrderForms.Edit_HC_OrderForm(fabricCurtain);

                    edit_HC_Order.DialogResult = DialogResult.None;
                    edit_HC_Order.load_info();
                    edit_HC_Order.ShowDialog();

                    if (edit_HC_Order.DialogResult == DialogResult.OK)
                    {
                        fillDataBase();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Помилка при редагуванні.\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (e.ColumnIndex == 25)
            {
                DialogResult dialog = MessageBox.Show("Ви дійсно бажаєте видалити цей об'єкт?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialog == DialogResult.No)
                {
                    return;
                }

                EditOrderForms.Edit_HC_OrderForm edit_HC_Order = new EditOrderForms.Edit_HC_OrderForm();
                edit_HC_Order.removeCurtain(
                    bunifuCustomDataGrid1.Rows[e.RowIndex].Cells["Number"].Value.ToString(),
                    this
                    );
            }
        }