Exemplo n.º 1
0
        private void JournalForm_Load(object sender, EventArgs e)
        {
            mainDGV.AutoGenerateColumns = false;
            SetMainDGV();
            CurState = State.Table;

            costumeDGV.AutoGenerateColumns = false;
            employeeTB.Text = Program.employee_name;
            DB.FillCB(clientCB, Properties.Resources.ClientQuery, "id_client", "name");
        }
Exemplo n.º 2
0
 private void SetGB(DataGridViewRow row = null)
 {
     if (row == null)
     {
         return;
     }
     nameTB.Text        = DB.GetRowCol(row, "name").ToString();
     priceTB.Text       = DB.GetRowCol(row, "price").ToString();
     daily_priceTB.Text = DB.GetRowCol(row, "daily_price").ToString();
     DB.FillCB(typeCB, "SELECT * FROM carnaval.costume_type;", "id_costume_type", "name");
     typeCB.SelectedIndex = Convert.ToInt32(DB.GetRowCol(row, "costume_type_id")) - 1;
 }
Exemplo n.º 3
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            if (nameTB.Text.Trim(' ') == "" || priceTB.Text.Trim(' ') == "" || typeCB.SelectedText.ToString() == null || daily_priceTB.Text.Trim(' ') == "")
            {
                MessageBox.Show("Заполните все обязательные поля!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                string priceCostume = priceTB.Text, daily_priceCostume = daily_priceTB.Text, typeCostume = typeCB.SelectedValue.ToString(), nameCostume = nameTB.Text.Replace("'", "\'");

                string query;
                if (state == "add")
                {
                    query = String.Format(@"INSERT INTO `carnaval`.`costume`
                                (`name`,
                                `costume_type_id`,
                                `price`,
                                `daily_price`)
                                VALUES
                               ('{0}',
                                 {1},
                                 {2},
                                 {3});", nameCostume, typeCostume, priceCostume, daily_priceCostume);
                }
                else
                {
                    query = String.Format(@"UPDATE `carnaval`.`costume`
                                            SET
                                            `name` = '{0}',
                                            `costume_type_id` = '{1}',
                                            `price` = '{2}',
                                            `daily_price` = '{3}'
                                            WHERE `id_costume` = '{4}';
                                            ", nameCostume, typeCostume, priceCostume, daily_priceCostume, DB.GetRowCol(mainDGV.SelectedRows[0], "id_costume").ToString());
                }
                int inserted_id = DB.SetNoResultQuery(query);
                hide();
                //  mainDGV.Rows.Add(fio, phone);
                //focusOnRowDGV();
                refreshData();
                if (callerForm != null && callerForm.GetType() == typeof(CostumeSizeForm))
                {
                    CostumeSizeForm CSForm = (CostumeSizeForm)callerForm;
                    DB.FillCB(CSForm.costumeCB, Properties.Resources.CostumeQuery, "id_costume", "name");
                    if (inserted_id != 0)
                    {
                        CSForm.costumeCB.SelectedValue = inserted_id;
                    }
                    Close();
                }
            }
        }
Exemplo n.º 4
0
 private void SetGB(DataGridViewRow row = null)
 {
     DB.FillCB(costumeCB, Properties.Resources.CostumeQuery, "id_costume", "name");
     DB.FillCB(sizeCB, Properties.Resources.SizeQuery, "id_size", "name_num");
     amountTB.Text = "1";
     if (row == null)
     {
         return;
     }
     curCS_id = (int)DB.GetRowCol(row, "id_costume_size");
     costumeCB.SelectedValue = DB.GetRowCol(row, "costume_id");
     sizeCB.SelectedValue    = DB.GetRowCol(row, "size_id");
     amountTB.Text           = DB.GetRowCol(row, "amount").ToString();
 }
Exemplo n.º 5
0
 void show(string str)
 {
     resetGB();
     mainDGV.Visible = false;
     DB.FillCB(typeCB, "SELECT * FROM `costume_type`", "id_costume_type", "name");
     mainGB.Visible       = true;
     OKButton.Enabled     = true;
     cancelButton.Enabled = true;
     searchTB.Enabled     = false;
     mainDGV.Enabled      = false;
     addButton.Enabled    = false;
     editButton.Enabled   = false;
     deleteButton.Enabled = false;
     if (str == "add")
     {
         mainGB.Text = "Добавление клиента";
     }
     else
     {
         mainGB.Text = "Редактирование клиента ";
     }
 }