Ejemplo n.º 1
0
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Task task = (Task)gridView1.GetRow(gridView1.FocusedRowHandle);

            if (task != null)
            {
                FormAddTask frmat = new FormAddTask(task);
                var         res   = frmat.ShowDialog();
                if (res == DialogResult.OK)
                {
                    int index = Main_lista.IndexOf(task);
                    Main_lista.Remove(task);
                    var db = new AbacusSUPEntities();
                    //var editovan = Baza.Task.First(qq => qq.id_task == task.id_task);


                    Task novi = db.Task.First(qq => qq.id_task == task.id_task);
                    Main_lista.Insert(index, novi);
                    db.Entry(novi).Reload();
                    //gridControl1.DataSource = Baza.Task.ToList().OrderByDescending(qq=>qq.datum);
                    gridView1.RefreshData();
                }
            }
            //Baza.Entry(task).Reload();
        }
Ejemplo n.º 2
0
        private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Task task = new Task
            {
                login_id  = OperaterLogin.operater.id,
                datum     = DateTime.Now,
                status_id = 1,
            };
            FormAddTask frmat = new FormAddTask(task);

            var res = frmat.ShowDialog();

            if (res == DialogResult.OK)
            {
                Baza = new AbacusSUPEntities();
                var new_task = Baza.Task.FirstOrDefault(qq => qq.id_task == task.id_task);
                Main_lista.Add(new_task);
                Main_lista.OrderByDescending(qq => qq.datum);
                taskBindingSource.DataSource = Main_lista.OrderByDescending(qq => qq.datum);
                gridView1.RefreshData();
            }
        }