예제 #1
0
        public static List <string> GetForFiscalBill(int policyID)
        {
            Policy p = Policy.Get(policyID);

            char[]        separator   = { ' ', '#', ';' };
            List <string> returnList  = new List <string>();
            string        startString = "01,0000,1";

            startString += separator[2];
            returnList.Add(startString);
            SpecialFieldType sft = SpecialFieldType.GetByCode(SpecialFieldType.FISCAL);
            int i = 0;

            foreach (PolicyItem pi in p.PolicyItems)
            {
                char   currentSeparator = separator[i % 2];
                string s = currentSeparator.ToString() + pi.InsuranceSubType.ShortDescription;
                s += '\t';
                s += pi.PremiumValue;
                s += separator[2].ToString();
                returnList.Add(s);
                ++i;
                List <Control> controlsList = Control.GetForFiscalByInsuranceSubType(pi.InsuranceSubTypeID);
                foreach (Control c in controlsList)
                {
                    currentSeparator = separator[i % 2];
                    s  = currentSeparator.ToString() + c.Description;
                    s += '\t';
                    PolicyExtendInformation pei = PolicyExtendInformation.GetByPolicyItemAndControl(pi.ID, c.ID);
                    s += String.Format("{0:#,0.00}", pei.Value);
                    s += separator[2].ToString();
                    returnList.Add(s);
                    i++;
                }
            }
            string lastString = "%8";

            returnList.Add(lastString);
            return(returnList);
        }
예제 #2
0
        public static List <PolicyItem> SearchPolicyItem(int controlID, string controlValue, int insuranceSubTypeID)
        {
            List <PolicyItem> retList = new List <PolicyItem>();

            if (controlID > 0)
            {
                PolicyItem pi = PolicyExtendInformation.SearchPolicyItemByControl(controlID, controlValue);
                if (pi != null)
                {
                    retList.Add(pi);
                }
                return(retList);
            }
            else
            {
                try {
                    if (controlID == 0)
                    {
                        retList = Table.Where(c => c.InsuranceSubTypeID == insuranceSubTypeID && c.PolicyNumber == controlValue && c.Policy.Discard == false).ToList();
                        return(retList);
                    }
                    else if (controlID == -1)
                    {
                        retList = Table.Where(c => c.InsuranceSubTypeID == insuranceSubTypeID && c.Policy.Discard == false && c.Policy.Client.EMBG == controlValue).ToList();
                        return(retList);
                    }
                    else if (controlID == -2)
                    {
                        retList = Table.Where(c => c.InsuranceSubTypeID == insuranceSubTypeID && c.Policy.Discard == false && c.Policy.Client1.EMBG == controlValue).ToList();
                        return(retList);
                    }
                    return(retList);
                } catch (Exception ex) {
                    return(retList);
                }
            }
        }