예제 #1
0
 public FriendsListsController(WebSportContext context, IBaseContext baseContext,
                               UserManager <ApplicationUser> userManager)
 {
     _context     = context;
     _baseContext = baseContext;
     _userManager = userManager;
 }
예제 #2
0
 protected ListSource(IBaseContext baseContext, ListColumns defaultListColumns)
 {
     fAllowedActions = new EnumSet <RecordAction>();
     fBaseContext    = baseContext;
     fColumnsMap     = new List <MapColumnRec>();
     fListColumns    = defaultListColumns;
 }
예제 #3
0
        private static void CheckPersonalName(IBaseContext baseContext, GDMTree tree, GEDCOMFormat format, GDMPersonalName persName)
        {
            CheckTagWithNotes(tree, format, persName);
            CheckTagWithSourceCitations(tree, format, persName);

            baseContext.CollectNameLangs(persName);
        }
예제 #4
0
 private void ProcessLoaded(IBaseContext context)
 {
     if (GlobalOptions.Instance.ShowTips)
     {
         context.CollectTips(fTips);
     }
 }
예제 #5
0
        public static GKListView CreateRecordsView(Control parent, IBaseContext baseContext, GDMRecordType recType)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            if (baseContext == null)
            {
                throw new ArgumentNullException("baseContext");
            }

            GKListView recView = new GKListView();

            recView.HideSelection = false;
            recView.LabelEdit     = false;
            recView.FullRowSelect = true;
            recView.View          = View.Details;
            recView.ListMan       = ListManager.Create(baseContext, recType);
            recView.Dock          = DockStyle.Fill;

            parent.Controls.Add(recView);
            parent.Controls.SetChildIndex(recView, 0);

            return(recView);
        }
예제 #6
0
 private GEDCOMChecker(IBaseContext baseContext, IProgressController progress)
 {
     fBaseContext = baseContext;
     fTree        = fBaseContext.Tree;
     fFormat      = GEDCOMProvider.GetGEDCOMFormat(fTree);
     fProgress    = progress;
 }
예제 #7
0
        private static void CheckFamilyRecord(IBaseContext baseContext, GDMTree tree, GEDCOMFormat format,
                                              GDMFamilyRecord fam)
        {
            for (int i = 0, num = fam.Events.Count; i < num; i++)
            {
                GDMCustomEvent evt = fam.Events[i];

                CheckEvent(tree, format, evt);
            }

            for (int i = fam.Children.Count - 1; i >= 0; i--)
            {
                if (fam.Children[i].Value == null)
                {
                    fam.Children.DeleteAt(i);
                }
            }

            GDMRecord val = fam.Husband.Value;

            if (!string.IsNullOrEmpty(fam.Husband.XRef) && val == null)
            {
                fam.Husband.Value = null;
            }

            val = fam.Wife.Value;
            if (!string.IsNullOrEmpty(fam.Wife.XRef) && val == null)
            {
                fam.Wife.Value = null;
            }
        }
예제 #8
0
        public void ImportNames(IBaseContext context, GDMIndividualRecord iRec)
        {
            if (context == null || iRec == null)
            {
                return;
            }

            try {
                string childName, childPat;
                var    parts = GKUtils.GetNameParts(context.Tree, iRec, false);
                childName = parts.Name;
                childPat  = parts.Patronymic;

                GDMSex iSex = iRec.Sex;
                SetNameSex(childName, iSex);

                GDMFamilyRecord     fam    = context.Tree.GetParentsFamily(iRec);
                GDMIndividualRecord father = (fam == null) ? null : context.Tree.GetPtrValue(fam.Husband);

                if (father != null)
                {
                    string fatherName;
                    parts      = GKUtils.GetNameParts(context.Tree, father, false);
                    fatherName = parts.Name;

                    if (IsComparable(fatherName, childPat))
                    {
                        SetName(fatherName, childPat, iSex);
                    }
                }
            } catch (Exception ex) {
                Logger.WriteError("NamesTable.ImportName()", ex);
            }
        }
예제 #9
0
 public BaseService(IBaseContext baseContext)
 {
     this._baseContext = baseContext;
     //this._customerContext = customerContext;
     this.serviceResult          = new ServiceResult();
     this.serviceResult.MISACode = MisaCode.Susscess;
 }
