示例#1
0
 public error load_files(List <string> files)
 {
     foreach (string file in files)
     {
         Xml_Invoice invoice = new Xml_Invoice();
         bool        unique  = true;
         invoice.File_path = file;
         if (invoice.load_meta_from_file() == error.FAIL)
         {
             continue;
         }
         foreach (Xml_Invoice tmp in invoices)
         {
             if (invoice.Invoice_num == tmp.Invoice_num)
             {
                 unique = false;
                 break;
             }
         }
         if (unique == false)
         {
             continue;
         }
         if (invoice.load_data() == error.FAIL)
         {
             return(error.FAIL);
         }
         invoices.Add(invoice);
     }
     count_cust();
     generate_association_db();
     return(error.SUCCESS);
 }
示例#2
0
        private void generate_association_db()
        {
            phone_name_db = new Dictionary <string, string>();

            for (int i = invoices.Count - 1; i >= 0; i--)
            {
                Xml_Invoice tmp_inv = invoices[i];
                for (int j = tmp_inv.Sub_list.Count - 1; j >= 0; j--)
                {
                    Subscriber tmp_sub  = tmp_inv.Sub_list[j];
                    string     phoneNum = tmp_sub.Info.Phone_number;
                    string     subName  = tmp_sub.Info.Tarif_s_name;

                    if (phone_name_db.ContainsKey(phoneNum))
                    {
                        if (is_valid_name(subName))
                        {
                            phone_name_db[phoneNum] = subName;
                        }
                    }
                    else
                    {
                        phone_name_db.Add(phoneNum, subName);
                    }
                }
            }
        }