Ejemplo n.º 1
0
        public bool updateFormFieldSetting(string id, Dictionary <string, object> dicObj)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                Guid guid_id = Guid.Parse(id);

                FormFieldsSetting f = db.FormFieldsSetting.AsQueryable().FirstOrDefault(x => x.id == guid_id);

                if (f == null)
                {
                    return(false);
                }

                Type cl = f.GetType();

                foreach (var obj in dicObj)
                {
                    if (cl.GetProperty(obj.Key) != null)
                    {
                        cl.GetProperty(obj.Key).SetValue(f, obj.Value);
                    }
                }
                db.SaveChanges();
                ret = true;
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public FormFieldsSetting addFormFieldSetting(FormFieldsSetting f)
        {
            FormFieldsSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.FormFieldsSetting.Add(f);
                db.SaveChanges();
            }
            return(ret);
        }