Beispiel #1
0
        private STPlace read_data()
        {
            STPlace ret = new STPlace();

            CCity city;

            try
            {
                if (gstPlace.id != 0)
                {
                    ret.id = gstPlace.id;
                }
                else
                {
                    ret.id = clPlace.GetFreeId();
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text.Trim();
                }
                else
                {
                    ret.name = null;
                }

                string str = comboBoxCity.Text.Trim();
                if (str.Length > 0)
                {
                    city       = new CCity(connect, str);
                    ret.idcity = city.stCity.id;
                }
                else
                {
                    ret.idcity = 0;
                }

                if (textBoxAddress.Text.Length > 0)
                {
                    ret.address = textBoxAddress.Text.Trim();
                }
                else
                {
                    ret.address = null;
                }

                if (checkBoxVisible.Checked == true)
                {
                    ret.vf = 1;
                }
                else
                {
                    ret.vf = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Beispiel #2
0
        private void del()
        {
            STPlace data = GetSelectionData();

            if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                clPlace.Delete(data);
                init_list();
            }
        }
Beispiel #3
0
        public DlgPlace(SqlConnection cn, STPlace st, ushort md)
        {
            InitializeComponent();

            connect  = cn;
            mode     = md;
            gstPlace = st;

            caption = "Редактировать площадку";

            init_combo();

            set_data();
        }
Beispiel #4
0
        private STPlace GetSelectionData()
        {
            STPlace ret = new STPlace();

            string n;

            foreach (DataGridViewRow item in dataGridViewPlace.SelectedRows)
            {
                n = item.Cells[1].Value.ToString();

                CPlace sp = new CPlace(connect, n);

                ret = sp.stPlace;
            }

            return(ret);
        }
Beispiel #5
0
        private bool save()
        {
            bool ret = false;

            stC = new STPlace();

            stC = read_data();

            if (gstPlace.id != 0)
            {
                ret = clPlace.Update(stC);
            }
            else
            {
                ret = clPlace.Insert(stC);
            }

            return(ret);
        }
Beispiel #6
0
        private void add()
        {
            DlgPlace wnd = new DlgPlace(connect, mode);

            DialogResult result = wnd.ShowDialog();

            if (result == DialogResult.OK)
            {
                flawour = wnd.GetFl();

                init_list();

                if (gpos >= 0 && dataGridViewPlace.Rows.Count > 0)
                {
                    dataGridViewPlace.Rows[gpos].Selected             = true;
                    dataGridViewPlace.FirstDisplayedScrollingRowIndex = gpos;
                }
            }
        }