Exemple #1
0
        private Dictionary<string, string> ExtractFtrans(FileTransactions fTrans, string transid, bool firstTran = false)
        {
            Dictionary<string, string> st = new Dictionary<string, string>();
            var temp = GetElements("FileTransactions");
            var secMaxCount = GetElementsMaxCount("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;
        }
Exemple #2
0
        private 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("idtype").Value != string.Empty)
                    {
                        if (idvals.IdValues.ContainsKey(de.Attribute("idtype").Value))
                        {
                            st.Add(de.Attribute("outputname").Value, idvals.IdValues[de.Attribute("idtype").Value]);
                            continue;
                        }
                    }
                    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]);
                            continue;
                        }
                    }
                }
                else
                {
                    if (de.Attribute("date") != null && de.Attribute("date").Value == "1")
                        st.Add(de.Attribute("outputname").Value, GetItem(de.Attribute("location").Value, lease).Replace("-", ""));
                    else
                        st.Add(de.Attribute("outputname").Value, GetItem(de.Attribute("location").Value, lease));
                }
            }
            return st;
        }
Exemple #3
0
        private void ExtractData(XDocument cli)
        {
            string tempStr;

            int tenantCnt = 0;
            int ftransCnt = 0;
            XElement summ = cli.Descendants("Summary").FirstOrDefault();
            if (summ == null)
            {
                throw new Exception("Summary element not found");
            }

            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;
            cntFalseCount = 0;
            bool collStatusFalse = false;
            var cntLease = propfiles.Descendants("LeaseFile").Count();

            foreach (XElement lease in propfiles.Descendants("LeaseFile"))
            {
                collStatusFalse = false;
                //Console.WriteLine(ExtractLeaseInfo(lease));
                LeaseIdentifiers = new List<string>();

                dictLease = ExtractLeaseInfo(lease);
                if (dictLease["LeaseTenantId"] != null)
                {
                    LeaseIdentifiers.Add(dictLease["LeaseTenantId"]);
                }
                //dictLeases.Add(dictLease);
                if (dictLease["CollectionStatus"] == "false")
                {
                    cntFalseCount++;
                    collStatusFalse = true;
                }
                ftransCnt = lease.Descendants("FileTransactions").Count();
                ftransMaxCount = GetElementsMaxCount("FileTransactions");
                dictFiletrans = new List<Dictionary<string, string>>();

                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)
                    {
                        foreach (var x in fTrans.IdValues)
                        {
                            cnt++;
                            if (cnt > ftransMaxCount) 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 < ftransMaxCount)
                    AddBlankTransactions(dictFiletrans, ftransMaxCount);

                tenantCnt = lease.Descendants("Tenants").Count();
                tenantMaxCnt = GetElementsMaxCount("Tenants");
                dictTenants = new List<Dictionary<string, string>>();
                if (tenantCnt > 0)
                {
                    int cnt = 0;
                    foreach (XElement tenant in lease.Descendants("Tenants"))
                    {
                        cnt++;
                        if (cnt > tenantMaxCnt) break;
                        if (cnt == 1)
                            dictTenants.Add(ExtractTenantInfo(tenant, true));  // primary tenant
                        else
                            dictTenants.Add(ExtractTenantInfo(tenant));
                    }

                    if (dictTenants.Count > 1)
                      ReplicateAddress();
                }
                if (dictTenants.Count < tenantMaxCnt)
                    AddBlankTenants(dictTenants, tenantMaxCnt);

                if (!collStatusFalse)
                    WriteLease(writer);
                else
                    WriteLease(writerFalse);
            }
        }