private void refreshLstVendeg()
        {
            lstVendeg.DataSource = null;
            DataTable dt   = DBFeladatok.VendegDataTable();
            var       dict = new Dictionary <int, string>();

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    if (row["nev"].ToString().Trim() != "" &&
                        !Regex.IsMatch(Regex.Escape(row["nev"].ToString()), txtVendegLstVendegQuickFind.Text.Trim(),
                                       RegexOptions.IgnoreCase))
                    {
                        continue;
                    }
                }
                catch (Exception)
                {
                }
                dict.Add((int)row["id"],
                         row["Adatok"] + " (" + ")");
            }
            if (dict.Count > 0)
            {
                lstVendeg.DataSource    = new BindingSource(dict, null);
                lstVendeg.DisplayMember = "Value";
                lstVendeg.ValueMember   = "Key";
            }
        }
示例#2
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBox.Show("Biztos kilép?", "Biztos benne?", MessageBoxButtons.OKCancel) != DialogResult.OK)
     {
         e.Cancel = true;
     }
     else
     {
         DBFeladatok.DisconnectSQL();
     }
 }
 public FrmVendegManagmentUjVendeg(int vendegId)
 {
     initCtor();
     //dtpVendegSzuletesiDatum.Enabled = false;
     //cboVendegNem.Enabled = false;
     _tarolt                            = DBFeladatok.SelectVendeg(vendegId);
     txtVendegNev.Text                  = _tarolt.Nev;
     txtVendegOkmanyAzonosito.Text      = _tarolt.OkmanyAzonosito;
     cboVendegNem.SelectedIndex         = (int)_tarolt.VendegNem;
     cboVendegOkmanyTipus.SelectedIndex = (int)_tarolt.VendegOkmanyTipus;
     dtpVendegSzuletesiDatum.Value      = _tarolt.SzuletesiDatum;
 }
        public FrmFoglalasManagmentUjFoglalas()
        {
            InitializeComponent();
            int maxFelnott = DBFeladatok.MaxSzemelyekSzobakban(VendegTipus.Felnőtt);
            int maxGyermek = DBFeladatok.MaxSzemelyekSzobakban(VendegTipus.Gyermek);

            this.maxEnnyiSzemely         = maxFelnott + maxGyermek;
            nudFoglalasFelnottek.Maximum = maxFelnott;
            nudFoglalasGyermekek.Maximum = maxGyermek + maxFelnott;
            PanelSwitch(gpbSzoba, false);
            PanelSwitch(gpbVendeg, false);
            btnFoglalasVeglegesitese.Enabled = false;
        }
        public FrmSzobaManagmentUjSzoba(int szobaId)
        {
            initCtor();

            _tarolt = DBFeladatok.SelectSzoba(szobaId);

            txtSzobaNev.Text = _tarolt.Nev;

            // public Szoba(string nev, SzobaEmelet emelet, int felnottHely, int gyermekHely, bool kiadhato, string megjegyzes)

            cboSzobaEmelet.SelectedIndex   = (int)_tarolt.Emelet;
            nudSzobaFelnotthely.Value      = _tarolt.Felnott_hely;
            nudSzobaGyermekHely.Value      = _tarolt.Gyermek_hely;
            cboSzobaKiadhato.SelectedIndex = _tarolt.Kiadhato == true ? 1 : 0;
            txtSzobaMegjegyzes.Text        = _tarolt.Megjegyzes;
        }
示例#6
0
        public FrmMain()
        {
            InitializeComponent();

            try
            {
                DBFeladatok.ConnectSQL();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Nem sikerült csatlakozni az adatbázishoz." + Environment.NewLine + ex.Message);
            }

            FrmFoglalasManagmentUjFoglalas frmFoglalasManagmentUjFoglalas = new FrmFoglalasManagmentUjFoglalas();

            frmFoglalasManagmentUjFoglalas.ShowDialog();
        }
