Esempio n. 1
0
        private void ListViewClearFilter_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            // Разблокируем стандартный полнотекстовый поиск
            standardFilterController.FullTextFilterAction.Enabled[FTS_DO_NOT_ENABLED] = true;
            // Скрываем саму кнопку
            //FilteringCriterionListActionClose1.Active[DO_NOT_ACTIVE] = false;
            FilteringCriterionListAction.Active[DO_NOT_ACTIVE] = true;

            // Разблокируем две кнопки
            FilteringCriterionListAction.Enabled.Clear();
            FilteringCriterionListAction.Enabled[DO_NOT_ENABLED] = true;

            ListViewApplyFilter.Enabled.Clear();
            ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = false;

            DevExpress.ExpressApp.ListView listView = View as DevExpress.ExpressApp.ListView;
            listView.CollectionSource.Criteria.Clear();

            if (wp != null)
            {
                wp.ClearFilter();
            }

            // Очищаем полнотекстовый поиск
            standardFilterController.FullTextFilterAction.DoExecute("");

            //if (wp == null) return;
            //wp.ClearFilter();
            ////listView.CollectionSource.Criteria.Clear();
            //listView.CollectionSource.Reload();   // Не нужно в связи standardFilterController.FullTextFilterAction.DoExecute(null)?

            // Скрытие панели с фильтром
            FilterPanelHide();
            currentFilterId = "";
        }
        public void ProcessAction(DevExpress.XtraPivotGrid.PivotCellEventArgs e)
        {
            PivotGridListEditor listEditor = ((DevExpress.ExpressApp.ListView)View).Editor as PivotGridListEditor;

            int columnIndex = e.ColumnIndex;
            int rowIndex    = e.RowIndex;
            PivotDrillDownDataSource drillDown  = listEditor.PivotGridControl.CreateDrillDownDataSource(columnIndex, rowIndex);
            List <object>            keysToShow = new List <object>();

            for (int i = 0; i < drillDown.RowCount; i++)
            {
                object obj = drillDown[i][0];
                if (obj != null)
                {
                    keysToShow.Add(ObjectSpace.GetKeyValue(obj));
                }
            }

            if (keysToShow.Count > 0)
            {
                string viewId = Application.GetListViewId(View.ObjectTypeInfo.Type);
                CollectionSourceBase collectionSource = Application.CreateCollectionSource(Application.CreateObjectSpace(), View.ObjectTypeInfo.Type, viewId);
                collectionSource.Criteria["SelectedObjects"] = new InOperator(ObjectSpace.GetKeyPropertyName(View.ObjectTypeInfo.Type), keysToShow);
                DevExpress.ExpressApp.ListView listView = Application.CreateListView(viewId, collectionSource, true);
                ShowViewParameters             svp      = new ShowViewParameters(listView);
                svp.TargetWindow = TargetWindow.NewModalWindow;
                //svp.Context = TemplateContext.View;
                Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(Frame, null));
            }
        }
Esempio n. 3
0
        //void gridView_SelectionChanged(object sender, EventArgs e)
        //{
        //    if (SecuritySystem.CurrentUser is Student)
        //    {
        //        Student student = SecuritySystem.CurrentUser as Student;
        //        string currentClass = student.StudentClass.ClassCode;

        //        ASPxGridView gc = sender as ASPxGridView;

        //        List<Vacancy> tempList = new List<Vacancy>(listVacancies);

        //        List<object> listobj = gc.GetSelectedFieldValues(new string[] { "LessonCode" });
        //        ObjectSpace objectSpace = Application.CreateObjectSpace();

        //        Vacancy vc;
        //        string strFilter = "", strInclude = "";
        //        foreach (int strLessonCode in listobj)
        //        {
        //            Lesson lesson = objectSpace.FindObject<Lesson>(new BinaryOperator("LessonCode", strLessonCode));
        //            strInclude += String.Format("OR ([LessonCode]={0})", lesson.LessonCode);
        //            foreach (TkbSemester tkbsem in lesson.TKBSemesters)
        //            {
        //                vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
        //                tempList.Add(vc);
        //            }
        //        }
        //        if (strInclude != "")
        //            strInclude = String.Format("({0})", strInclude.Substring(3));

        //        if (listobj.Count > 0)
        //        {
        //            using (XPCollection xpLesson = new XPCollection(objectSpace.Session, typeof(Lesson)))
        //            {

        //                foreach (Lesson lesson in xpLesson)
        //                {
        //                    foreach (TkbSemester tkbsem in lesson.TKBSemesters)
        //                    {
        //                        vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
        //                        if (Utils.IsConfictTKB(tempList, vc))
        //                        {
        //                            strFilter += String.Format("AND ([LessonCode]<>{0})", lesson.LessonCode);
        //                            break;
        //                        }
        //                    }
        //                }
        //                if (strFilter != "")
        //                    strFilter = String.Format("({0})", strFilter.Substring(4));

        //            }
        //        }
        //        if (strInclude != "" && strFilter != "")
        //        {
        //            strFilter = String.Format("({0} OR {1})", strFilter, strInclude);
        //        }
        //        else if (strInclude != "")
        //        {
        //            strFilter = strInclude;

        //        }

        //        if (strFilter != "")
        //        {
        //            if (gc.FilterExpression.Contains("TkbLesson.ClassIDs"))
        //            {
        //                gc.FilterExpression = string.Format("([TkbLesson.ClassIDs] Like '%{0}%') AND {1}", currentClass, strFilter);
        //            }
        //            else
        //            {
        //                gc.FilterExpression = strFilter;
        //            }
        //        }

        //    }
        //}

        //void gridView_DataBound(object sender, EventArgs e)
        //{
        //    if (SecuritySystem.CurrentUser is Student)
        //    {
        //        Student student = SecuritySystem.CurrentUser as Student;
        //        string currentClass = student.StudentClass.ClassCode;
        //        ASPxGridView gc = sender as ASPxGridView;
        //        if (gc.FilterExpression == "")
        //            gc.FilterExpression = string.Format("[TkbLesson.ClassIDs] Like '%{0}%'", currentClass);
        //    }
        //}

        void selectAcception_AcceptingStudent(object sender, DialogControllerAcceptingEventArgs e)
        {
            if (SecuritySystem.CurrentUser is Student)
            {
                ObjectSpace objectSpace           = Application.CreateObjectSpace();
                DevExpress.ExpressApp.ListView lv = ((DevExpress.ExpressApp.ListView)((WindowController)sender).Window.View);
                if (SecuritySystem.CurrentUser is Student)
                {
                    objectSpace.Session.BeginTransaction();
                    Student student        = SecuritySystem.CurrentUser as Student;
                    Student currentStudent = objectSpace.FindObject <Student>(
                        new BinaryOperator("StudentCode", student.StudentCode));
                    Lesson curLesson;
                    foreach (Lesson lesson in lv.SelectedObjects)
                    {
                        curLesson = objectSpace.FindObject <Lesson>(
                            new BinaryOperator("Oid", lesson.Oid));
                        RegisterDetail regdetail = new RegisterDetail(objectSpace.Session)
                        {
                            Student       = currentStudent,
                            Lesson        = curLesson,
                            RegisterState = objectSpace.FindObject <RegisterState>(
                                new BinaryOperator("Code", "SELECTED")),
                            CheckState = objectSpace.FindObject <RegisterState>(
                                new BinaryOperator("Code", "NOTCHECKED"))
                        };
                    }
                    objectSpace.Session.CommitTransaction();
                    //               View.ObjectSpace.CommitChanges();
                    View.ObjectSpace.Refresh();
                }
            }
        }
