Esempio 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();
        }
Esempio n. 2
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            splashScreenManager1.ShowWaitForm();
            GridHitInfo hitinfo = gridView1.CalcHitInfo(Cursor.Position);

            if (true /*hitinfo.InDataRow*/)
            {
                Task task = (Task)gridView1.GetRow(gridView1.FocusedRowHandle);
                if (task != null)
                {
                    OperaterLogin.seen_tasks.Add(task.id_task);
                    FormTaskMain frmtm = new FormTaskMain(task, splashScreenManager1);
                    //frmtm.MdiParent = this;
                    //xtraTabControl1.Visible = false;
                    //frmtm.Show();

                    frmtm.FormClosed += (ss, ee) =>         //NOVO**
                    {
                        if (frmtm.DialogResult == DialogResult.OK)
                        {
                            Task local = Main_lista.First(qq => qq.id_task == task.id_task);
                            int  index = Main_lista.IndexOf(local);
                            Main_lista.Remove(local);
                            var db = new AbacusSUPEntities();
                            //var editovan = Baza.Task.First(qq => qq.id_task == task.id_task);

                            xtraTabControl1.Visible = true;
                            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);
                            Main_lista.OrderByDescending(qq => qq.datum);
                            gridView1.RefreshData();
                        }
                    };

                    if (!OperaterLogin.operater.Podesavanja.task_novi_prozor)
                    {
                        var page = xtraTabControl1.TabPages.FirstOrDefault(it => (string)it.Tag == task.id_task.ToString());

                        if (page == null)
                        {
                            page = new DevExpress.XtraTab.XtraTabPage()
                            {
                                Tag  = task.id_task.ToString(),
                                Text = task.id_task.ToString() + " - " + task.naslov,
                            };


                            page.ImageOptions.Image = imageCollection1.Images[imageCollection1.Images.Keys.IndexOf("task_16x16.png")];
                            page.Controls.Add(frmtm.MainPanel);

                            xtraTabControl1.TabPages.Add(page);
                            if (!OperaterLogin.operater.Podesavanja.task_novi_prozor)
                            {
                                frmtm.koriguj_izgled();
                            }
                        }

                        xtraTabControl1.SelectedTabPage = page;
                    }

                    else
                    {
                        //*************************STARO**************************
                        //this.WindowState = FormWindowState.Minimized;
                        frmtm.Show();
                        frmtm.Focus();
                        frmtm.BringToFront();


                        if (frmtm.DialogResult == DialogResult.OK)
                        {
                            Baza = new AbacusSUPEntities();
                            gridControl1.DataSource = Baza.Task.ToList().OrderByDescending(qq => qq.datum);
                            gridView1.RefreshData();
                        }
                        //*****************************************************/
                    }
                }
            }
            else
            {
                MessageBox.Show("Nije prosao hit info!");
            }

            //this.WindowState = FormWindowState.Maximized;
            notifyIcon1.Visible            = false;
            notifyIconNotifikacija.Visible = false;

            /*************EDIT TASK*************************************
             * Task task = (Task)gridView1.GetRow(gridView1.FocusedRowHandle);
             * if (task != null)
             * {
             *  FormAddTask frmat = new FormAddTask(task.id_task);
             *  frmat.ShowDialog();
             * }
             * //Baza.Entry(task).Reload();
             * Baza = new AbacusSUPEntities();
             * gridControl1.DataSource = Baza.Task.ToList();
             * gridView1.RefreshData();
             ***************************************************************/
        }