示例#7
0
        private void btnUjSzoba_Click(object sender, EventArgs e)
        {
            FrmSzobaManagmentUjSzoba frmSzobaManagmentUjSzoba = new FrmSzobaManagmentUjSzoba();

            if (frmSzobaManagmentUjSzoba.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DBFeladatok.SaveSzoba(frmSzobaManagmentUjSzoba.Tarolt);
                    refreshLstSzoba();
                }
                catch (Exception ex)
                {
                    EasyLog.LogMessageToFile(ex.Message);
                    throw ex;
                }
            }
        }
        private void btnUjVendeg_Click(object sender, EventArgs e)
        {
            FrmVendegManagmentUjVendeg vendegManagmentUjVendeg = new FrmVendegManagmentUjVendeg();

            if (vendegManagmentUjVendeg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DBFeladatok.SaveVendeg(vendegManagmentUjVendeg.Tarolt);
                    lstVendeg.DataSource = DBFeladatok.VendegDataTable();
                }
                catch (Exception ex)
                {
                    EasyLog.LogMessageToFile(ex.Message);
                    throw ex;
                }

                refreshLstVendeg();
            }
        }
示例#9
0
        private void btnModSzoba_Click(object sender, EventArgs e)
        {
            if (lstSzoba.SelectedValue != null)
            {
                var frmSzobaManagmentUjSzoba = new FrmSzobaManagmentUjSzoba((int)lstSzoba.SelectedValue);

                if (frmSzobaManagmentUjSzoba.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        DBFeladatok.UpdateSzoba((int)lstSzoba.SelectedValue, frmSzobaManagmentUjSzoba.Tarolt);
                        refreshLstSzoba();
                    }
                    catch (Exception ex)
                    {
                        EasyLog.LogMessageToFile(ex.Message);
                        throw ex;
                    }
                }
            }
        }