Esempio n. 4
0
        CriteriaOperator CriteriaSelectionOperator(ListView listView, IModelColumn filteredColumn)
        {
            var keyName = filteredColumn.ModelMember.MemberInfo.MemberTypeInfo.KeyMember.Name;

            return(listView.Editor is ISelectionCriteria selectionCriteria?CriteriaOperator.Parse(filteredColumn.PropertyName + "." + (selectionCriteria).SelectionCriteria.ToString())
                       : new InOperator(filteredColumn.PropertyName + "." + keyName, Getkeys(listView)));
        }
Esempio n. 5
0
        ListView FilteredListView(ListView listView, DashboardViewItem dashboardViewItem, IModelDashboardViewItemEx modelDashboardViewItemFiltered)
        {
            var filteredColumn       = modelDashboardViewItemFiltered.Filter.FilteredColumn;
            var filteredListView     = ((ListView)dashboardViewItem.Frame.View);
            var collectionSourceBase = filteredListView.CollectionSource;

            collectionSourceBase.Criteria[modelDashboardViewItemFiltered.Filter.DataSourceView.Id] = CriteriaSelectionOperator(listView, filteredColumn);
            return(filteredListView);
        }
Esempio n. 6
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ShowViewParameters   svp              = new ShowViewParameters();
            IObjectSpace         newObjectSpace   = application.CreateObjectSpace();
            CollectionSourceBase collectionSource = application.CreateCollectionSource(newObjectSpace, type, ListViewId);

            DevExpress.ExpressApp.ListView lv = application.CreateListView(ListViewId, collectionSource, true);
            svp.CreatedView = lv;
            application.ShowViewStrategy.ShowView(svp, new ShowViewSource(application.MainWindow, null));
        }
Esempio n. 7
0
        private void OpenWith(ListView listView)
        {
            var gridControl = listView.Editor.Control as GridControl;

            if (gridControl != null)
            {
                gridControl.KeyUp            += GridControlOnKeyUp;
                gridControl.MouseDoubleClick += GridControlOnMouseDoubleClick;
            }
        }
Esempio n. 8
0
 void NotifyControllers(ListView listView)
 {
     if (View != null)
     {
         var selectionChangeds = View.Items.OfType <DashboardViewItem>().SelectMany(Controllers);
         foreach (var selectionChanged in selectionChangeds)
         {
             selectionChanged.SelectedObjects = listView.SelectedObjects;
         }
     }
 }
Esempio n. 9
0
 public override void OnControllerDeactivated()
 {
     OpenObjectAction.Active.RemoveItem(
         DevExpress.ExpressApp.Win.SystemModule.OpenObjectController.ActiveKeyHasReadPermissionToTargetType);
     OpenObjectAction.Enabled.RemoveItem(HasReadPermissionToTargetObjectEnabledKey);
     _listView.ControlsCreated -= listView_ControlsCreated;
     UnsubscribeFromGrid();
     _listView     = null;
     _cursorHelper = null;
     _grid         = null;
     _gridView     = null;
     base.OnControllerDeactivated();
 }
Esempio n. 10
0
        ListView FilteredListView(ListView listView, DashboardViewItem dashboardViewItem, IModelDashboardViewItemEx modelDashboardViewItemFiltered)
        {
            var filteredColumn = modelDashboardViewItemFiltered.Filter.FilteredColumn;

            if (filteredColumn != null)
            {
                var filteredListView          = ((ListView)dashboardViewItem.Frame.View);
                var collectionSourceBase      = filteredListView.CollectionSource;
                var criteriaSelectionOperator = CriteriaSelectionOperator(listView, filteredColumn);
                collectionSourceBase.SetCriteria(modelDashboardViewItemFiltered.Filter.DataSourceView.Id, criteriaSelectionOperator.ToString());
                return(filteredListView);
            }

            return(null);
        }
Esempio n. 11
0
        private void ListViewFilterPanelController_Activated(object sender, EventArgs e)
        {
            // Скрываем саму кнопку
            ListViewClearFilter.Enabled[DO_NOT_ENABLED] = false;
            ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = false;

            frame    = Frame;
            view     = View;
            listView = view as DevExpress.ExpressApp.ListView;
            if (listView == null)
            {
                return;
            }

            objectTypeInfo       = listView.CollectionSource.ObjectTypeInfo;
            typeObjectOfListView = objectTypeInfo.Type;

            // Критерий из модели для самого ListView
            listViewCriteria = listView.Model.Criteria;

            View.ControlsCreated += new EventHandler(View_ControlsCreated);
            FilteringCriterionListAction.Items.Clear();

            foreach (IModelDetailView node in View.Model.Application.Views.GetNodes <IModelDetailView>())
            {
                if (node.ModelClass.TypeInfo.Type.Name.StartsWith(typeObjectOfListView.Name + "Filter"))
                {
                    ChoiceActionItem current = new ChoiceActionItem(node.Id, node.Caption, node);
                    FilteringCriterionListAction.Items.Add(current);
                }
            }

            IModelDetailView imdvFullTextSearch    = Application.FindModelView(Application.FindDetailViewId(typeof(FilteringCriterion))) as IModelDetailView;
            string           FullTextSearchCaption = imdvFullTextSearch.Caption;

            FilteringCriterionListAction.Items.Add(new ChoiceActionItem("CriteriaBuilder", FullTextSearchCaption, null));
            FilteringCriterionListAction.SelectedIndex = 0;

            if (standardFullTextFilterAction != null)
            {
                standardFullTextFilterAction.Active["IsPersistentType"] = true;
                //    string searchText = "";
                //    if (standardFullTextFilterAction.Value != null) searchText = standardFullTextFilterAction.Value.ToString();
                //    InitVariablesForLikeSearchPathListAttribute(searchText, out criteriaForLikeSearchPathListAttribute, out propertiesForLikeSearchPathListAttribute);
            }
        }
