Exemplo n.º 1
0
        /// <summary>
        /// If the Email preferences are not already in UserDefaults, this loads them.
        /// </summary>
        public static void LoadEmailDefaults()
        {
            if (!TUserDefaults.HasDefault("SmtpFromAccount") || (TUserDefaults.GetStringDefault("SmtpFromAccount") == ""))
            {
                TUserDefaults.SetDefault("SmtpFromAccount", TAppSettingsManager.GetValue("SmtpFromAccount", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpDisplayName") || (TUserDefaults.GetStringDefault("SmtpDisplayName") == ""))
            {
                TUserDefaults.SetDefault("SmtpDisplayName", TAppSettingsManager.GetValue("SmtpDisplayName", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpReplyTo"))
            {
                TUserDefaults.SetDefault("SmtpReplyTo", TAppSettingsManager.GetValue("SmtpReplyTo", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpCcTo"))
            {
                TUserDefaults.SetDefault("SmtpCcTo", TAppSettingsManager.GetValue("SmtpCcTo", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpEmailBody"))
            {
                TUserDefaults.SetDefault("SmtpEmailBody", TAppSettingsManager.GetValue("SmtpEmailBody", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpSendAsAttachment"))
            {
                TUserDefaults.SetDefault("SmtpSendAsAttachment", TAppSettingsManager.GetValue("SmtpSendAsAttachment", ""));
            }
        }
        public static bool LoadLanguageAndCultureFromUserDefaults()
        {
            if (TUserDefaults.HasDefault(MSysManConstants.USERDEFAULT_UILANGUAGE))
            {
                string LanguageCode = TUserDefaults.GetStringDefault(MSysManConstants.USERDEFAULT_UILANGUAGE);
                string CultureCode  = TUserDefaults.GetStringDefault(MSysManConstants.USERDEFAULT_UICULTURE);
                TLanguageCulture.SetLanguageAndCulture(LanguageCode, CultureCode);
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// If the Email preferences are not already in UserDefaults, this loads them.
        /// </summary>
        public static void LoadEmailDefaults()
        {
            if (!TUserDefaults.HasDefault("SmtpHost"))
            {
                TUserDefaults.SetDefault("SmtpHost", TAppSettingsManager.GetValue("SmtpHost", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpPort"))
            {
                TUserDefaults.SetDefault("SmtpPort", TAppSettingsManager.GetInt16("SmtpPort", -1));
            }

            if (!TUserDefaults.HasDefault("SmtpUseSsl"))
            {
                TUserDefaults.SetDefault("SmtpUseSsl", TAppSettingsManager.GetValue("SmtpEnableSsl", false));
            }

            if (!TUserDefaults.HasDefault("SmtpUser"))
            {
                TUserDefaults.SetDefault("SmtpUser", TAppSettingsManager.GetValue("SmtpUser", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpPassword"))
            {
                TUserDefaults.SetDefault("SmtpPassword", TAppSettingsManager.GetValue("SmtpPassword", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpEnableSsl"))
            {
                TUserDefaults.SetDefault("SmtpEnableSsl", TAppSettingsManager.GetBoolean("SmtpEnableSsl", false));
            }

            if (!TUserDefaults.HasDefault("SmtpFromAccount"))
            {
                TUserDefaults.SetDefault("SmtpFromAccount", TAppSettingsManager.GetValue("SmtpFromAccount", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpDisplayName"))
            {
                TUserDefaults.SetDefault("SmtpDisplayName", TAppSettingsManager.GetValue("SmtpDisplayName", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpReplyTo"))
            {
                TUserDefaults.SetDefault("SmtpReplyTo", TAppSettingsManager.GetValue("SmtpReplyTo", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpCcTo"))
            {
                TUserDefaults.SetDefault("SmtpCcTo", TAppSettingsManager.GetValue("SmtpCcTo", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpEmailBody"))
            {
                TUserDefaults.SetDefault("SmtpEmailBody", TAppSettingsManager.GetValue("SmtpEmailBody", ""));
            }

            if (!TUserDefaults.HasDefault("SmtpSendAsAttachment"))
            {
                TUserDefaults.SetDefault("SmtpSendAsAttachment", TAppSettingsManager.GetValue("SmtpSendAsAttachment", ""));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create new partner, family, location and PartnerLocation records in MainDS
        /// </summary>
        private static Int64 CreateNewFamily(XmlNode ANode, out int ALocationKey, ref PartnerImportExportTDS AMainDS)
        {
            PPartnerRow newPartner = AMainDS.PPartner.NewRowTyped();

            AMainDS.PPartner.Rows.Add(newPartner);

            newPartner.PartnerKey   = (AMainDS.PPartner.Rows.Count + 1) * -1;
            newPartner.PartnerClass = MPartnerConstants.PARTNERCLASS_FAMILY;
            newPartner.StatusCode   = MPartnerConstants.PARTNERSTATUS_ACTIVE;
            newPartner.Comment      = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_NOTESFAMILY);

            String AcquisitionCode = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_AQUISITION);

            newPartner.AcquisitionCode = (AcquisitionCode.Length > 0) ? AcquisitionCode : MPartnerConstants.PARTNERIMPORT_AQUISITION_DEFAULT;

            newPartner.AddresseeTypeCode = MPartnerConstants.ADDRESSEETYPE_DEFAULT;

            if (TXMLParser.HasAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ADDRESSEE_TYPE))
            {
                newPartner.AddresseeTypeCode = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ADDRESSEE_TYPE);
            }
            else
            {
                string gender = GetGenderCode(ANode);

                if (gender == MPartnerConstants.GENDER_MALE)
                {
                    newPartner.AddresseeTypeCode = MPartnerConstants.ADDRESSEETYPE_MALE;
                }
                else if (gender == MPartnerConstants.GENDER_FEMALE)
                {
                    newPartner.AddresseeTypeCode = MPartnerConstants.ADDRESSEETYPE_FEMALE;
                }
            }

            if (TXMLParser.HasAttribute(ANode, MPartnerConstants.PARTNERIMPORT_LANGUAGE))
            {
                newPartner.LanguageCode = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_LANGUAGE);
            }
            else if (TUserDefaults.HasDefault(MSysManConstants.PARTNER_LANGUAGECODE))
            {
                newPartner.LanguageCode = TUserDefaults.GetStringDefault(MSysManConstants.PARTNER_LANGUAGECODE);
            }

            string[] giftReceiptingDefaults = TSystemDefaults.GetSystemDefault("GiftReceiptingDefaults", ",no").Split(new char[] { ',' });
            newPartner.ReceiptLetterFrequency = giftReceiptingDefaults[0];
            newPartner.ReceiptEachGift        = giftReceiptingDefaults[1] == "YES" || giftReceiptingDefaults[1] == "TRUE";


            PFamilyRow newFamily = AMainDS.PFamily.NewRowTyped();

            AMainDS.PFamily.Rows.Add(newFamily);

            newFamily.PartnerKey    = newPartner.PartnerKey;
            newFamily.FirstName     = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_FIRSTNAME);
            newFamily.FamilyName    = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_FAMILYNAME);
            newFamily.MaritalStatus = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_MARITALSTATUS);
            newFamily.Title         = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_TITLE);
            newFamily.MaritalStatus = GetMaritalStatusCode(ANode);

            newPartner.PartnerShortName = Calculations.DeterminePartnerShortName(newFamily.FamilyName, newFamily.Title, newFamily.FirstName);
            PLocationRow newLocation = AMainDS.PLocation.NewRowTyped(true);

            AMainDS.PLocation.Rows.Add(newLocation);
            newLocation.LocationKey = TPartnerImportCSV.FLocationKey;
            newLocation.Locality    = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_LOCALITY);
            newLocation.StreetName  = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_STREETNAME);
            newLocation.Address3    = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ADDRESS);
            newLocation.PostalCode  = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_POSTALCODE);
            newLocation.City        = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_CITY);
            newLocation.County      = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_COUNTY);
            newLocation.CountryCode = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_COUNTRYCODE);

            PPartnerLocationRow partnerlocation = AMainDS.PPartnerLocation.NewRowTyped(true);

            partnerlocation.LocationKey     = TPartnerImportCSV.FLocationKey;
            partnerlocation.SiteKey         = 0;
            partnerlocation.PartnerKey      = newPartner.PartnerKey;
            partnerlocation.DateEffective   = DateTime.Now;
            partnerlocation.LocationType    = MPartnerConstants.LOCATIONTYPE_HOME;
            partnerlocation.SendMail        = true;
            partnerlocation.EmailAddress    = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_EMAIL);
            partnerlocation.TelephoneNumber = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_PHONE);
            partnerlocation.MobileNumber    = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_MOBILEPHONE);
            AMainDS.PPartnerLocation.Rows.Add(partnerlocation);

            ALocationKey = TPartnerImportCSV.FLocationKey;
            TPartnerImportCSV.FLocationKey--;
            return(newPartner.PartnerKey);
        }