示例#10
0
 private void btnTorSzoba_Click(object sender, EventArgs e)
 {
     if (lstSzoba.SelectedValue != null)
     {
         if (
             MessageBox.Show("Biztos benne?", "Figyelmeztetés", MessageBoxButtons.OKCancel,
                             MessageBoxIcon.Asterisk) == DialogResult.OK)
         {
             try
             {
                 DBFeladatok.DeleteSzoba((int)lstSzoba.SelectedValue);
                 refreshLstSzoba();
             }
             catch (Exception ex)
             {
                 EasyLog.LogMessageToFile(ex.Message);
                 throw ex;
             }
         }
     }
 }
        private void btnSzobaKereses_Click(object sender, EventArgs e)
        {
            EllenorzesFelnottek();
            dtpElsoNapEllenorzesDatumTol();
            dtpElsoNapEllenorzesDatumIg();


            var error = "";


            if (false == EllenorzesBefernekEASzobabaAVendegek())
            {
                DBFeladatok.AddError(ref error, "A legnagyobb szobába maximum " + this.maxEnnyiSzemely.ToString() + " személy fér csak el.");
            }
            if (false == EllenorzesDatumok_Tol())
            {
                DBFeladatok.AddError(ref error, "Szobát csak a mai naptól lehet foglalni.");
            }
            else if (false == EllenorzesDatumok_Ig())
            {
                DBFeladatok.AddError(ref error, "Hibás foglalási dátum, az utolsó nap az elsö elött van.");
            }
            if (error != "")
            {
                MessageBox.Show(error, "Figyelmeztetés...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.None;
            }
            else
            {
                List <Szoba> szabad_szobak = DBFeladatok.SzabadSzobaKeresese((int)nudFoglalasFelnottek.Value, (int)nudFoglalasGyermekek.Value,
                                                                             dtpElsoNap.Value, dtpUtolsoNap.Value);
                if (szabad_szobak.Count > 0)
                {
                    PanelSwitch(gpbSzoba, true);
                    txtSzobaLstSzobaQuickFind.Text = "";
                    szobak_filter_datasource       = szabad_szobak;
                    lstSzoba.DataSource            = szobak_filter_datasource;
                }
            }
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            var error = "";

            if (txtVendegNev.Text.Trim() == "")
            {
                DBFeladatok.AddError(ref error, "Nem adott meg nevet!");
            }
            if (txtVendegOkmanyAzonosito.Text.Trim() == "")
            {
                DBFeladatok.AddError(ref error, "Nem adott meg okmányszámot!");
            }

            if (error != "")
            {
                MessageBox.Show(error, "Figyelmeztetés...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.None;
            }
            else
            {
                if (Tarolt == null)
                {
                    _tarolt = new Vendeg(txtVendegNev.Text.Trim(), (VendegNem)cboVendegNem.SelectedItem,
                                         (VendegOkmanyTipus)cboVendegOkmanyTipus.SelectedItem, txtVendegOkmanyAzonosito.Text.Trim(),
                                         dtpVendegSzuletesiDatum.Value);

                    EasyLog.LogMessageToFile("New vendeg =" + _tarolt);
                }
                else
                {
                    _tarolt.Nev               = txtVendegNev.Text.Trim();
                    _tarolt.VendegNem         = (VendegNem)cboVendegNem.SelectedItem;
                    _tarolt.VendegOkmanyTipus = (VendegOkmanyTipus)cboVendegOkmanyTipus.SelectedItem;
                    _tarolt.OkmanyAzonosito   = txtVendegOkmanyAzonosito.Text.Trim();
                    _tarolt.SzuletesiDatum    = dtpVendegSzuletesiDatum.Value;
                    EasyLog.LogMessageToFile("Mod vendeg = " + _tarolt);
                }
            }
        }
        private void btnModVendeg_Click(object sender, EventArgs e)
        {
            if (lstVendeg.SelectedValue != null)
            {
                var vendegManagmentUjVendeg = new FrmVendegManagmentUjVendeg((int)lstVendeg.SelectedValue);

                if (vendegManagmentUjVendeg.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        DBFeladatok.UpdateVendeg((int)lstVendeg.SelectedValue, vendegManagmentUjVendeg.Tarolt);
                        lstVendeg.DataSource = DBFeladatok.VendegDataTable();
                    }
                    catch (Exception ex)
                    {
                        EasyLog.LogMessageToFile(ex.Message);
                        throw ex;
                    }

                    refreshLstVendeg();
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            var error = "";

            if (txtSzobaNev.Text.Trim() == "")
            {
                DBFeladatok.AddError(ref error, "Nem adott meg nevet!");
            }

            if (error != "")
            {
                MessageBox.Show(error, "Figyelmeztetés...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.None;
            }
            else
            {
                if (Tarolt == null)
                {
                    _tarolt = new Szoba(
                        txtSzobaNev.Text.Trim(), (SzobaEmelet)cboSzobaEmelet.SelectedIndex,
                        (int)nudSzobaFelnotthely.Value, (int)nudSzobaGyermekHely.Value, cboSzobaKiadhato.SelectedIndex == 1,
                        txtSzobaMegjegyzes.Text.Trim()
                        );
                    EasyLog.LogMessageToFile("New szoba =" + _tarolt);
                }
                else
                {
                    _tarolt.Nev          = txtSzobaNev.Text.Trim();
                    _tarolt.Emelet       = (SzobaEmelet)cboSzobaEmelet.SelectedIndex;
                    _tarolt.Felnott_hely = (int)nudSzobaFelnotthely.Value;
                    _tarolt.Gyermek_hely = (int)nudSzobaGyermekHely.Value;
                    _tarolt.Kiadhato     = cboSzobaKiadhato.SelectedIndex == 1;
                    _tarolt.Megjegyzes   = txtSzobaMegjegyzes.Text.Trim();
                    EasyLog.LogMessageToFile("Mod szoba = " + _tarolt);
                }
            }
        }