Esempio n. 12
0
        public override void OnControllerActivated()
        {
            base.OnControllerActivated();
            _listView = (ListView)Controller.View;
            OpenObjectAction.Active[
                DevExpress.ExpressApp.Win.SystemModule.OpenObjectController.ActiveKeyHasReadPermissionToTargetType] =
                DataManipulationRight.CanRead(_listView.ObjectTypeInfo.Type, null, null, _listView.CollectionSource,
                                              ObjectSpace);
            bool hasObjectRefControl = false;

            if (_listView.Model != null)
            {
                if (
                    _listView.Model.Columns.Select(
                        columnInfo => _listView.ObjectTypeInfo.FindMember(columnInfo.PropertyName)).Any(
                        findMember => findMember != null && IsDetailViewExists(findMember.MemberType)))
                {
                    hasObjectRefControl = true;
                }
            }
            OpenObjectAction.Active[ViewContainsObjectEditorActiveKey] = hasObjectRefControl;
            _listView.ControlsCreated += listView_ControlsCreated;
        }
Esempio n. 13
0
 bool ShouldUseCustomImplementation(ListView listView)
 {
     return(listView != null && listView.Editor is GridView.GridListEditorBase);
 }
Esempio n. 14
0
        void selectAcception_AcceptingAdmin(object sender, DialogControllerAcceptingEventArgs e)
        {
            ObjectSpace objectSpace = Application.CreateObjectSpace();

            DevExpress.ExpressApp.ListView lv = ((DevExpress.ExpressApp.ListView)((WindowController)sender).Window.View);
            User u = (User)SecuritySystem.CurrentUser;
            XPCollection <Role> xpc = new XPCollection <Role>(u.Roles,
                                                              new BinaryOperator("Name", "Administrators"));
            XPCollection <Role> xpc2 = new XPCollection <Role>(u.Roles,
                                                               new BinaryOperator("Name", "DataAdmins"));

            if (xpc.Count + xpc2.Count > 0)
            {
                objectSpace.Session.BeginTransaction();

                Student currentStudent;
                Lesson  curLesson;
                foreach (string studentCode in listStudentCode)
                {
                    currentStudent = objectSpace.FindObject <Student>(
                        new BinaryOperator("StudentCode", studentCode));
                    foreach (Lesson lesson in lv.SelectedObjects)
                    {
                        curLesson = objectSpace.FindObject <Lesson>(
                            new BinaryOperator("Oid", lesson.Oid));
                        RegisterDetail regdetail = new RegisterDetail(objectSpace.Session)
                        {
                            Student       = currentStudent,
                            Lesson        = curLesson,
                            RegisterState = objectSpace.FindObject <RegisterState>(
                                new BinaryOperator("Code", "SELECTED")),
                            CheckState = objectSpace.FindObject <RegisterState>(
                                new BinaryOperator("Code", "NOTCHECKED"))
                        };
                        RuleSet ruleSet = new RuleSet();

                        RuleSetValidationResult result = ruleSet.ValidateTarget(regdetail, DefaultContexts.Save);
                        if (ValidationState.Invalid ==
                            result.GetResultItem("RegisterDetail.StudentRegLessonSemester").State)
                        {
                            regdetail.Delete();
                        }
                        else
                        {
                            regdetail.Save();
                        }
                    }
                }
                objectSpace.Session.CommitTransaction();

                PopUpMessage ms = objectSpace.CreateObject <PopUpMessage>();
                ms.Title   = "Lỗi đăng ký";
                ms.Message = string.Format("Error");
                ShowViewParameters svp = new ShowViewParameters();
                svp.CreatedView = Application.CreateDetailView(
                    objectSpace, ms);
                svp.TargetWindow        = TargetWindow.NewModalWindow;
                svp.CreatedView.Caption = "Thông báo";
                DialogController dc = Application.CreateController <DialogController>();
                svp.Controllers.Add(dc);

                dc.SaveOnAccept = false;
                Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
                ////               View.ObjectSpace.CommitChanges();
                //View.ObjectSpace.Refresh();
                //ListView view = null;
                //Frame currentFrame = ((ActionBase)sender).Controller.Frame;
                //switch (currentFrame.View.ObjectTypeInfo.Name)
                //{
                //    case "Student":
                //        view = Application.CreateListView(objectSpace,typeof(RegisterDetail),true);
                //        break;
                //}
                //currentFrame.SetView(view);
                //e.Cancel = true;
            }
        }
