Exemplo n.º 1
0
 private void LoadData()
 {
     try
     {
         var list = logic.Read(null);
         if (list != null)
         {
             dataGridViewCategories.DataSource = list;
             dataGridViewCategories.AutoResizeColumns();
             dataGridViewCategories.Columns[0].Visible      = false;
             dataGridViewCategories.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void LoadData()
        {
            var list = logic.Read(null);

            if (list != null)
            {
                dataGridView.DataSource              = list;
                dataGridView.Columns[0].Visible      = false;
                dataGridView.Columns[5].Visible      = false;
                dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            }
        }
Exemplo n.º 3
0
        private void FormRoom_Load(object sender, EventArgs e)
        {
            if (Id.HasValue)
            {
                textBoxNumber.Text = Number;
            }
            var list = logicC.Read(null);

            if (list != null)
            {
                dataGridView.DataSource         = list;
                dataGridView.Columns[0].Visible = false;
                dataGridView.Columns[5].Visible = false;
            }
        }
 private void FormCategory_Load(object sender, EventArgs e)
 {
     if (Id.HasValue)
     {
         var model = logic.Read(new CategoryBindingModel {
             Id = Id
         })?[0];
         if (model == null)
         {
             return;
         }
         textBoxPrice.Text          = model.Price.ToString();
         textBoxRoomNumber.Text     = model.Roomnumber.ToString();
         textBoxSleepingBerths.Text = model.Sleepingberths.ToString();
         textBoxType.Text           = model.Type;
     }
 }
Exemplo n.º 5
0
 private void FormCategory_Load(object sender, EventArgs e)
 {
     if (id.HasValue)
     {
         try
         {
             var view = logic.Read(new CategoryBindingModel {
                 Id = id
             })?[0];
             if (view != null)
             {
                 textBoxCategoryName.Text = view.NameTheme;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 6
0
        private void FormArticle_Load(object sender, EventArgs e)
        {
            var listCategories = logicC.Read(null);

            comboBoxCategories.DataSource    = listCategories;
            comboBoxCategories.ValueMember   = "Id";
            comboBoxCategories.DisplayMember = "NameTheme";
            comboBoxCategories.SelectedItem  = null;

            var listUsers = logicU.Read(null);

            comboBoxUsers.DataSource    = listUsers;
            comboBoxUsers.ValueMember   = "Id";
            comboBoxUsers.DisplayMember = "Nickname";
            comboBoxUsers.SelectedItem  = null;
            if (id.HasValue)
            {
                try
                {
                    var view = logicA.Read(new ArticleBindingModel {
                        Id = id
                    })?[0];
                    if (view != null)
                    {
                        textBoxTitle.Text = view.Title;
                        textBoxText.Text  = view.Text;
                        comboBoxCategories.SelectedValue = view.CategoryId;
                        comboBoxUsers.SelectedValue      = view.UserId;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }