Exemplo n.º 1
0
        private static void ExtractData(XDocument cli)
        {
            XElement summ = cli.Descendants("Summary").FirstOrDefault();
            if (summ == null)
            {
                Console.WriteLine("Summary element not found");
            }

            //Console.WriteLine(ExtractSummary(summ));
            writer.WriteLine(ExtractSummaryHdr());
            writer.WriteLine(ExtractSummary(summ));
            XElement propfiles = cli.Descendants("PropertyFiles").FirstOrDefault();
               // Console.WriteLine("Properties {0}", propfiles.Descendants("PropertyFile").Count());
            foreach (XElement prop in propfiles.Descendants("PropertyFile").Descendants("Property"))
            {
                //Console.WriteLine(ExtractPropertyInfo(prop));
                writer.WriteLine(ExtractPropertyInfoHdr());
                writer.WriteLine(ExtractPropertyInfo(prop));

            }
            foreach (XElement lease in propfiles.Descendants("LeaseFile"))
            {
                //Console.WriteLine(ExtractLeaseInfo(lease));
                writer.WriteLine(ExtractLeaseInfoHdr());
                writer.WriteLine(ExtractLeaseInfo(lease));

                if (lease.Descendants("FileTransactions").Count() > 0)
                    writer.WriteLine(ExtractFtransHdr(lease));

                FileTransactions fTrans = new FileTransactions();
                fTrans.GetIdValues(lease);
                if (fTrans != null && fTrans.IdValues.Count > 0)
                {
                    foreach (var x in fTrans.IdValues)
                    {
                        writer.WriteLine(ExtractFtrans(fTrans,x.Key));
                    }
                }

                if (lease.Descendants("Tenants").Count() > 0)
                    writer.WriteLine(ExtractTenantInfoHdr());

                foreach (XElement tenant in lease.Descendants("Tenants"))
                {
                    //Console.WriteLine(ExtractTenantInfo(tenant));
                    writer.WriteLine(ExtractTenantInfo(tenant));
                }
            }
        }
Exemplo n.º 2
0
        private static string ExtractFtrans(FileTransactions fTrans, string transid)
        {
            List<string> st = new List<string>();
            string ret = string.Empty;
            var temp = GetElements("FileTransactions");
            if (temp == null)
                return ret;
            st.Add("FTRANS");

            var x = fTrans.IdValues[transid];
            foreach (var f in temp)
            {
                if (f.Attribute("location") == null) continue;

                if (f.Attribute("location").Value == "AssignedAmount")
                    st.Add(fTrans.AssignedAmount);
                if (f.Attribute("location").Value  == "Identification")
                    st.Add(x.TransId);
                if (f.Attribute("location").Value  == "TransDate")
                    st.Add(x.TransDate);
                if (f.Attribute("location").Value  == "TransType")
                    st.Add(x.TransType);
                if (f.Attribute("location").Value  == "TransTypeDesc")
                    st.Add(x.TransTypeDesc);
                if (f.Attribute("location").Value  == "TransAmount")
                    st.Add(x.TransAmount);
                if (f.Attribute("location").Value  == "OpenAmount")
                    st.Add(x.OpenAmount);
                if (f.Attribute("location").Value  == "CustChargeCode")
                    st.Add(x.CustChargeCode);
                if (f.Attribute("location").Value  == "CustChargeCodeDesc")
                    st.Add(x.CustChargeCodeDesc);
            }
            return String.Join("|", st);
        }
Exemplo n.º 3
0
        private static string ExtractLeaseInfo(XElement lease)
        {
            List<string> st = new List<string>();
            List<string> ftlist = new List<string>();
            string ret = string.Empty;
            var temp = GetElements("LeaseFile");
            if (temp == null)
                return ret;
            st.Add("LEASE");

            FileTransactions fTrans = new FileTransactions();
            fTrans.GetIdValues(lease);

            foreach (XElement de in temp)
            {
                Identification idvals = new Identification();
                if (de.Attribute("location").Value == "Identification")
                {
                    idvals.GetIdValues(lease);
                    if (de.Attribute("orgval").Value != string.Empty)
                    {
                        if (idvals.IdValues.ContainsKey(de.Attribute("orgval").Value))
                            st.Add(idvals.IdValues[de.Attribute("orgval").Value]);
                    }
                }
                else st.Add(GetItem(de.Attribute("location").Value, lease));
            }
            return String.Join("|", st);
        }