Esempio n. 15
0
        private void SelectRegister_Execute(object sender, SimpleActionExecuteEventArgs args)
        {
            ObjectSpace os = Application.CreateObjectSpace();


            if (SecuritySystem.CurrentUser is Student)
            {
                #region student
                ObjectSpace objectSpace      = Application.CreateObjectSpace();
                CriteriaOperatorCollection c = new CriteriaOperatorCollection();

                CollectionSource newCollectionSource = new CollectionSource(objectSpace, typeof(Lesson));
                listVacancies = new List <Vacancy>();
                foreach (RegisterDetail regDetail in ((ProxyCollection)((DevExpress.ExpressApp.ListView)View).CollectionSource.Collection))
                {
                    foreach (TkbSemester tkbsem in regDetail.Lesson.TKBSemesters)
                    {
                        listVacancies.Add(new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, tkbsem.Classroom.ClassroomCode));
                    }
                    //newCollectionSource.Criteria[regDetail.Lesson.Oid.ToString()] =
                    //    new BinaryOperator("Oid", regDetail.Lesson.Oid, BinaryOperatorType.NotEqual);
                }

                using (XPCollection xpLesson = new XPCollection(objectSpace.Session, typeof(Lesson)))
                {
                    Vacancy vc;
                    foreach (Lesson lesson in xpLesson)
                    {
                        if ((!lesson.CanRegister) || (lesson.NumRegistration >= lesson.NumExpectation))
                        {
                            //quá sĩ số
                            newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                        }
                        //vi phạm thời khóa biểu
                        foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                        {
                            vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                            if (Utils.IsConfictTKB(listVacancies, vc))
                            {
                                newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                                break;
                            }
                        }
                    }
                }

                DevExpress.ExpressApp.ListView lv = Application.CreateListView(
                    Application.FindListViewId(typeof(Lesson)),
                    newCollectionSource, true);
                lv.Editor.AllowEdit        = false;
                lv.Editor.ControlsCreated += Editor_ControlsCreated;

                args.ShowViewParameters.CreatedView          = lv;
                args.ShowViewParameters.TargetWindow         = TargetWindow.NewModalWindow;
                args.ShowViewParameters.CreateAllControllers = true;
                DialogController selectAcception = new DialogController();
                args.ShowViewParameters.Controllers.Add(selectAcception);
                selectAcception.Accepting += selectAcception_AcceptingStudent;
                #endregion
            }
            else
            {
                ObjectSpace objectSpace      = Application.CreateObjectSpace();
                CriteriaOperatorCollection c = new CriteriaOperatorCollection();
                listStudentCode = new List <string>();
                CollectionSource newCollectionSource = new CollectionSource(objectSpace, typeof(Lesson));
                listVacancies = new List <Vacancy>();
                foreach (Student student in View.SelectedObjects)
                {
                    foreach (RegisterDetail regDetail in student.RegisterDetails)
                    {
                        foreach (TkbSemester tkbsem in regDetail.Lesson.TKBSemesters)
                        {
                            listVacancies.Add(new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, tkbsem.Classroom.ClassroomCode));
                        }
                        //newCollectionSource.Criteria[regDetail.Lesson.Oid.ToString()] =
                        //    new BinaryOperator("Oid", regDetail.Lesson.Oid, BinaryOperatorType.NotEqual);
                    }
                    listStudentCode.Add(student.StudentCode);
                }
                using (XPCollection xpLesson = new XPCollection(objectSpace.Session, typeof(Lesson)))
                {
                    Vacancy vc;
                    foreach (Lesson lesson in xpLesson)
                    {
                        if ((!lesson.CanRegister) || (lesson.NumRegistration >= lesson.NumExpectation))
                        {
                            //quá sĩ số
                            newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                        }
                        //vi phạm thời khóa biểu
                        foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                        {
                            vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                            if (Utils.IsConfictTKB(listVacancies, vc))
                            {
                                newCollectionSource.Criteria[lesson.Oid.ToString()] = new BinaryOperator("Oid", lesson.Oid, BinaryOperatorType.NotEqual);
                                break;
                            }
                        }
                    }
                }

                DevExpress.ExpressApp.ListView lv = Application.CreateListView(
                    Application.FindListViewId(typeof(Lesson)),
                    newCollectionSource, true);
                lv.Editor.AllowEdit        = false;
                lv.Editor.ControlsCreated += Editor_ControlsCreated;

                args.ShowViewParameters.CreatedView          = lv;
                args.ShowViewParameters.TargetWindow         = TargetWindow.NewModalWindow;
                args.ShowViewParameters.CreateAllControllers = true;
                DialogController selectAcception = new DialogController();
                args.ShowViewParameters.Controllers.Add(selectAcception);
                selectAcception.Accepting += selectAcception_AcceptingAdmin;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Импортируем обследование в выбранного пациента
        /// </summary>
        private void ExistPatientImportExamination(IPatient patient)
        {
            importExamination = Application.MainWindow.View.ObjectSpace.CreateObject<IExamination>();
            importExamination.Patient = patient;//Application.MainWindow.View.ObjectSpace.GetObject<IPatient>(patient);
            importExamination.Status = ExaminationStatus.Registered;

            //DateTime examDateTime = ConcatenateDateAndTime(GetValueByID(importFileHeader, "ExamDate"), GetValueByID(importFileHeader, "ExamTime"));

            importExamination.TimeStart = importData.StartExaminationDateTime;
            importExamination.TimeStop = importData.EndExaminationDateTime;

            Guid examinationSoftTypeId = (from ModuleAssociationAttribute attribute in dynamicModule.GetType().Assembly.GetCustomAttributes(typeof(ModuleAssociationAttribute), true)
                                          where (attribute as ModuleAssociationAttribute).FileExtension == System.IO.Path.GetExtension(importFileFullName).ToLower()
                                          select attribute.OID).FirstOrDefault();

            importExamination.ExaminationSoftType = Application.MainWindow.View.ObjectSpace.FindObject<ExaminationSoftType>(CriteriaOperator.Parse("ExaminationSoftTypeId = ?", examinationSoftTypeId));

            var items = (Application.MainWindow.View as DashboardView).Items;
            patientListView = (from DashboardViewItem edt in items
                               where edt.InnerView.ObjectTypeInfo.Type == typeof(IPatient)
                               select edt.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;

            examinationsListView = (from DashboardViewItem edt in items
                                    where edt.InnerView.ObjectTypeInfo.Type == typeof(IExamination)
                                    select edt.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;

            //objectspaceCommitted += (object send, EventArgs args) =>
            //{
            //    Application.MainWindow.View.ObjectSpace.Committed -= objectspaceCommitted;
            //    GridListEditor editor = patientListView.Editor as GridListEditor;
            //    editor.Grid.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate() { SetCurrentPatient(patient, patientListView); }));

            //    GridListEditor examEditor = examinationsListView.Editor as GridListEditor;
            //    examEditor.Grid.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate() { SetCurrentExamination(importExamination, examinationsListView); }));
            //};

            //Application.MainWindow.View.ObjectSpace.Committed += objectspaceCommitted;

            if(Application.MainWindow.View.ObjectSpace.IsModified==true)
                Application.MainWindow.View.ObjectSpace.CommitChanges();

            //importExamination.ExaminationFile = Application.MainWindow.View.ObjectSpace.CreateObject<FileSystemStoreObject>();
            importExamination.ExaminationFile = Application.MainWindow.View.ObjectSpace.CreateObject<ExaminationFile>();
            importExamination.ExaminationFile.FileName = importExamination.ObjectCode.Replace('/', '.') + importExamination.ExaminationSoftType.ExaminationFileExtension;
            importExamination.ExaminationFile.OwnerId = ((DevExpress.ExpressApp.DC.DCBaseObject)importExamination).Oid;

            Application.MainWindow.View.ObjectSpace.CommitChanges();

            //TransferExaminationFile(fileFullName, examination.ExaminationFile);

            UploadExaminationFile();
        }
Esempio n. 17
0
        protected void view_ControlsCreated(object sender, EventArgs e)
        {
            ((DevExpress.ExpressApp.View)sender).ControlsCreated -= new EventHandler(view_ControlsCreated);
            var items = (sender as DashboardView).Items;

            patientListView = (from DashboardViewItem item in items
                               where item.InnerView.ObjectTypeInfo.Type == typeof(IPatient)
                               select item.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;
        }
Esempio n. 18
0
 public SelectionChangedArgs(ListView listView, DashboardViewItem dashboardViewItem)
 {
     _listView          = listView;
     _dashboardViewItem = dashboardViewItem;
 }
Esempio n. 19
0
 public ListViewFilteredArgs(ListView filterListView)
 {
     _filterListView = filterListView;
 }
        private void MiniNavigationAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            if (e.CurrentObject == null)
            {
                return;
            }

            if (MiniNavigationAction.SelectedItem == null)
            {
                return;
            }

            object currentObj = e.CurrentObject;

            Frame  frame = Frame;
            View   view  = View;
            string path  = e.SelectedChoiceActionItem.Id;
            //if (selId == path) return;
            String selId = path;

            if ((view as DetailView) != null & selId == "This")
            {
                return;
            }

            BaseObject obj = GetObjectOnPathEnd(path, (BaseObject)currentObj);

            if (obj == null)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(
                    CommonMethods.GetMessage(MiniNavigatorControllerMessages.SHOWING_OBJECT_NOT_DEFINED),
                    messageCaption,
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Exclamation);
                return;
            }

            Type   ChoiceType = (System.Type)(obj.GetType());             //.UnderlyingSystemType;   //typeof(object);
            string ViewID     = Application.FindDetailViewId(ChoiceType); // По умолчанию - DetailView

            // Считывание из модели view, через которое надо показать объект и оно задано
            IModelView modelView = null;

            DevExpress.ExpressApp.ListView   listView   = view as DevExpress.ExpressApp.ListView;
            DevExpress.ExpressApp.DetailView detailView = view as DevExpress.ExpressApp.DetailView;

            //if (IsMiniNavigationDefined) {
            //    // Узел в модели
            //    IModelView node = null;
            //    node = View.Model.Application.Views[((listView != null) ? listView.Id : "") + ((detailView != null) ? detailView.Id : "")];
            //    if (node != null) {
            //        // Перебираем все подузлы
            //        // node.GetNode(1)	{ModelListViewFilters}	DevExpress.ExpressApp.Model.IModelNode {ModelListViewFilters}
            //        for (int i = 0; i < node.NodeCount; i++) {
            //IModelMiniNavigations miniNavigationNode = node.GetNode(i) as IModelMiniNavigations;
            IModelMiniNavigations miniNavigationNode = FindMiniNavigationModel(View);

            if (miniNavigationNode != null)
            {
                foreach (IModelMiniNavigationItem miniNavigationItem in miniNavigationNode.GetNodes <IModelMiniNavigationItem>())
                {
                    if (miniNavigationItem.NavigationPath == selId)
                    {
                        modelView = miniNavigationItem.View;
                        break;
                    }
                }
                //break;
            }
            //        }
            //    }
            //}


            Frame        resultFrame = frame; // Application.CreateFrame("new");
            TargetWindow openMode    = (TargetWindow)e.SelectedChoiceActionItem.Data;

            // Сбрасываем состояние списка
            MiniNavigationAction.SelectedItem  = null;
            MiniNavigationAction.SelectedIndex = 0;

            // Небольшая разборка с сочетанием значений openMode и типа текущего View - List или Detail - в целях
            // определения фрейма, в который грузить
            if (MasterDetailViewFrame != null && (openMode == TargetWindow.Current & (view as ListView) != null & ((frame as NestedFrame) != null | !view.IsRoot)))
            {
                // Тогда Current трактуем как корневое окно
                resultFrame = MasterDetailViewFrame;
                {
                    //IObjectSpace objectSpace = resultFrame.View.ObjectSpace;
                    IObjectSpace objectSpace       = resultFrame.Application.CreateObjectSpace(); // Всё равно предыдущий ObjectSpace теряется в этом случае
                    object       representativeObj = objectSpace.GetObject(obj);

                    View dv = null;

                    if (modelView != null)
                    {
                        if ((modelView as IModelDetailView) != null)
                        {
                            ViewID = (modelView as IModelDetailView).Id;
                            dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                        }
                        else if ((modelView as IModelListView) != null)
                        {
                            ViewID = (modelView as IModelListView).Id;
                            //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true);
                            CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType);
                            if (!colSource.IsLoaded)
                            {
                                colSource.Reload();
                            }
                            dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView;
                        }
                    }
                    else
                    {
                        ViewID = Application.FindDetailViewId(ChoiceType);
                        dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                    }

                    resultFrame.SetView(dv, true, resultFrame);
                }
                return;
            }

            // Общий алгоритм
            {
                IObjectSpace objectSpace = null;

                // Анализ того, какой ObjectSpace нужен
                if ((frame as NestedFrame) != null | !view.IsRoot)
                {
                    objectSpace = resultFrame.View.ObjectSpace.CreateNestedObjectSpace();
                }
                //objectSpace = resultFrame.View.ObjectSpace.CreateNestedObjectSpace();
                if (objectSpace == null)
                {
                    objectSpace = resultFrame.Application.CreateObjectSpace();
                }

                object representativeObj = objectSpace.GetObject(obj);

                //ViewID = Application.FindDetailViewId(ChoiceType);
                //DetailView dv = frame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj);

                View dv = null;

                if (modelView != null)
                {
                    if ((modelView as IModelDetailView) != null)
                    {
                        ViewID = (modelView as IModelDetailView).Id;
                        dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                    }
                    else if ((modelView as IModelListView) != null)
                    {
                        ViewID = (modelView as IModelListView).Id;
                        //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true);
                        //objectSpace = resultFrame.Application.CreateObjectSpace();
                        CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType);
                        if (!colSource.IsLoaded)
                        {
                            colSource.Reload();
                        }
                        dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView;
                    }
                }
                else
                {
                    ViewID = Application.FindDetailViewId(ChoiceType);
                    dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                }

                ShowViewParameters svp = new ShowViewParameters();
                svp.CreatedView          = dv;
                svp.TargetWindow         = openMode;
                svp.Context              = TemplateContext.View;
                svp.CreateAllControllers = true;

                e.ShowViewParameters.Assign(svp);
            }
        }
