Beispiel #1
0
        private void DeleteItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MessageBox.Show("Ви дійсно бажаєте відалити цей запис з довідника?", "Підтвердіть видалення", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
            {
                return;
            }

            switch (focused_tree_node.GType)
            {
            case 1:
                var u = UsersGridView.GetFocusedRow() as v_Users;
                using (var db = DB.SkladBase())
                {
                    db.DeleteWhere <Users>(w => w.UserId == u.UserId);
                }
                break;

            //case 3: SkladData->DBList->Delete(); break ;
            case 5:     //if(cxGrid4->ActiveLevel->Index == 0 ) OperLog->Delete();
                //if(cxGrid4->ActiveLevel->Index == 1) PrintLog->Delete();
                if (xtraTabControl2.SelectedTabPageIndex == 2)
                {
                    var er = ErrorLogGridView.GetFocusedRow() as v_ErrorLog;
                    using (var db = DB.SkladBase())
                    {
                        db.DeleteWhere <ErrorLog>(w => w.Id == er.Id);
                    }
                }

                break;
            }

            RefrechItemBtn.PerformClick();
        }
Beispiel #2
0
        private void EditItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (focused_tree_node.GType)
            {
            case 1:
                var u = UsersGridView.GetFocusedRow() as v_Users;
                new frmUserEdit(u.UserId).ShowDialog();

                RefrechItemBtn.PerformClick();
                break;

            /*     case 3: frmDBEdit = new TfrmDBEdit(Application);
             *       SkladData->DBList->Open();
             *       SkladData->DBList->Edit();
             *       if (frmDBEdit->ShowModal() == mrOk)
             *       {
             *           SkladData->DBList->Post();
             *           if (SkladData->DBListdef->Value == 1)
             *           {
             *               int id = SkladData->DBListDBID->Value;
             *               for (SkladData->DBList->First(); !SkladData->DBList->Eof; SkladData->DBList->Next())
             *               {
             *                   if (id != SkladData->DBListDBID->Value)
             *                   {
             *                       SkladData->DBList->Edit();
             *                       SkladData->DBListdef->Value = 0;
             *                       SkladData->DBList->Post();
             *                   }
             *               }
             *               SkladData->DBList->Locate("DBID", id, TLocateOptions());
             *           }
             *
             *       }
             *       else SkladData->DBList->Cancel();
             *       delete frmDBEdit;
             *       break;*/

            case 5:
                var f = new frmOperLogDet();
                f.OperLogDetBS.DataSource = OprLogGridView.GetFocusedRow();
                f.ShowDialog();
                break;
            }
        }
Beispiel #3
0
        private void UsersGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            var row = UsersGridView.GetFocusedRow() as UserList;

            if (e.Column.FieldName == "WhAccess")
            {
                if (Convert.ToBoolean(e.Value))
                {
                    _db.UserAccessWh.Add(new UserAccessWh {
                        UserId = row.UserId, UseReceived = true, WId = wh.WId
                    });
                }
                else
                {
                    _db.UserAccessWh.Remove(_db.UserAccessWh.FirstOrDefault(w => w.WId == wh.WId && w.UserId == row.UserId));
                }

                _db.SaveChanges();
            }
        }