示例#1
0
        public static void AddUserRef(this IGDMStructWithUserReferences _struct, string reference)
        {
            GDMUserReference uRef = new GDMUserReference();

            uRef.StringValue = reference;
            _struct.UserReferences.Add(uRef);
        }
示例#2
0
        public override void Setup()
        {
            fBase    = new BaseWindowStub();
            fUserRef = new GDMUserReference();

            fDialog         = new UserRefEditDlg(fBase);
            fDialog.UserRef = fUserRef;
            fDialog.Show();
        }
示例#3
0
        // Returns a string to use as a sFilename for this individual's HTML page.
        // The string is just the sFilename, not a fully qualified path.
        protected static string GetIndividualHTMLFilename(GDMIndividualRecord ir)
        {
            string relativeFilename = string.Concat("indi", ir.XRef, ".", GMConfig.Instance.HtmlExtension);

            if (GMConfig.Instance.UserRecFilename && ir.HasUserReferences)
            {
                GDMUserReference urn             = ir.UserReferences[0];
                string           filenameUserRef = EscapeFilename(urn.StringValue);
                if (filenameUserRef.Length > 0)
                {
                    relativeFilename = string.Concat("indi", filenameUserRef, ".", GMConfig.Instance.HtmlExtension);
                }
            }
            return(relativeFilename);
        }
示例#4
0
        private bool ProcessIndividualURef(bool redo)
        {
            GDMIndividualRecord iRec = fObj as GDMIndividualRecord;
            GDMUserReference    uRef = fNewVal as GDMUserReference;

            if (iRec == null || uRef == null)
            {
                return(false);
            }

            if (fType == OperationType.otIndividualURefRemove)
            {
                redo = !redo;
            }
            if (redo)
            {
                iRec.UserReferences.Add(uRef);
            }
            else
            {
                iRec.UserReferences.Extract(uRef);
            }
            return(true);
        }
示例#5
0
 private static void CheckURefCompatible(GDMIndividualRecord iRec, GDMUserReference userRef)
 {
 }
示例#6
0
        public override void Modify(object sender, ModifyEventArgs eArgs)
        {
            var iRec = fDataOwner as GDMIndividualRecord;

            if (fBaseWin == null || fSheetList == null || iRec == null)
            {
                return;
            }

            GDMUserReference userRef = eArgs.ItemData as GDMUserReference;

            bool result = false;

            switch (eArgs.Action)
            {
            case RecordAction.raAdd:
            case RecordAction.raEdit:
                using (var dlg = AppHost.ResolveDialog <IUserRefEditDlg>(fBaseWin)) {
                    bool exists = (userRef != null);
                    if (!exists)
                    {
                        userRef = new GDMUserReference();
                    }

                    dlg.UserRef = userRef;
                    result      = AppHost.Instance.ShowModalX(dlg, false);

                    if (!exists)
                    {
                        if (result)
                        {
                            result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualURefAdd, iRec, userRef);
                        }
                        else
                        {
                            userRef.Dispose();
                        }
                    }
                }
                break;

            case RecordAction.raDelete:
            {
                string confirmation =
                    !string.IsNullOrEmpty(userRef.StringValue) ? userRef.StringValue : userRef.ReferenceType;
                confirmation = string.Format(
                    LangMan.LS(LSID.LSID_RemoveUserRefQuery), confirmation);
                if (AppHost.StdDialogs.ShowQuestionYN(confirmation))
                {
                    result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualURefRemove, iRec, userRef);
                    fBaseWin.Context.Modified = true;
                }
                break;
            }
            }

            if (result)
            {
                fBaseWin.Context.Modified = true;
                eArgs.IsChanged           = true;
            }
        }
示例#7
0
 private void CheckUserRef(GDMIndividualRecord iRec, GDMUserReference userRef)
 {
 }
示例#8
0
 private void CheckUserRef(GDMRecord rec, GDMUserReference userRef)
 {
 }