Esempio n. 21
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // Access and customize the target View control.
            try
            {
                if (View == null)
                {
                    return;
                }
                DevExpress.ExpressApp.ListView lv = View as DevExpress.ExpressApp.ListView;
                if (lv == null)
                {
                    return;
                }
                PivotGridListEditor editor = lv.Editor as PivotGridListEditor;
                if (editor == null)
                {
                    if (lv.Model != null)
                    {
                        editor    = new PivotGridListEditor(lv.Model);
                        lv.Editor = editor;
                    }
                    else
                    {
                        return;
                    }
                }

                if (editor.PivotGridControl != null)
                {
                    PV = editor.PivotGridControl;
                }
                else
                {
                    PV = new PivotGridControl(); PV.DataSource = editor.DataSource;
                }
                if (PV == null)
                {
                    return;
                }

                PV.FieldAreaChanging += PV_FieldAreaChanging;
                PV.PopupMenuShowing  += PV_PopupMenuShowing;
                PV.CustomCellValue   += PV_CustomCellValue;

                PV.OptionsView.ShowTotalsForSingleValues      = true;
                PV.OptionsView.ShowGrandTotalsForSingleValues = true;
                PV.OptionsView.ShowRowGrandTotalHeader        = true;
                PV.OptionsView.ShowRowGrandTotals             = true;
                PV.OptionsView.ShowRowTotals              = false;
                PV.OptionsView.ShowColumnTotals           = true;
                PV.OptionsView.ShowColumnGrandTotals      = true;
                PV.OptionsView.ShowColumnGrandTotalHeader = true;

                PV.Fields.Clear();
                // в строку: сотрудник и его должность и фот ручками
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Person", FieldName = "Person.ShortName", Area = PivotArea.RowArea, Caption = "Сотрудник"
                });
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "StaffNumber", FieldName = "DeptPost.StaffNumber", Area = PivotArea.RowArea, Caption = "Табельный номер"
                });
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "DeptPost", FieldName = "DeptPost.idPost.PostName", Area = PivotArea.RowArea, Caption = "Должность"
                });
                DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit decimaledit = new DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit();
                //колонки из проектов и этапов этих проектов (вложенные банды)
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Project", FieldName = "Project.Name", Area = PivotArea.ColumnArea, Caption = "Проект"
                });
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Task", FieldName = "Task.Name", Area = PivotArea.ColumnArea, Caption = "Этап"
                });
                //значение в срезе - кту
                PivotGridField ktu = new PivotGridField();
                ktu.Name                    = "ktu";
                ktu.FieldName               = "KTU";
                ktu.Area                    = PivotArea.DataArea;
                ktu.AreaIndex               = 0;
                ktu.Caption                 = "КТУ";
                ktu.CellFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                ktu.CellFormat.FormatString = "N2";
                //editor для редактирования
                PV.RepositoryItems.Add(decimaledit);
                ktu.FieldEdit              = decimaledit;
                ktu.Options.AllowEdit      = false;
                ktu.Options.ShowTotals     = true;
                ktu.Options.ShowGrandTotal = true;

                PV.Fields.Add(ktu);

                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Month", FieldName = "Form.Period.PeriodMounth", Area = PivotArea.FilterArea, Caption = "Месяц", AreaIndex = 0
                });
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Year", FieldName = "Form.Period.PeriodYear", Area = PivotArea.FilterArea, Caption = "Год", AreaIndex = 1
                });
                //по подразделениям
                PV.Fields.Add(new PivotGridField()
                {
                    Name = "Dept", FieldName = "Form.DeptBook.SubjDept.SubjName", Area = PivotArea.RowArea, Caption = "Подразделение", AreaIndex = 0
                });
                //связанная колонка с выражением - фот по проекту у сотрудника
                PivotGridField fot = new PivotGridField();
                fot.Name                    = "fot";
                fot.FieldName               = "SumFOT";
                fot.Area                    = PivotArea.DataArea;
                fot.Caption                 = "ФОТ";
                fot.CellFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
                fot.CellFormat.FormatString = "C";
                fot.Visible                 = true;
                fot.SummaryType             = DevExpress.Data.PivotGrid.PivotSummaryType.Sum;
                fot.Options.ShowValues      = false;
                fot.Options.ShowGrandTotal  = true;
                fot.Options.ShowTotals      = true;
                PV.Fields.Add(fot);
                PV.Visible = true;
            }
            catch (Exception ex) { System.Diagnostics.Trace.TraceError(ex.ToString()); }
        }
        void showDV(object sender, CustomProcessListViewSelectedItemEventArgs e)
        {
            Frame frame = Frame;
            View  view  = View;

            DevExpress.ExpressApp.ListView        listView = view as DevExpress.ExpressApp.ListView;
            IEnumerable <MiniNavigationAttribute> mAttr    = null;
            bool AttrExists = false;

            object currentObject = (object)view.CurrentObject;

            if (currentObject == null)
            {
                return;
            }

            Type objType = typeof(object);
            //string DetailViewID = "";
            TargetWindow openMode = TargetWindow.Default;
            IObjectSpace objectSpace;

            Type NavigationChoiceType = (System.Type)(view.CurrentObject.GetType());   //.UnderlyingSystemType;   //typeof(object);


            // Вставка механизма проверки модели на предмет умолчательного view для показа по 2-клик или Ввод
            {
                string path = "";
                //string caption = "";
                //TargetWindow openMode = TargetWindow.Default;
                IModelView modelView = null;
                bool       IsMiniNavigationDefined = false;

                // Узел в модели
                IModelView node = null;
                node = View.Model.Application.Views[listView.Id];
                //IModelListView node  = View.Model.Application.Views.GetNode<IModelListView>(listView.Id);
                if (node != null)
                {
                    // Перебираем все подузлы
                    // node.GetNode(1)	{ModelListViewFilters}	DevExpress.ExpressApp.Model.IModelNode {ModelListViewFilters}
                    for (int i = 0; i < node.NodeCount; i++)
                    {
                        IModelMiniNavigations miniNavigationNode = node.GetNode(i) as IModelMiniNavigations;
                        if (miniNavigationNode != null)
                        {
                            // Сначала заполняем тот, что прописан по умолчанию
                            IModelMiniNavigationItem miniNavigationDefaultItem = miniNavigationNode.DefaultMiniNavigationNode;
                            if (miniNavigationDefaultItem != null)
                            {
                                path = miniNavigationDefaultItem.NavigationPath;
                                //caption = miniNavigationDefaultItem.NavigationCaption;
                                openMode  = miniNavigationDefaultItem.TargetWindow;
                                modelView = miniNavigationDefaultItem.View;

                                IsMiniNavigationDefined = true;
                            }

                            //if (modelView == null) {
                            if (!IsMiniNavigationDefined)
                            {
                                foreach (IModelMiniNavigationItem miniNavigationItem in miniNavigationNode.GetNodes <IModelMiniNavigationItem>())
                                {
                                    if (miniNavigationItem != miniNavigationDefaultItem)
                                    {
                                        path = miniNavigationItem.NavigationPath;
                                        //caption = miniNavigationItem.NavigationCaption;
                                        openMode  = miniNavigationItem.TargetWindow;
                                        modelView = miniNavigationItem.View;

                                        IsMiniNavigationDefined = true;
                                        break; // Берём первый по расположению
                                    }
                                }
                            }
                            break;
                        }
                    }

                    // Если в модели ничего не найдено, то читаем атрибуты.
                    if (!IsMiniNavigationDefined)
                    {
                        DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = null;
                        objectTypeInfo = listView.CollectionSource.ObjectTypeInfo;
                        //typeObjectOfListView = objectTypeInfo.Type;

                        mAttr = objectTypeInfo.FindAttributes <MiniNavigationAttribute>();

                        // Если ничего нет, то покидаем
                        if (mAttr == null & !IsMiniNavigationDefined)
                        {
                            return;
                        }

                        SortedDictionary <int, MiniNavigationAttribute> sd = new SortedDictionary <int, MiniNavigationAttribute>();

                        IEnumerator <MiniNavigationAttribute> _enum = mAttr.GetEnumerator();
                        while (_enum.MoveNext())
                        {
                            MiniNavigationAttribute attr = ((MiniNavigationAttribute)(_enum.Current));
                            sd.Add(attr.Order, attr);
                        }

                        foreach (KeyValuePair <int, MiniNavigationAttribute> kvp in sd)
                        {
                            AttrExists = true;
                            MiniNavigationAttribute attr = kvp.Value;
                            path = attr.NavigationPath;
                            //caption = attr.NavigationCaptin;
                            openMode = attr.TargetWindow;
                            break;  // Берём первый по порядку Order (он же и тот, что по умолчанию)
                        }
                    }

                    if (AttrExists || IsMiniNavigationDefined)
                    {
                        // Получаем объект obj для показа
                        BaseObject obj = GetObjectOnPathEnd(path, currentObject as BaseObject);

                        if (obj == null)
                        {
                            DevExpress.XtraEditors.XtraMessageBox.Show(
                                CommonMethods.GetMessage(MiniNavigatorControllerMessages.SHOWING_OBJECT_NOT_DEFINED),
                                messageCaption,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Exclamation);
                            return;
                        }

                        Type   ChoiceType = (System.Type)(obj.GetType());             //.UnderlyingSystemType;   //typeof(object);
                        string ViewID     = Application.FindDetailViewId(ChoiceType); // По умолчанию - DetailView

                        Frame resultFrame = frame;                                    // Application.CreateFrame("new");
                        //TargetWindow openMode = (TargetWindow)e.SelectedChoiceActionItem.Data;

                        // Небольшая разборка с сочетанием значений openMode в целях определения фрейма, в который грузить
                        if (MasterDetailViewFrame != null && (openMode == TargetWindow.Current & ((frame as NestedFrame) != null | !view.IsRoot)))
                        {
                            // Тогда Current трактуем как корневое окно
                            resultFrame = MasterDetailViewFrame;
                            {
                                objectSpace = resultFrame.Application.CreateObjectSpace();   //.View.ObjectSpace;
                                object representativeObj = objectSpace.GetObject(obj);

                                View dv = null;

                                if (modelView != null)
                                {
                                    if ((modelView as IModelDetailView) != null)
                                    {
                                        ViewID = (modelView as IModelDetailView).Id;
                                        dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                                    }
                                    else if ((modelView as IModelListView) != null)
                                    {
                                        ViewID = (modelView as IModelListView).Id;
                                        //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true);
                                        CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType);
                                        if (!colSource.IsLoaded)
                                        {
                                            colSource.Reload();
                                        }
                                        dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView;
                                    }
                                }
                                else
                                {
                                    // Если навигация орпделена в модели, а view не определено, то образуем DetailView по умолчанию
                                    ViewID = Application.FindDetailViewId(ChoiceType);
                                    dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                                }

                                resultFrame.SetView(dv, true, resultFrame);
                            }
                            return;
                        }

                        // Общий алгоритм
                        {
                            objectSpace = resultFrame.Application.CreateObjectSpace();
                            object representativeObj = objectSpace.GetObject(obj);

                            View dv = null;

                            if (modelView != null)
                            {
                                if ((modelView as IModelDetailView) != null)
                                {
                                    ViewID = (modelView as IModelDetailView).Id;
                                    dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                                }
                                else if ((modelView as IModelListView) != null)
                                {
                                    ViewID = (modelView as IModelListView).Id;
                                    //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true);
                                    //objectSpace = resultFrame.Application.CreateObjectSpace();
                                    CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType);
                                    if (!colSource.IsLoaded)
                                    {
                                        colSource.Reload();
                                    }
                                    dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView;
                                }
                            }
                            else
                            {
                                // Если навигация определена в модели, а view не определено, то образуем DetailView по умолчанию
                                ViewID = Application.FindDetailViewId(ChoiceType);
                                dv     = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView;
                            }

                            ShowViewParameters svp = new ShowViewParameters();
                            svp.CreatedView          = dv;
                            svp.TargetWindow         = openMode;
                            svp.Context              = TemplateContext.View;
                            svp.CreateAllControllers = true;

                            e.InnerArgs.ShowViewParameters.Assign(svp);
                            return;
                        }
                    }
                }
            }


            // ПРОЧИЕ LISTVIEW
            // Грузим в отдельном окне

            e.Handled = false;
            openMode  = TargetWindow.NewWindow;
            if (Frame as NestedFrame != null | !View.IsRoot)
            {
                openMode = TargetWindow.NewModalWindow;
            }
            e.InnerArgs.ShowViewParameters.TargetWindow = openMode;
        }