Exemplo n.º 4
0
        private static void ExtractData(XDocument cli)
        {
            string tempStr;
            XElement summ = cli.Descendants("Summary").FirstOrDefault();
            if (summ == null)
            {
                Console.WriteLine("Summary element not found");
                return;
            }

            dictSumm = ExtractSummary(summ);
            XElement propfiles = cli.Descendants("PropertyFiles").FirstOrDefault();
            foreach (XElement prop in propfiles.Descendants("PropertyFile").Descendants("Property"))
            {
                dictProp = ExtractPropertyInfo(prop);

            }

            WriteSummary(writer);

            tempStr = string.Empty;
            foreach (XElement lease in propfiles.Descendants("LeaseFile"))
            {
                //Console.WriteLine(ExtractLeaseInfo(lease));
                dictLease = ExtractLeaseInfo(lease);
                //dictLeases.Add(dictLease);
                int ftransCnt = lease.Descendants("FileTransactions").Count();
                if (ftransCnt > 0)
                {
                    int cnt = 0;
                    if (ftransCnt > 10)
                        WriteMessage("File Transactions count > 10; only importing 10");
                    Dictionary<string, string> dictItem = null;
                    FileTransactions fTrans = new FileTransactions();
                    fTrans.GetIdValues(lease);
                    if (fTrans != null && fTrans.IdValues.Count > 0)
                    {
                        dictFiletrans = new List<Dictionary<string, string>>();
                        foreach (var x in fTrans.IdValues)
                        {
                            cnt++;
                            if (cnt > 10) break;
                            dictItem = new Dictionary<string, string>();
                            if (cnt == 1)
                                dictItem = ExtractFtrans(fTrans, x.Key,true);
                            else
                                dictItem = ExtractFtrans(fTrans, x.Key);
                            dictFiletrans.Add(dictItem);
                        }
                    }
                    if (dictFiletrans.Count < 10)
                        AddBlankTransactions(dictFiletrans);
                }
                int tenantCnt = lease.Descendants("Tenants").Count();
                if (tenantCnt > 0)
                {
                    int cnt = 0;
                    if (tenantCnt > 3)
                        WriteMessage("Tenant count > 3; only importing 3");
                    dictTenants = new List<Dictionary<string, string>>();
                    foreach (XElement tenant in lease.Descendants("Tenants"))
                    {
                        cnt++;
                        if (cnt > 3) break;
                        if (cnt == 1)
                            dictTenants.Add( ExtractTenantInfo(tenant,true));
                        else dictTenants.Add(ExtractTenantInfo(tenant));
                    }
                    if (dictTenants.Count < 3)
                        AddBlankTenants(dictTenants);
                }
            }
            WriteLease(writer);
        }
Exemplo n.º 5
0
        private static Dictionary<string, string> ExtractLeaseInfo(XElement lease)
        {
            Dictionary<string, string> st = new Dictionary<string, string>();
            //List<string> ftlist = new List<string>();
            string ret = string.Empty;
            var temp = GetElements("LeaseFile");
            if (temp == null)
                return st;

            FileTransactions fTrans = new FileTransactions();
            fTrans.GetIdValues(lease);

            foreach (XElement de in temp)
            {
                Identification idvals = new Identification();
                if (de.Attribute("location").Value == "Identification")
                {
                    idvals.GetIdValues(lease);
                    if (de.Attribute("orgval").Value != string.Empty)
                    {
                        if (idvals.IdValues.ContainsKey(de.Attribute("orgval").Value))
                            st.Add(de.Attribute("outputname").Value, idvals.IdValues[de.Attribute("orgval").Value]);
                    }
                }
                else st.Add(de.Attribute("outputname").Value,GetItem(de.Attribute("location").Value, lease));
            }
            return st;
        }
Exemplo n.º 6
0
        private static Dictionary<string, string> ExtractFtrans(FileTransactions fTrans, string transid, bool firstTran=false)
        {
            Dictionary<string, string> st = new Dictionary<string, string>();
            var temp = GetElements("FileTransactions");
            if (temp == null)
                return st;
            int cnt = 0;
            var x = fTrans.IdValues[transid];
            foreach (var f in temp)
            {
                cnt++;
                if (f.Attribute("location") == null) continue;

                if (f.Attribute("location").Value == "AssignedAmount")
                    if (firstTran) st.Add(f.Attribute("location").Value,fTrans.AssignedAmount);
                if (f.Attribute("location").Value  == "Identification")
                    st.Add(f.Attribute("location").Value, x.TransId);
                if (f.Attribute("location").Value  == "TransDate")
                    st.Add(f.Attribute("location").Value, x.TransDate);
                if (f.Attribute("location").Value  == "TransType")
                    st.Add(f.Attribute("location").Value, x.TransType);
                if (f.Attribute("location").Value  == "TransTypeDesc")
                    st.Add(f.Attribute("location").Value, x.TransTypeDesc);
                if (f.Attribute("location").Value  == "TransAmount")
                    st.Add(f.Attribute("location").Value, x.TransAmount);
                if (f.Attribute("location").Value  == "OpenAmount")
                    st.Add(f.Attribute("location").Value, x.OpenAmount);
                if (f.Attribute("location").Value  == "CustChargeCode")
                    st.Add(f.Attribute("location").Value, x.CustChargeCode);
                if (f.Attribute("location").Value  == "CustChargeCodeDesc")
                    st.Add(f.Attribute("location").Value, x.CustChargeCodeDesc);
            }
            return st;
        }