예제 #10
0
 public BaseWinController(IBaseWindowView view) : base(view)
 {
     fContext        = new BaseContext(view);
     fChangedRecords = new List <GDMRecord>();
     fNavman         = new NavigationStack <GDMRecord>();
     fTabParts       = new TabParts[(int)GDMRecordType.rtLast + 1];
 }
        public static void RelationshipCalculatorDlg_Handler(string name, IntPtr ptr, Form form)
        {
            RelationshipCalculatorDlg dlg = (RelationshipCalculatorDlg)form;
            IBaseContext baseContext = dlg.Base.Context;

            Assert.IsTrue(baseContext.Tree.RecordsCount > 1);

            GDMIndividualRecord iRec1 = baseContext.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;
            Assert.IsNotNull(iRec1);
            Assert.AreEqual("Ivanov Ivan Ivanovich", GKUtils.GetRecordName(baseContext.Tree, iRec1, false));
            GDMIndividualRecord iRec2 = baseContext.Tree.XRefIndex_Find("I2") as GDMIndividualRecord;
            Assert.IsNotNull(iRec2);
            Assert.AreEqual("Ivanova Maria Petrovna", GKUtils.GetRecordName(baseContext.Tree, iRec2, false));

            WFAppHost.TEST_MODE = true; // FIXME: dirty hack

            RecordSelectDlgTests.SetSelectItemHandler(0);
            ClickButton("btnRec1Select", form);
            RecordSelectDlgTests.SetSelectItemHandler(1);
            ClickButton("btnRec2Select", form);

            var txtResult = new TextBoxTester("txtResult", form);
            // default is not Russian culture
            Assert.AreEqual("Ivanova Maria Petrovna is wife of Ivanov Ivan Ivanovich", txtResult.Text); // :D

            ClickButton("btnClose", form);
        }
예제 #12
0
        private static void SearchKGInt(IBaseContext context, Vertex prevNode, GDMIndividualRecord iRec,
                                        KinshipsGraph graph, RelationKind relation, RelationKind inverseRelation)
        {
            if (iRec == null)
            {
                return;
            }

            Vertex currNode = graph.FindVertex(iRec.XRef);

            if (currNode != null)
            {
                if (prevNode != null)
                {
                    graph.AddRelation(prevNode, currNode, relation, inverseRelation);
                }

                return;
            }
            else
            {
                currNode = graph.AddIndividual(iRec);

                if (prevNode != null)
                {
                    graph.AddRelation(prevNode, currNode, relation, inverseRelation);
                }
            }

            if (iRec.ChildToFamilyLinks.Count > 0)
            {
                GDMFamilyRecord fam = context.Tree.GetParentsFamily(iRec);
                if (fam != null)
                {
                    GDMIndividualRecord father, mother;
                    father = context.Tree.GetPtrValue(fam.Husband);
                    mother = context.Tree.GetPtrValue(fam.Wife);

                    SearchKGInt(context, currNode, father, graph, RelationKind.rkParent, RelationKind.rkChild);
                    SearchKGInt(context, currNode, mother, graph, RelationKind.rkParent, RelationKind.rkChild);
                }
            }

            int num = iRec.SpouseToFamilyLinks.Count;

            for (int i = 0; i < num; i++)
            {
                GDMFamilyRecord     family = context.Tree.GetPtrValue(iRec.SpouseToFamilyLinks[i]);
                GDMIndividualRecord spouse = (iRec.Sex == GDMSex.svMale) ? context.Tree.GetPtrValue(family.Wife) : context.Tree.GetPtrValue(family.Husband);

                SearchKGInt(context, currNode, spouse, graph, RelationKind.rkSpouse, RelationKind.rkSpouse);

                int num2 = family.Children.Count;
                for (int j = 0; j < num2; j++)
                {
                    GDMIndividualRecord child = context.Tree.GetPtrValue(family.Children[j]);
                    SearchKGInt(context, currNode, child, graph, RelationKind.rkChild, RelationKind.rkParent);
                }
            }
        }