Esempio n. 23
0
 public IEnumerable Getkeys(ListView listView)
 {
     return(listView.SelectedObjects.OfType <object>().Select(o => ObjectSpace.GetKeyValue(o)));
 }
Esempio n. 24
0
 public override void OnControllerActivated() {
     base.OnControllerActivated();
     listView = (ListView)Controller.View;
     OpenObjectAction.Active[
         DevExpress.ExpressApp.Win.SystemModule.OpenObjectController.ActiveKeyHasReadPermissionToTargetType] =
         DataManipulationRight.CanRead(listView.ObjectTypeInfo.Type, null, null, listView.CollectionSource,
                                       ObjectSpace);
     bool hasObjectRefControl = false;
     if (listView.Model != null) {
         if (
             listView.Model.Columns.Select(
                 columnInfo => listView.ObjectTypeInfo.FindMember(columnInfo.PropertyName)).Any(
                     findMember => findMember != null && IsDetailViewExists(findMember.MemberType))) {
             hasObjectRefControl = true;
         }
     }
     OpenObjectAction.Active[ViewContainsObjectEditorActiveKey] = hasObjectRefControl;
     listView.ControlsCreated += listView_ControlsCreated;
 }
Esempio n. 25
0
 public ListViewFilteringArgs(DashboardViewItem dashboardViewItem, IModelDashboardViewItemEx model, ListView dataSourceListView)
 {
     _dashboardViewItem  = dashboardViewItem;
     _model              = model;
     _dataSourceListView = dataSourceListView;
 }
