Example #1
0
        public bool updateAccountItemTaxRateSetting(long id, Dictionary <string, object> dic)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                AccountItemTaxRateSetting a = db.AccountItemTaxRateSetting.AsQueryable().First(x => x.id == id);

                if (a != null)
                {
                    Type cl = a.GetType();

                    foreach (var obj in dic)
                    {
                        if (cl.GetProperty(obj.Key) != null)
                        {
                            cl.GetProperty(obj.Key).SetValue(a, obj.Value);
                        }
                    }

                    db.SaveChanges();
                    ret = true;
                }
            }

            return(ret);
        }