コード例 #1
0
 /// <summary>
 /// Закрыть форму
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnConfirm_Click(object sender, EventArgs e)
 {
     using (var db = new dbContext())
     {
         //При закрытии формы мы сохраняем наши параметры
         foreach (var item in modelVisible)
         {
             db.Entry(item).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         //При закрытии формы мы сохраняем наши параметры
         foreach (var item in modelUnVisible)
         {
             db.Entry(item).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
コード例 #2
0
        /// <summary>
        /// Очередность и видимость колонок
        /// </summary>
        public void ReloadColumnView()
        {
            this.Columns.Clear();

            using (var db = new dbContext())
            {
                var t = from e in db.TColumn
                        where e.FrameId.Id == FrameId &&
                                e.UserId.UserName == UserName &&
                                e.ComponentGuid.ToString() == ComponentGuid
                        orderby e.Position
                        select e;
                foreach (var item in t)
                {
                    Columns.Add(new DataGridViewTextBoxColumn { Name = item.ColumnName,
                        HeaderText = item.DisplayName,
                        Width = item.ColumnWidth,
                        Visible = item.IsVisible });
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// До загрузки формы
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditColumnWindow_Load(object sender, EventArgs e)
        {
            using (var db = new dbContext())
            {
                var t = from el in db.TColumn
                        where el.UserId.UserName == userName &&
                                el.FrameId.Id == frameId &&
                                el.ComponentGuid.ToString() == componentGuid
                        select el;
                modelVisible = t.Where(a => a.IsVisible).OrderBy(a => a.Position).ToList();
                modelUnVisible = t.Where(a => !a.IsVisible).OrderBy(a => a.Position).ToList();

                ResetListBox();
            }
        }