Esempio n. 26
0
 public override void OnControllerDeactivated() {
     OpenObjectAction.Active.RemoveItem(
         DevExpress.ExpressApp.Win.SystemModule.OpenObjectController.ActiveKeyHasReadPermissionToTargetType);
     OpenObjectAction.Enabled.RemoveItem(HasReadPermissionToTargetObjectEnabledKey);
     listView.ControlsCreated -= listView_ControlsCreated;
     UnsubscribeFromGrid();
     listView = null;
     cursorHelper = null;
     grid = null;
     gridView = null;
     base.OnControllerDeactivated();
 }
Esempio n. 27
0
        protected void AfterPatientImportView_ControlsCreated(object sender, EventArgs e)
        {
            var items = (sender as DashboardView).Items;
            patientListView = (from DashboardViewItem edt in items
                               where edt.InnerView.ObjectTypeInfo.Type == typeof(IPatient)
                               select edt.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;

            GridListEditor editor = patientListView.Editor as GridListEditor;
            editor.ControlsCreated += (object send, EventArgs args) =>
            {
                if (editor != null)
                {
                    editor.Grid.HandleCreated += new EventHandler(AfterPatientImportGrid_HandleCreated);
                }
            };
        }
Esempio n. 28
0
 bool ShouldUseCustomImplementation(ListView listView) {
     return listView != null && listView.Editor is GridView.GridListEditorBase;
 }
Esempio n. 29
0
        private void CreateNewPatient(ActionBaseEventArgs e)
        {
            importPatient = Application.MainWindow.View.ObjectSpace.CreateObject<IPatient>();
            importPatient.LastName = importData.LastName;
            importPatient.FirstName = importData.FirstName;
            importPatient.MiddleName = importData.MiddleName;

            importPatient.Gender = importData.Gender;

            importPatient.Birthday = importData.BirthDate;
            //importPatient.MainPhoneNumber = importData.Phone;

            // Если одно из обязательных полей не заполнено
            if (importPatient.FirstName == string.Empty || importPatient.LastName == string.Empty ||
               importPatient.Gender == (Gender.Male & Gender.Female) || importPatient.Birthday < DateTime.Now.AddYears(-150) || importPatient.Birthday > DateTime.Now)
            {
                PopulateRequiredFields(e);
            }
            else
            {// если необходимые поля заполнены
                IExamination examination = Application.MainWindow.View.ObjectSpace.GetObject(importExamination);
                examination.Patient = importPatient;

                var items = (Application.MainWindow.View as DashboardView).Items;
                patientListView = (from DashboardViewItem item in items
                                   where item.InnerView.ObjectTypeInfo.Type == typeof(IPatient)
                                   select item.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;

                patientListView.CollectionSource.CollectionChanged += new EventHandler(CollectionSource_CollectionChanged);
                Application.MainWindow.View.ObjectSpace.CommitChanges();

                // Заполняем созданный файл заключения
                PopulateConclusionFile(examination);

                RefreshController refresh = Application.MainWindow.GetController<RefreshController>();
                refresh.RefreshAction.DoExecute();
            }//isNewPatientRequired
        }
 void RecreateListView(bool ifNotCreatedOnly) {
     if (ViewEditMode == ViewEditMode.Edit && (!ifNotCreatedOnly || listView == null)) {
         listView = null;
         if (CurrentObject != null) {
             listView = helper.CreateListView(CurrentObject);
         }
         Frame.SetView(listView);
     }
 }
Esempio n. 31
0
        private void UploadExaminationCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled == true || e.Error != null)
            {// если действие было отменено находим загружаемый объект и удаляем его из базы

                isImportCompleted = false;
                Application.MainWindow.View.ObjectSpace.Delete(Application.MainWindow.View.ObjectSpace.GetObject<IExamination>(importExamination));
                Application.MainWindow.View.ObjectSpace.CommitChanges();

                if (e.Cancelled == true)
                {
                    importWizard.CompletionPage.FinishText = CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportProcessCanceled");
                }
                else
                {
                    importWizard.CompletionPage.FinishText = CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportProcessError");
                }
            }

            else
            { // если файл успешно обработан
                isImportCompleted = true;
                //Guid guid = importExamination.ExaminationFile.Oid;
                //Application.MainWindow.View.ObjectSpace.GetObjectByKey<FileSystemStoreObject>(guid).Save(); //сохраняем объект

                if (isNewPatientRequired == true)
                {
                    importPatient = Application.MainWindow.View.ObjectSpace.CreateObject<IPatient>();
                    importPatient.LastName = importData.LastName;
                    importPatient.FirstName = importData.FirstName;
                    importPatient.MiddleName = importData.MiddleName;

                    importPatient.Gender = importData.Gender;

                    importPatient.Birthday = importData.BirthDate;

                    IExamination examination = Application.MainWindow.View.ObjectSpace.GetObject(importExamination);
                    examination.Patient = importPatient;

                    var items = (Application.MainWindow.View as DashboardView).Items;
                    patientListView = (from DashboardViewItem item in items
                                       where item.InnerView.ObjectTypeInfo.Type == typeof(IPatient)
                                       select item.InnerView).FirstOrDefault() as DevExpress.ExpressApp.ListView;

                    //patientListView.CollectionSource.CollectionChanged += new EventHandler(CollectionSource_CollectionChanged);

                    Application.MainWindow.View.ObjectSpace.CommitChanges();

                    // Заполняем созданный файл заключения
                    PopulateConclusionFile(examination);

                    importWizard.CompletionPage.FinishText = string.Format(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportPatientSuccsess"),
                        importExamination.ExaminationSoftType, importExamination.TimeStart);

                    UpdatePatientListView();

                    SetFocusOnNewPatient();
                }
                else
                {
                    importWizard.CompletionPage.FinishText = string.Format(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "PatientImportUpdateSuccess"),
                        importExamination.ExaminationSoftType, importExamination.TimeStart);

                    UpdateExaminationView();
                    SetFocusOnPatientAndExamination();

                }
                //CaptionHelper.GetLocalizedText("CustomFomrsMessages", "PatientImportUpdateSuccess");
            }

            progress.Close();
        }
 protected override void Dispose(bool disposing) {
     try {
         if (disposing) {
             if (newObjectWindowAction != null) {
                 newObjectWindowAction.Execute -= newObjectWindowAction_OnExecute;
                 newObjectWindowAction.CustomizePopupWindowParams -=
                     newObjectWindowAction_OnCustomizePopupWindowParams;
                 DisposeAction(newObjectWindowAction);
                 newObjectWindowAction = null;
             }
             if (newObjectViewController != null) {
                 newObjectViewController.ObjectCreating -= newObjectViewController_ObjectCreating;
                 newObjectViewController.ObjectCreated -= newObjectViewController_ObjectCreated;
                 newObjectViewController = null;
             }
             if (frame != null) {
                 frame.SetView(null);
                 frame.Dispose();
                 frame = null;
             }
             if (listView != null) {
                 listView.Dispose();
                 listView = null;
             }
             foreach (IObjectSpace createdObjectSpace in createdObjectSpaces) {
                 if (!createdObjectSpace.IsDisposed) {
                     createdObjectSpace.Dispose();
                 }
             }
             createdObjectSpaces.Clear();
             newObject = null;
             newObjectSpace = null;
         }
     } finally {
         base.Dispose(disposing);
     }
 }