Ejemplo n.º 1
0
        private void frmLogHistory_Load(object sender, EventArgs e)
        {
            var list = DB.SkladBase().OperLog.Where(w => w.Id == _id && w.TabId == _tab_id).ToList().Select(s => new
            {
                s.OpId,
                s.OpCode,
                Name = s.Users != null ? s.Users.Name : "",
                s.OnDate,
                DataBefore = IHelper.ConvertLogData(s.DataBefore),
                DataAfter  = IHelper.ConvertLogData(s.DataAfter)
            }).OrderBy(o => o.OnDate).ToList();

            OprLogGridControl.DataSource = list;
        }
Ejemplo n.º 2
0
        private void RefrechItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (focused_tree_node.GType)
            {
            case 1:
                UsersDS.DataSource = DB.SkladBase().v_Users.ToList();
                break;

            case 2:
                using (var db = DB.SkladBase())
                {
                    UsersOnlineBS.DataSource = db.Users.AsNoTracking().Where(w => w.IsOnline == true).ToList();
                    gridControl2.DataSource  = db.WaybillList.Join(db.DocType, w => w.WType, t => t.Id, (w, t) => new
                    {
                        w.Id,
                        w.Num,
                        w.OnDate,
                        w.UpdatedAt,
                        w.SessionId,
                        UserName = db.Users.Where(u => u.UserId == w.UpdatedBy).Select(u => u.Name).FirstOrDefault(),
                        t.Name,
                        doc_type = t.Id
                    }).Where(w => w.SessionId != null).ToList().Concat(db.ProductionPlans.Where(w => w.SessionId != null).Select(s => new
                    {
                        s.Id,
                        s.Num,
                        s.OnDate,
                        s.UpdatedAt,
                        s.SessionId,
                        UserName = db.Users.Where(u => u.UserId == s.UpdatedBy).Select(u => u.Name).FirstOrDefault(),
                        Name     = "Планування виробницва",
                        doc_type = 20
                    }).ToList());
                }
                break;

            /*        case 3: DelBarButton->Enabled = (cxGridDBTableView2->DataController->DataSource->DataSet->FieldByName("def")->Value != 1);
             *          break;*/

            case 5:
                if (xtraTabControl2.SelectedTabPageIndex == 0)
                {
                    GetOperLogBS.DataSource = DB.SkladBase().GetOperLog(wbStartDate.DateTime, wbEndDate.DateTime, (int)wTypeList.EditValue, (int)UserComboBox.EditValue).OrderByDescending(o => o.OnDate).ToList().Select(s => new GetOperLog_Result
                    {
                        OpCode     = s.OpCode,
                        OnDate     = s.OnDate,
                        FunName    = s.FunName,
                        Id         = s.Id,
                        DocNum     = s.DocNum,
                        UserName   = s.UserName,
                        TabId      = s.TabId,
                        DataBefore = IHelper.ConvertLogData(s.DataBefore),
                        DataAfter  = IHelper.ConvertLogData(s.DataAfter),
                        ClassName  = s.ClassName,
                        DocType    = s.DocType,
                        FunId      = s.FunId,
                        OpId       = s.OpId,
                        UserId     = s.UserId
                    }).ToList();
                }
                if (xtraTabControl2.SelectedTabPageIndex == 1)
                {
                    PrintLogGridControl.DataSource = DB.SkladBase().GetPrintLog(wbStartDate.DateTime, wbEndDate.DateTime, (int)UserComboBox.EditValue).ToList();
                }
                if (xtraTabControl2.SelectedTabPageIndex == 2)
                {
                    ErrorLogGridControl.DataSource = DB.SkladBase().v_ErrorLog.OrderByDescending(o => o.OnDate).Take(100).ToList();
                }
                break;

            case 6:
                CommonParamsBS.DataSource = DBHelper.CommonParam;
                break;
            }
        }