Пример #1
0
    private void Pressed()
    {
        string path = window.GetFilePath();

        if (!path.Empty())
        {
            string fileContents = editor.Text;
            using (StreamWriter swriter = new StreamWriter(path, false))
            {
                swriter.Write(fileContents);
            }
            editor.Text = "";

            // Reapply text
            TextPreview textPreview = GetNode <TextPreview>("/root/Window/VB/MainHB/TextPreview");
            textPreview.SetTextFromFile(path);
            textPreview.Show();

            VSeparator seperator = GetNode <VSeparator>("/root/Window/VB/MainHB/VSeparator");
            seperator.Show();
        }
        else
        {
            AcceptDialog ad = GetNode <AcceptDialog>("/root/Window/Notifications/NoFile");
            ad.Show();
            GD.Print("Path is not set");
        }
        this.Hide();
        addButton.Show();
        editButton.Show();
    }
Пример #2
0
 private void Adddetails_MouseMove(object sender, MouseEventArgs e)
 {
     Size = new Size(459, 316);
     EditAddPanel.Show();
     Adddetails.Show();
     EditButton.Show();
 }
Пример #3
0
        private void checkDataChanged(int ID)
        {
            SqlConnection con = new SqlConnection("Data Source=luxefood.database.windows.net;Initial Catalog=LuxeFoods;User ID=Klees;Password=Johnny69;Connect Timeout=60;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
            DataSet       ds  = new DataSet();

            con.Open();
            SqlCommand     read  = new SqlCommand($"SELECT * from [restaurant] WHERE id='{ID}'", con);
            SqlDataAdapter adapt = new SqlDataAdapter(read);

            adapt.FillSchema(ds, SchemaType.Source, "Restauranten");
            adapt.Fill(ds, "Restauranten");
            con.Close();

            DataTable tblRestauranten = ds.Tables["Restauranten"];

            foreach (DataRow x in tblRestauranten.Rows)
            {
                if (textBox1.Text != "" && textBox1.Text != x["naam"].ToString())
                {
                    EditButton.Show();
                }
                else
                {
                    EditButton.Hide();
                }
            }
        }
Пример #4
0
 private void EditAddPanel_MouseHover(object sender, EventArgs e)
 {
     Size = new Size(459, 316);
     EditAddPanel.Show();
     Adddetails.Show();
     EditButton.Show();
 }
        private void checkDataChanged(int ID)
        {
            SqlConnection con = new SqlConnection("Data Source=luxefood.database.windows.net;Initial Catalog=LuxeFoods;User ID=Klees;Password=Johnny69;Connect Timeout=60;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
            DataSet       ds  = new DataSet();

            con.Open();
            SqlCommand     read  = new SqlCommand($"SELECT * from [reservering] WHERE Id='{ID}'", con);
            SqlDataAdapter adapt = new SqlDataAdapter(read);

            adapt.FillSchema(ds, SchemaType.Source, "Reservering");
            adapt.Fill(ds, "Reservering");
            con.Close();

            DataTable tblReservering = ds.Tables["Reservering"];

            int seatNr = 0;

            if (availableSeatsListBox.SelectedItem != null)
            {
                if (availableSeatsListBox.SelectedItem.ToString() != "Current Seat")
                {
                    string strSource = availableSeatsListBox.SelectedItem.ToString();
                    string strStart  = "Seat nr: ";
                    if (strSource.Contains(strStart))
                    {
                        int start, end;
                        start = strSource.IndexOf(strStart, 0) + strStart.Length;
                        end   = strSource.Length;
                        string reservationID = strSource.Substring(start, end - start);

                        string seatNrStr = string.Empty;

                        for (int i = 0; i < reservationID.Length; i++)
                        {
                            if (Char.IsDigit(reservationID[i]))
                            {
                                seatNrStr += reservationID[i];
                            }
                        }

                        seatNr = Int32.Parse(seatNrStr);
                    }
                }
            }


            foreach (DataRow x in tblReservering.Rows)
            {
                if (((int)x["restaurantId"] != (int)RestaurantPicker.SelectedValue) || ((DateTime)x["datum"] != dateTimePicker1.Value) || ((int)x["tafelNummer"] != seatNr && (DateTime)x["datum"] == dateTimePicker1.Value && seatNr != 0))
                {
                    EditButton.Show();
                }
                else
                {
                    EditButton.Hide();
                }
            }
        }
Пример #6
0
        // Lưu chỉnh sửa độc giả
        private void SaveEditButton_Click(object sender, EventArgs e)
        {
            DocGiaDTO DgDTO = new DocGiaDTO();

            if (radioButton5.Checked == true)
            {
                DgDTO.Madocgia   = textBox6.Text;
                DgDTO.Hoten      = textBox9.Text;
                DgDTO.Ngaysinh   = dateTimePicker4.Value;
                DgDTO.Diachi     = textBox8.Text;
                DgDTO.Email      = textBox7.Text;
                DgDTO.Loaidocgia = radioButton5.Text;
                DgDTO.Ngaylapthe = dateTimePicker5.Value;
                DgDTO.Cogiatri   = dateTimePicker3.Value;
            }
            else
            {
                DgDTO.Madocgia   = textBox6.Text;
                DgDTO.Hoten      = textBox9.Text;
                DgDTO.Ngaysinh   = dateTimePicker4.Value;
                DgDTO.Diachi     = textBox8.Text;
                DgDTO.Email      = textBox7.Text;
                DgDTO.Loaidocgia = radioButton6.Text;
                DgDTO.Ngaylapthe = dateTimePicker5.Value;
                DgDTO.Cogiatri   = dateTimePicker3.Value;
            }

            bool kq = DgBUS.Sua(DgDTO);

            if (kq == false)
            {
                MessageBox.Show("Sửa độc giả thất bại. Vui lòng kiểm tra lại dũ liệu");
            }
            else
            {
                MessageBox.Show("Sửa độc giả thành công");
                DgBUS.Getlistreader(dataGridView1);
            }


            SaveEditButton.Hide();
            CancelEdit.Hide();
            AddBt.Show();
            EditButton.Show();
            DeleteButton.Show();

            textBox6.Enabled        = false;
            textBox9.Enabled        = false;
            textBox8.Enabled        = false;
            textBox7.Enabled        = false;
            radioButton5.Enabled    = false;
            radioButton6.Enabled    = false;
            dateTimePicker4.Enabled = false;
            dateTimePicker5.Enabled = false;
            dateTimePicker6.Enabled = false;
        }
Пример #7
0
        private void PreviewCard_MouseHover(object sender, EventArgs e)
        {
            Adddetails.Show();
            EditButton.Show();
            Size = new Size(459, 316);
            EditAddPanel.Show();

            /* bunifuImageButton1.Show();
             * panel1.BackColor = Color.FromArgb(25, Color.Transparent);*/
        }
 // Button hủy sửa
 private void CancelEdit_Click(object sender, EventArgs e)
 {
     SaveAddBt.Hide();
     CancelAddBt.Hide();
     SaveEditButton.Hide();
     CancelEdit.Hide();
     AddBt.Show();
     EditButton.Show();
     DeleteButton.Show();
     textBox6.Enabled        = false;
     textBox9.Enabled        = false;
     textBox8.Enabled        = false;
     textBox7.Enabled        = false;
     radioButton5.Enabled    = false;
     radioButton6.Enabled    = false;
     dateTimePicker4.Enabled = false;
     dateTimePicker5.Enabled = false;
     dateTimePicker6.Enabled = false;
 }
Пример #9
0
        private void checkDataChanged(int ID)
        {
            SqlConnection con = new SqlConnection("Data Source=luxefood.database.windows.net;Initial Catalog=LuxeFoods;User ID=Klees;Password=Johnny69;Connect Timeout=60;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
            DataSet       ds  = new DataSet();

            con.Open();
            SqlCommand     read  = new SqlCommand($"SELECT * from [gerecht] WHERE id='{globalMenuId}'", con);
            SqlDataAdapter adapt = new SqlDataAdapter(read);

            adapt.FillSchema(ds, SchemaType.Source, "Gerechten");
            adapt.Fill(ds, "Gerechten");
            con.Close();

            DataTable tblGerechten = ds.Tables["Gerechten"];

            int prijsInt = 0;

            if (gerechtPrijsInput.Text != "")
            {
                string prijsStr = string.Empty;

                for (int i = 0; i < gerechtPrijsInput.Text.Length; i++)
                {
                    if (Char.IsDigit(gerechtPrijsInput.Text[i]))
                    {
                        prijsStr += gerechtPrijsInput.Text[i];
                    }
                }

                prijsInt = Int32.Parse(prijsStr);
            }
            foreach (DataRow x in tblGerechten.Rows)
            {
                if ((gerechtNaamInput.Text != "" && x["naam"].ToString() != gerechtNaamInput.Text) || (gerechtPrijsInput.Text != "" && (int)x["prijs"] != prijsInt) || x["melkalergieen"].ToString() != (string)gerechtMelkSelector.SelectedItem || x["notenalergieen"].ToString() != (string)gerechtNotenSelector.SelectedItem || x["categorie"].ToString() != (string)gerechtCategorieSelector.SelectedItem)
                {
                    EditButton.Show();
                }
                else
                {
                    EditButton.Hide();
                }
            }
        }
Пример #10
0
        private void InitFields(region region)
        {
            if (region == null)
            {
                AddDepartmentButton.Show();
                EditButton.Hide();
                return;
            }

            AddDepartmentButton.Hide();
            EditButton.Show();

            var context        = new PSOConnect();
            var department     = context.department.FirstOrDefault(departments => departments.idDepartment == region.idDepartment);
            var mainDepartment = context.mainDepartment.FirstOrDefault(mainDepartments => mainDepartments.idMainDepartment == department.idMainDepartment);

            RegionField.Text         = region.address;
            DepartmentField.Text     = department.address;
            MainDepartmentField.Text = mainDepartment.address;
        }
        // Lưu chỉnh sửa độc giả
        private void SaveEditButton_Click(object sender, EventArgs e)
        {
            DocGiaDTO DgDTO = new DocGiaDTO();

            if (radioButton5.Checked == true)
            {
                DgDTO.Madocgia   = textBox6.Text;
                DgDTO.Hoten      = textBox9.Text;
                DgDTO.Ngaysinh   = dateTimePicker4.Value;
                DgDTO.Diachi     = textBox8.Text;
                DgDTO.Email      = textBox7.Text;
                DgDTO.Loaidocgia = radioButton5.Text;
                DgDTO.Ngaylapthe = dateTimePicker5.Value;
                DgDTO.Cogiatri   = dateTimePicker3.Value;
            }
            else
            {
                DgDTO.Madocgia   = textBox6.Text;
                DgDTO.Hoten      = textBox9.Text;
                DgDTO.Ngaysinh   = dateTimePicker4.Value;
                DgDTO.Diachi     = textBox8.Text;
                DgDTO.Email      = textBox7.Text;
                DgDTO.Loaidocgia = radioButton6.Text;
                DgDTO.Ngaylapthe = dateTimePicker5.Value;
                DgDTO.Cogiatri   = dateTimePicker3.Value;
            }

            bool kq = DgBUS.Sua(DgDTO);

            if (kq == false)
            {
                MessageBox.Show("Sửa độc giả thất bại. Vui lòng kiểm tra lại dũ liệu");
                Con.Close();
            }
            else
            {
                MessageBox.Show("Sửa độc giả thành công");
                Con.Open();
                string         DocgiaDgv     = "select * from DocGia";
                SqlCommand     commandDocGia = new SqlCommand(DocgiaDgv, Con);
                SqlDataAdapter adapterDocGia = new SqlDataAdapter(commandDocGia);
                DataTable      table         = new DataTable();
                adapterDocGia.Fill(table);
                dataGridView1.DataSource = table;
                Con.Close();
            }


            SaveEditButton.Hide();
            CancelEdit.Hide();
            AddBt.Show();
            EditButton.Show();
            DeleteButton.Show();

            textBox6.Enabled        = false;
            textBox9.Enabled        = false;
            textBox8.Enabled        = false;
            textBox7.Enabled        = false;
            radioButton5.Enabled    = false;
            radioButton6.Enabled    = false;
            dateTimePicker4.Enabled = false;
            dateTimePicker5.Enabled = false;
            dateTimePicker6.Enabled = false;
        }
        // Button thêm Form chi tiết độc giả
        private void SaveAddBt_Click(object sender, EventArgs e)
        {
            try
            {
                Con.Open();
            }
            catch
            {
                if (textBox6.Text.Length == 0)
                {
                    errorProvider1.SetError(textBox6, "không được để trống");
                    textBox6.Focus();
                    Con.Close();
                }
                else if (textBox6.Text.Length > 0 && textBox9.Text.Length == 0)
                {
                    errorProvider1.SetError(textBox9, "không được để trống");
                    textBox9.Focus();
                    Con.Close();
                }
                else if (textBox6.Text.Length > 0 && textBox9.Text.Length > 0 && textBox8.Text.Length == 0)
                {
                    errorProvider1.SetError(textBox8, "không được để trống");
                    textBox8.Focus();
                    Con.Close();
                }
                else if (textBox6.Text.Length > 0 && textBox9.Text.Length > 0 && textBox8.Text.Length > 0 && textBox7.Text.Length == 0)
                {
                    errorProvider1.SetError(textBox7, "không được để trống");
                    textBox7.Focus();
                    Con.Close();
                }
                else if (radioButton5.Checked == false && radioButton6.Checked == false)
                {
                    MessageBox.Show("Bạn chưa chọn Loại độc giả !", "Lưu ý !!");
                    Con.Close();
                }
            }
            finally
            {
                DocGiaDTO DgDTO = new DocGiaDTO();
                if (radioButton5.Checked == true)
                {
                    DgDTO.Madocgia   = textBox6.Text;
                    DgDTO.Hoten      = textBox9.Text;
                    DgDTO.Ngaysinh   = dateTimePicker4.Value;
                    DgDTO.Diachi     = textBox8.Text;
                    DgDTO.Email      = textBox7.Text;
                    DgDTO.Loaidocgia = radioButton5.Text;
                    DgDTO.Ngaylapthe = dateTimePicker5.Value;
                    DgDTO.Cogiatri   = dateTimePicker3.Value;
                }
                else
                {
                    DgDTO.Madocgia   = textBox6.Text;
                    DgDTO.Hoten      = textBox9.Text;
                    DgDTO.Ngaysinh   = dateTimePicker4.Value;
                    DgDTO.Diachi     = textBox8.Text;
                    DgDTO.Email      = textBox7.Text;
                    DgDTO.Loaidocgia = radioButton6.Text;
                    DgDTO.Ngaylapthe = dateTimePicker5.Value;
                    DgDTO.Cogiatri   = dateTimePicker3.Value;
                }

                bool ketqua = DgBUS.Them(DgDTO);
                if (ketqua == false)
                {
                    MessageBox.Show("Thêm độc giả thất bại. Vui lòng kiểm tra lại dữ liệu");
                    Con.Close();
                }
                else
                {
                    MessageBox.Show("Thêm độc giả thành công");

                    string         DocgiaDgv     = "select * from DocGia";
                    SqlCommand     commandDocGia = new SqlCommand(DocgiaDgv, Con);
                    SqlDataAdapter adapterDocGia = new SqlDataAdapter(commandDocGia);
                    DataTable      table         = new DataTable();
                    adapterDocGia.Fill(table);

                    dataGridView1.DataSource = table;
                    Con.Close();
                }

                SaveAddBt.Hide();
                CancelAddBt.Hide();
                AddBt.Show();
                EditButton.Show();
                DeleteButton.Show();

                textBox6.Enabled        = false;
                textBox9.Enabled        = false;
                textBox8.Enabled        = false;
                textBox7.Enabled        = false;
                radioButton5.Enabled    = false;
                radioButton6.Enabled    = false;
                dateTimePicker4.Enabled = false;
                dateTimePicker5.Enabled = false;
                dateTimePicker6.Enabled = false;

                //DgBUS = new DocGiaBUS();
                //string query = "select * from DocGia";
                //dataGridView1.DataSource = DataProvider.Instance.ExcuteQuery(query, new object[] { });
            }
        }