コード例 #1
0
ファイル: ProgramStructured.cs プロジェクト: KPratap/Yardi
        private static string ExtractTenantInfo(XElement tenant)
        {
            List<string> st = new List<string>();
            string ret = string.Empty;
            var temp = GetElements("Tenants");
            if (temp == null)
                return ret;
            // gather up phone numbers
            PhoneNumbers ph = new PhoneNumbers();
            if (tenant.Descendants("PersonDetails")!= null)
                ph.GetIdValues(tenant.Descendants("PersonDetails").FirstOrDefault());
            // gather up addresses
            Addresses addr = new Addresses();
            if (tenant.Descendants("PersonDetails") != null)
                addr.GetIdValues(tenant.Descendants("PersonDetails").FirstOrDefault());

            TenantCustoms tc = new TenantCustoms();
            if (tenant.Descendants("CustomRecords") != null)
                tc.GetIdValues(tenant);

            st.Add("TENANT");

            foreach (XElement de in temp)
            {
                if (de.Attribute("phonetype") != null )
                {
                    if (ph.IdValues.ContainsKey(de.Attribute("phonetype").Value))
                        st.Add(ph.IdValues[de.Attribute("phonetype").Value]);
                    else
                        st.Add(string.Empty);
                }
                else
                    if (de.Attribute("addresstype") != null)
                    {
                        if (addr.IdValues.ContainsKey(de.Attribute("addresstype").Value))
                        {
                            if (de.Attribute("location").Value.Contains("Address/Address"))
                                st.Add(addr.IdValues[de.Attribute("addresstype").Value].Street);
                            if (de.Attribute("location").Value.Contains("Address/City"))
                                st.Add(addr.IdValues[de.Attribute("addresstype").Value].City);
                            if (de.Attribute("location").Value.Contains("Address/State"))
                                st.Add(addr.IdValues[de.Attribute("addresstype").Value].State);
                            if (de.Attribute("location").Value.Contains("Address/PostalCode"))
                                st.Add(addr.IdValues[de.Attribute("addresstype").Value].PostalCode);
                            if (de.Attribute("location").Value.Contains("Address/Email"))
                                st.Add(addr.IdValues[de.Attribute("addresstype").Value].Email);
                        }
                        else
                        {
                            if (de.Attribute("location").Value.Contains("Address/Address"))
                                st.Add(string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/City"))
                                st.Add(string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/State"))
                                st.Add(string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/PostalCode"))
                                st.Add(string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/Email"))
                                st.Add(string.Empty);
                        }
                    }
                    else if (de.Attribute("location").Value.Contains("CustomRecords/Other"))
                    {
                        if (de.Attribute("location").Value == "CustomRecords/Other1")
                            st.Add(tc.IdValues.Other1Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other2")
                            st.Add(tc.IdValues.Other2Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other3")
                            st.Add(tc.IdValues.Other3Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other4")
                            st.Add(tc.IdValues.Other4Val);
                    }
                    else
                        st.Add(GetItem(de.Attribute("location").Value, tenant));
            }
            return string.Join("|", st);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: KPratap/Yardi
        private static Dictionary<string, string> ExtractTenantInfo(XElement tenant, bool primaryTenant=false)
        {
            Dictionary<string, string> st = new Dictionary<string, string>();
            var temp = GetElements("Tenants");
            if (temp == null)
                return st;
            // gather up phone numbers
            PhoneNumbers ph = new PhoneNumbers();
            if (tenant.Descendants("PersonDetails")!= null)
                ph.GetIdValues(tenant.Descendants("PersonDetails").FirstOrDefault());
            // gather up addresses
            Addresses addr = new Addresses();
            if (tenant.Descendants("PersonDetails") != null)
                addr.GetIdValues(tenant.Descendants("PersonDetails").FirstOrDefault());

            TenantCustoms tc = new TenantCustoms();
            if (tenant.Descendants("CustomRecords") != null)
                tc.GetIdValues(tenant);

            foreach (XElement de in temp)
            {
                if (de.Attribute("phonetype") != null )
                {
                    if (ph.IdValues.ContainsKey(de.Attribute("phonetype").Value))
                        st.Add(de.Attribute("outputname").Value, ph.IdValues[de.Attribute("phonetype").Value]);
                    else
                        st.Add(de.Attribute("outputname").Value, string.Empty);
                }
                else
                    if (de.Attribute("addresstype") != null)
                    {
                        if (addr.IdValues.ContainsKey(de.Attribute("addresstype").Value))
                        {
                            if (de.Attribute("location").Value.Contains("Address/Address"))
                                st.Add(de.Attribute("outputname").Value, addr.IdValues[de.Attribute("addresstype").Value].Street);
                            if (de.Attribute("location").Value.Contains("Address/City"))
                                st.Add(de.Attribute("outputname").Value, addr.IdValues[de.Attribute("addresstype").Value].City);
                            if (de.Attribute("location").Value.Contains("Address/State"))
                                st.Add(de.Attribute("outputname").Value, addr.IdValues[de.Attribute("addresstype").Value].State);
                            if (de.Attribute("location").Value.Contains("Address/PostalCode"))
                                st.Add(de.Attribute("outputname").Value, addr.IdValues[de.Attribute("addresstype").Value].PostalCode);
                            if (de.Attribute("location").Value.Contains("Address/Email"))
                                st.Add(de.Attribute("outputname").Value, addr.IdValues[de.Attribute("addresstype").Value].Email);
                        }
                        else
                        {
                            if (de.Attribute("location").Value.Contains("Address/Address"))
                                st.Add(de.Attribute("outputname").Value, string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/City"))
                                st.Add(de.Attribute("outputname").Value, string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/State"))
                                st.Add(de.Attribute("outputname").Value, string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/PostalCode"))
                                st.Add(de.Attribute("outputname").Value, string.Empty);
                            if (de.Attribute("location").Value.Contains("Address/Email"))
                                st.Add(de.Attribute("outputname").Value, string.Empty);
                        }
                    }
                    else if (de.Attribute("location").Value.Contains("CustomRecords/Other"))
                    {
                        if (de.Attribute("location").Value == "CustomRecords/Other1")
                            if (primaryTenant) st.Add(de.Attribute("outputname").Value, tc.IdValues.Other1Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other2")
                            if (primaryTenant) st.Add(de.Attribute("outputname").Value, tc.IdValues.Other2Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other3")
                            if (primaryTenant) st.Add(de.Attribute("outputname").Value, tc.IdValues.Other3Val);
                        if (de.Attribute("location").Value == "CustomRecords/Other4")
                            if (primaryTenant) st.Add(de.Attribute("outputname").Value, tc.IdValues.Other4Val);
                    }
                    else if (primaryTenant)
                            st.Add(de.Attribute("outputname").Value, GetItem(de.Attribute("location").Value, tenant));
                    else if (!primaryTenant)
                    {
                        if (!de.Attribute("location").Value.StartsWith("Contact/"))
                            st.Add(de.Attribute("outputname").Value, GetItem(de.Attribute("location").Value, tenant));
                    }
            }
            return st;
        }