예제 #13
0
        private static void CheckRecord(IBaseContext baseContext, GDMTree tree, GDMRecord rec,
                                        GEDCOMFormat format, int fileVer)
        {
            CheckStructWL(tree, format, rec);

            switch (rec.RecordType)
            {
            case GDMRecordType.rtIndividual:
                CheckIndividualRecord(baseContext, tree, format, rec as GDMIndividualRecord);
                break;

            case GDMRecordType.rtFamily:
                CheckFamilyRecord(baseContext, tree, format, rec as GDMFamilyRecord);
                break;

            case GDMRecordType.rtGroup:
                CheckGroupRecord(rec as GDMGroupRecord);
                break;

            case GDMRecordType.rtSource:
                CheckSourceRecord(rec as GDMSourceRecord);
                break;

            case GDMRecordType.rtMultimedia:
                CheckMultimediaRecord(rec as GDMMultimediaRecord, format, fileVer);
                break;
            }
        }
예제 #14
0
        public static ExtList <PatriarchObj> GetPatriarchsLinks(IBaseContext context,
                                                                int gensMin, bool datesCheck,
                                                                bool loneSuppress)
        {
            ExtList <PatriarchObj> patList = GetPatriarchsList(context, gensMin, datesCheck);

            IProgressController progress = AppHost.Progress;

            progress.ProgressInit(LangMan.LS(LSID.LSID_LinksSearch), patList.Count);
            try
            {
                int num2 = patList.Count;
                for (int i = 0; i < num2; i++)
                {
                    PatriarchObj patr = patList[i];

                    for (int j = i + 1; j < num2; j++)
                    {
                        PatriarchObj patr2 = patList[j];

                        GEDCOMIndividualRecord cross = TreeTools.PL_SearchDesc(patr.IRec, patr2.IRec);
                        if (cross != null)
                        {
                            patr.HasLinks  = true;
                            patr2.HasLinks = true;

                            if (cross.Sex == GEDCOMSex.svFemale)
                            {
                                patr.Links.Add(patr2);
                            }
                            else
                            {
                                patr2.Links.Add(patr);
                            }
                        }
                    }

                    progress.ProgressStep();
                }
            }
            finally
            {
                progress.ProgressDone();
            }

            if (loneSuppress)
            {
                for (int i = patList.Count - 1; i >= 0; i--)
                {
                    PatriarchObj patr = patList[i];
                    if (!patr.HasLinks)
                    {
                        patList.Delete(i);
                    }
                }
                patList.Pack();
            }

            return(patList);
        }
예제 #15
0
        private static void CheckRecord(IBaseContext baseContext, GDMTree tree, GDMRecord rec,
                                        GEDCOMFormat format, int fileVer)
        {
            if (format != GEDCOMFormat.gf_Native)
            {
                int num = rec.MultimediaLinks.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMMultimediaLink mmLink = rec.MultimediaLinks[i];
                    if (!mmLink.IsPointer)
                    {
                        TransformMultimediaLink(tree, mmLink);
                    }
                }

                num = rec.Notes.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMNotes note = rec.Notes[i];
                    if (!note.IsPointer)
                    {
                        TransformNote(tree, note);
                    }
                }

                num = rec.SourceCitations.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMSourceCitation sourCit = rec.SourceCitations[i];
                    if (!sourCit.IsPointer)
                    {
                        TransformSourceCitation(tree, sourCit);
                    }
                }
            }

            switch (rec.RecordType)
            {
            case GDMRecordType.rtIndividual:
                CheckIndividualRecord(baseContext, tree, format, rec as GDMIndividualRecord);
                break;

            case GDMRecordType.rtFamily:
                CheckFamilyRecord(baseContext, tree, format, rec as GDMFamilyRecord);
                break;

            case GDMRecordType.rtGroup:
                CheckGroupRecord(rec as GDMGroupRecord);
                break;

            case GDMRecordType.rtSource:
                CheckSourceRecord(rec as GDMSourceRecord);
                break;

            case GDMRecordType.rtMultimedia:
                CheckMultimediaRecord(rec as GDMMultimediaRecord, format, fileVer);
                break;
            }
        }
        public UnitOfWork()
        {
            _context = new BaseContext();
            var bulkWorker = new BulkWorker <ModelBase>(_context);

            RepositoryBase  = new Repository.Base.RepositoryBase <ModelBase>(_context, bulkWorker);
            StoredProcedure = new StoredProcedureRepository(_context);
        }
예제 #17
0
        protected ListManager(IBaseContext baseContext, ListColumns defaultListColumns, GEDCOMRecordType recordType) :
            base(baseContext, defaultListColumns)
        {
            fContentList = new List <ValItem>();
            fRecordType  = recordType;

            CreateFilter();
        }
