Esempio n. 1
0
 public void addUnit(int nbUnit)
 {
     for (int i = 0; i < nbUnit; i++)
     {
         ListUnit.Add(createUnit());
     }
 }
Esempio n. 2
0
 public static void Deserialize(byte[] buffer, long ofs, object graph)
 {
     if (ListUnit.IsNullOrEmpty <byte>(buffer))
     {
         throw new ArgumentException();
     }
     FixedLengthFormatter.Deserialize(Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), ofs, graph);
 }
 protected virtual object Resolve(Type clazz, bool alloc, params Type[] exceptive)
 {
     if (clazz != null)
     {
         if (!alloc && Container.FirstOrDefault((s) => clazz.IsInstanceOfType(s)) != null)
         {
             return(null);
         }
         if (clazz.IsInterface)
         {
             var assembly = clazz.Assembly;
             var types    = assembly.GetExportedTypes();
             return(Resolve(types.FirstOrDefault((i) => !i.IsInterface && clazz.IsAssignableFrom(i)), alloc));
         }
         else
         {
             var ctors = clazz.GetConstructors();
             if (ctors.Length > 0)
             {
                 var service = typeof(IoC);
                 for (int i = 0; i < ctors.Length; i++)
                 {
                     var ctor    = ctors[i];
                     var args    = ctor.GetParameters();
                     var success = true;
                     for (int j = 0; j < args.Length; j++)
                     {
                         if (!ListUnit.IsNullOrEmpty <Type>(exceptive))
                         {
                             success = exceptive.FirstOrDefault((s) => s.IsAssignableFrom(args[j].ParameterType)) != null;
                         }
                         else
                         {
                             success = service.IsAssignableFrom(args[j].ParameterType);
                         }
                         if (!success)
                         {
                             break;
                         }
                     }
                     if (success)
                     {
                         return(Resolve(ctor, alloc));
                     }
                 }
             }
         }
     }
     return(null);
 }
Esempio n. 4
0
 //单词表生成
 private List <ListUnit> WordPreOrder(TrieNode node, List <ListUnit> WordList)
 {
     if (node.PrefixNum == 0)
     {
         return(WordList);
     }
     if (node.WordNum != 0)
     {
         ListUnit unit = new ListUnit();
         unit.Word    = node.Word;
         unit.WordNum = node.WordNum;
         WordList.Add(unit);
     }
     foreach (char key in node.Sons.Keys)
     {
         WordList = WordPreOrder(node.Sons[key], WordList);
     }
     return(WordList);
 }
Esempio n. 5
0
    public void Search()
    {
        string str = inputManager.ChangedText();

        if (str.Length > 0)
        {
            string sql = "SELECT * FROM product WHERE name LIKE '%" + str + "%';";
            MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql);
            int count = 0;
            while (reader.Read())
            {
                Transform newUnit = Instantiate(listUnit);
                newUnit.SetParent(listPanel);
                RectTransform rectTransform = newUnit.GetComponent <RectTransform>();
                rectTransform.anchorMin = new Vector2(0, 0.9f - count * 0.1f);
                rectTransform.anchorMax = new Vector2(1, 1f - count * 0.1f);
                rectTransform.offsetMin = Vector2.zero;
                rectTransform.offsetMax = Vector2.zero;

                Product product = new Product();
                product.id          = reader.GetInt32(0);
                product.name        = reader.GetString(1);
                product.barcode     = reader.GetString(2);
                product.company     = reader.GetString(3);
                product.category    = product.koreanToCategory(reader.GetString(4));
                product.ingredients = reader.GetString(5);
                product.imagePath   = reader.GetString(6);

                ListUnit unitInfo = newUnit.GetComponent <ListUnit>();
                unitInfo.InfoChange(product, gameObject);
                productList.Add(unitInfo);

                count++;
                if (count == 10)
                {
                    break;
                }
            }
            reader.Close();
            DbConnecter.instance.CloseConnection();
        }
    }
Esempio n. 6
0
 /// <summary>
 /// 开具发票,打印
 /// </summary>
 public void Print()
 {
     //没有初始化,不予执行
     if (!IsInit)
     {
         return;
     }
     this.State = State.Start;
     Log.Debug("开始开具发票");
     Log.Debug("InfoClientName(开票名称)-" + InfoClientName + ",InfoClientAddressPhone(开票地址,电话)-"
               + InfoClientAddressPhone + ",InfoTaxRate(税率)-" + InfoTaxRate + ",ListGoodsName(服务名称)-"
               + ListGoodsName + ",ListAmount(金额)-" + ListAmount + ",ListPrice(单价)-" + ListPrice
               + ",ListUnit(单位)-" + ListUnit + ",ListNumber(数量)-" + ListNumber + ",InfoCashier(收款人)-"
               + InfoCashier + ",InfoChecker(复核人)-" + InfoChecker + ",InfoNotes(备注)-" + InfoNotes);
     obj.InvInfoInit();
     //增值税普通发票
     obj.InfoKind = 2;
     //开票名称
     obj.InfoClientName = InfoClientName;
     //售方地址及电话
     obj.InfoSellerAddressPhone = InfoSellerAddressPhone;
     //售方开户行及账号
     obj.InfoSellerBankAccount = InfoSellerBankAccount;
     //开票地址,电话
     obj.InfoClientAddressPhone = InfoClientAddressPhone;
     //税率
     obj.InfoTaxRate = InfoTaxRate;
     char[] c = new char[] { '|' };
     //服务名称
     string[] names = ListGoodsName.Split(c);
     //金额
     //string[] amounts = ListAmount.Split(c);
     string[] prices = ListPrice.Split(c);
     //单位
     string[] units = ListUnit.Split(c);
     //数量
     string[] numbers = ListNumber.Split(c);
     //含税价标志
     string[] pricekind = ListPriceKind.Split(c);
     obj.ClearInvList();
     for (int i = 0; i < names.Length; i++)
     {
         if (names[i].Equals("滞纳金") && double.Parse(prices[i]) <= 0)
         {
             continue;
         }
         //设置开票内容
         obj.InvListInit();
         //服务名称
         obj.ListGoodsName = names[i];
         //double amount = double.Parse(amounts[i]) / (InfoTaxRate *0.01 + 1);
         //obj.ListAmount = Math.Round(amount, 2);
         //obj.ListTaxAmount = amount * InfoTaxRate * 0.01;
         //double price = double.Parse(prices[i]) / (InfoTaxRate * 0.01 + 1);
         obj.ListPrice     = double.Parse(prices[i]);
         obj.ListUnit      = units[i];
         obj.ListNumber    = double.Parse(numbers[i]);
         obj.ListPriceKind = Int32.Parse(pricekind[i]);
         obj.AddInvList();
     }
     //收款人
     obj.InfoCashier = InfoCashier;
     //复核人
     obj.InfoChecker = InfoChecker;
     //开票人
     obj.InfoInvoicer = InfoChecker;
     //备注
     obj.InfoNotes = InfoNotes;
     obj.Invoice();
     if (obj.RetCode != 4011)
     {
         Log.Debug("开具发票失败-" + obj.RetCode + obj.RegMsg);
         MessageBox.Show(obj.RetMsg);
     }
     else
     {
         Log.Debug("开具发票成功-开始打印");
         //打印
         obj.PrintInv();
         State = State.End;
         OnCompleted(null);
     }
 }