예제 #18
0
        public GenericRepository(IUnitOfWork unitOfWork, IBaseContext context)
        {
            // register this repository with the unit of work.
            unitOfWork.Register(this);

            // Because Entityframeworks dbcontext does not have an interface cast it to basecontext.
            Context = (BaseContext)context;
        }
예제 #19
0
        public static ExtList <PatriarchObj> GetPatriarchsList(IBaseContext context,
                                                               int gensMin, bool datesCheck)
        {
            ExtList <PatriarchObj> patList = new ExtList <PatriarchObj>(true);

            IProgressController progress = AppHost.Progress;

            progress.ProgressInit(LangMan.LS(LSID.LSID_PatSearch), context.Tree.RecordsCount);

            GKUtils.InitExtCounts(context.Tree, -1);
            try
            {
                int num = context.Tree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = context.Tree[i];

                    if (rec is GEDCOMIndividualRecord)
                    {
                        GEDCOMIndividualRecord iRec = rec as GEDCOMIndividualRecord;

                        var parts = GKUtils.GetNameParts(iRec);

                        int birthDate = context.FindBirthYear(iRec);
                        int descGens  = GKUtils.GetDescGenerations(iRec);

                        bool res = (iRec.ChildToFamilyLinks.Count == 0);
                        res = (res && iRec.Sex == GEDCOMSex.svMale);
                        res = (res && /*nf != "" && nf != "?" &&*/ parts.Name != "" && parts.Name != "?");
                        res = (res && descGens >= gensMin);

                        if (datesCheck)
                        {
                            res = (res && birthDate != 0);
                        }

                        if (res)
                        {
                            PatriarchObj pObj = new PatriarchObj();
                            pObj.IRec             = iRec;
                            pObj.BirthYear        = birthDate;
                            pObj.DescendantsCount = GKUtils.GetDescendantsCount(iRec) - 1;
                            pObj.DescGenerations  = descGens;
                            patList.Add(pObj);
                        }
                    }

                    progress.ProgressStep();
                }
            }
            finally
            {
                progress.ProgressDone();
            }

            return(patList);
        }
예제 #20
0
        private static void CheckIndividualRecord(IBaseContext baseContext, GDMTree tree, GEDCOMFormat format,
                                                  GDMIndividualRecord iRec)
        {
            for (int i = 0, num = iRec.Events.Count; i < num; i++)
            {
                GDMCustomEvent evt = iRec.Events[i];

                CheckEvent(tree, format, evt);

                baseContext.CollectEventValues(evt);
            }

            for (int i = 0, num = iRec.UserReferences.Count; i < num; i++)
            {
                CheckUserRef(iRec, iRec.UserReferences[i]);
            }

            for (int i = 0, num = iRec.PersonalNames.Count; i < num; i++)
            {
                CheckPersonalName(baseContext, tree, format, iRec.PersonalNames[i]);
            }

            for (int i = iRec.ChildToFamilyLinks.Count - 1; i >= 0; i--)
            {
                var cfl = iRec.ChildToFamilyLinks[i];
                if (cfl.Family == null)
                {
                    iRec.ChildToFamilyLinks.DeleteAt(i);
                }
                else
                {
                    CheckPointerWithNotes(tree, format, cfl);
                }
            }

            for (int i = iRec.SpouseToFamilyLinks.Count - 1; i >= 0; i--)
            {
                var sfl = iRec.SpouseToFamilyLinks[i];
                if (sfl.Family == null)
                {
                    iRec.SpouseToFamilyLinks.DeleteAt(i);
                }
                else
                {
                    CheckPointerWithNotes(tree, format, sfl);
                }
            }

            for (int i = 0, num = iRec.Associations.Count; i < num; i++)
            {
                var asso = iRec.Associations[i];
                CheckPointerWithNotes(tree, format, asso);
                CheckTagWithSourceCitations(tree, format, asso);
            }

            baseContext.ImportNames(iRec);
        }
예제 #21
0
 public BaseWindowStub(bool fill = true)
 {
     fContext = TestUtils.CreateContext(/*this*/);
     if (fill)
     {
         TestUtils.FillContext(fContext);
     }
     fTree = fContext.Tree;
 }
예제 #22
0
        public override void Setup()
        {
            fBase    = new BaseWindowStub();
            fContext = fBase.Context;
            fListMan = new IndividualListMan(fContext);

            fDialog = new CommonFilterDlg(fBase, fListMan);
            fDialog.Show();
        }
예제 #23
0
        public override void Setup()
        {
            fBase           = new BaseWindowStub();
            fContext        = fBase.Context;
            fMultimediaLink = new GDMMultimediaLink();

            fDialog = new PortraitSelectDlg(fBase);
            fDialog.MultimediaLink = fMultimediaLink;
            fDialog.Show();
        }
예제 #24
0
        public override void Setup()
        {
            fBase                = new BaseWindowStub();
            fContext             = fBase.Context;
            fCommunicationRecord = new GDMCommunicationRecord(fContext.Tree);

            fDialog = new CommunicationEditDlg(fBase);
            fDialog.Communication = fCommunicationRecord;
            fDialog.Show();
        }
예제 #25
0
파일: BaseDAO.cs 프로젝트: xavl369/UGRS
 protected virtual void Dispose(bool pBolDisposing)
 {
     if (pBolDisposing)
     {
         if (mObjContext != null)
         {
             mObjContext.Dispose();
             mObjContext = null;
         }
     }
 }
예제 #26
0
        public IImage GetImage(IBaseContext context, GEDCOMIndividualRecord iRec)
        {
            if (context == null || iRec == null)
            {
                return(null);
            }

            IImage result = null;

            // get multimedia UID
            string imageUID = context.GetPrimaryBitmapUID(iRec);

            // portrait doesn't define for individual
            if (string.IsNullOrEmpty(imageUID))
            {
                return(null);
            }

            string cachedFile = GetCachedFilename(imageUID);

            // check in-memory cache
            if (fMemoryCache.TryGetValue(cachedFile, out result))
            {
                return(result);
            }

            // in-memory cache doesn't contain image
            // check cache folder by multimedia UID
            if (File.Exists(cachedFile))
            {
                result = AppHost.GfxProvider.LoadImage(cachedFile);
            }

            // if cache doesn't contain the image, then load and save it to cache
            if (result == null)
            {
                result = context.GetPrimaryBitmap(iRec, -1, -1, true);

                // save image to cache
                if (result != null)
                {
                    AppHost.GfxProvider.SaveImage(result, cachedFile);
                }
            }

            // put new image from disk's cache or storage to memory cache
            if (result != null)
            {
                fMemoryCache.Add(cachedFile, result);
            }

            // return result image
            return(result);
        }
예제 #27
0
        public override void Setup()
        {
            base.Setup();

            fBase           = new BaseWindowStub();
            fContext        = fBase.Context;
            fMultimediaLink = new GEDCOMMultimediaLink(fContext.Tree, null, "", "");

            fDialog = new PortraitSelectDlg(fBase);
            fDialog.MultimediaLink = fMultimediaLink;
            fDialog.Show();
        }
예제 #28
0
        public override void Setup()
        {
            WFAppHost.ConfigureBootstrap(false);

            fBase        = new BaseWindowStub();
            fContext     = fBase.Context;
            fChartFilter = new ChartFilter();

            fDialog        = new TreeFilterDlg(fBase);
            fDialog.Filter = fChartFilter;
            fDialog.Show();
        }
예제 #29
0
        public override void Setup()
        {
            base.Setup();

            fBase        = new BaseWindowMock();
            fContext     = fBase.Context;
            fChartFilter = new ChartFilter();

            fDialog        = new TreeFilterDlg(fBase);
            fDialog.Filter = fChartFilter;
            fDialog.Show();
        }
예제 #30
0
        public override void Setup()
        {
            base.Setup();

            fBase    = new BaseWindowStub();
            fContext = fBase.Context;
            fListMan = new IndividualListMan(fContext);

            //ExpectModal("CommonFilterDlg", "DlgHandler");
            fDialog = new CommonFilterDlg(fBase, fListMan);
            //fDialog.ShowDialog();
            fDialog.Show();
        }
예제 #31
0
 public HomeController(IBaseContext context) : base(context) { }
예제 #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthenticationController"/> class.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public AuthenticationController(IBaseContext context) : base(context)
 {
 }
예제 #33
0
 public CompetitionsController(IBaseContext context) : base(context) { }
예제 #34
0
 public UsersController(IBaseContext context) :base(context) { }
예제 #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseController"/> class.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public BaseController(IBaseContext context)
 {
     _context = context;
 }