Esempio n. 1
0
 public string AddEditExtraValue(int orgid, string field, string value)
 {
     try
     {
         var q = from v in Db.OrganizationExtras
                 where v.Field == field
                 where v.OrganizationId == orgid
                 select v;
         var ev = q.SingleOrDefault();
         if (ev == null)
         {
             ev = new OrganizationExtra
             {
                 OrganizationId = orgid,
                 Field = field,
             };
             Db.OrganizationExtras.InsertOnSubmit(ev);
         }
         ev.Data = value;
         Db.SubmitChanges();
         return "ok";
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
 }
Esempio n. 2
0
 public ExtraValue(OrganizationExtra v, ExtraValueModel model)
 {
     Type = v.Type;
     Field = v.Field;
     StrValue = v.StrValue;
     DateValue = v.DateValue;
     Data = v.Data;
     IntValue = v.IntValue;
     BitValue = v.BitValue;
     Id = v.OrganizationId;
     Model = model;
 }
Esempio n. 3
0
        public void AddEditExtra(CMSDataContext db, string field, string value, bool multiline = false)
        {
            var oev = db.OrganizationExtras.SingleOrDefault(oe => oe.OrganizationId == OrganizationId && oe.Field == field);

            if (oev == null)
            {
                oev = new OrganizationExtra
                {
                    OrganizationId = OrganizationId,
                    Field          = field,
                };
                db.OrganizationExtras.InsertOnSubmit(oev);
            }
            oev.Data     = value;
            oev.DataType = multiline ? "text" : null;
        }
Esempio n. 4
0
        public static OrganizationExtra GetExtraValue(CMSDataContext db, int id, string field)
        {
            field = field.Trim();
            var q = from v in db.OrganizationExtras
                    where v.Field == field
                    where v.OrganizationId == id
                    select v;
            var ev = q.SingleOrDefault();

            if (ev == null)
            {
                ev = new OrganizationExtra
                {
                    OrganizationId  = id,
                    Field           = field,
                    TransactionTime = DateTime.Now
                };
                db.OrganizationExtras.InsertOnSubmit(ev);
            }
            return(ev);
        }
Esempio n. 5
0
 public ActionResult AddMESEvent(int id, string mesID)
 {
     OrganizationExtra ev;
     string[] mesEvent = mesID.Split('|');
     string name = "ministrEspace:" + mesEvent[0];
     ev = (from e in DbUtil.Db.OrganizationExtras
           where e.Field == name
           select e).SingleOrDefault();
     if (ev == null)
     {
         ev = new OrganizationExtra();
         ev.OrganizationId = id;
         ev.Field = name;
         ev.Data = mesEvent[1];
         DbUtil.Db.OrganizationExtras.InsertOnSubmit(ev);
     }
     else
     {
         ev.Data = mesEvent[1];
     }
     DbUtil.Db.SubmitChanges();
     return RedirectToAction("Index", "Org", new { id = id });
 }
Esempio n. 6
0
        public OrganizationExtra GetExtraValue(string field)
        {
            var ev = OrganizationExtras.AsEnumerable().FirstOrDefault(ee => string.Compare(ee.Field, field, ignoreCase: true) == 0);
            if (ev == null)
            {
                ev = new OrganizationExtra()
                {
                    OrganizationId = OrganizationId,
                    Field = field,

                };
                OrganizationExtras.Add(ev);
            }
            return ev;
        }
Esempio n. 7
0
 public void AddEditExtra(CMSDataContext Db, string field, string value, bool multiline = false)
 {
     var oev = Db.OrganizationExtras.SingleOrDefault(oe => oe.OrganizationId == OrganizationId && oe.Field == field);
     if (oev == null)
     {
         oev = new OrganizationExtra
               {
                   OrganizationId = OrganizationId,
                   Field = field,
               };
         Db.OrganizationExtras.InsertOnSubmit(oev);
     }
     oev.Data = value;
     oev.DataType = multiline ? "text" : null;
 }
Esempio n. 8
0
 public static OrganizationExtra GetExtraValue(CMSDataContext db, int id, string field)
 {
     //field = field.Replace('/', '-');
     var q = from v in db.OrganizationExtras
             where v.Field == field
             where v.OrganizationId == id
             select v;
     var ev = q.SingleOrDefault();
     if (ev == null)
     {
         ev = new OrganizationExtra
         {
             OrganizationId = id,
             Field =  field,
             TransactionTime = DateTime.Now
         };
         db.OrganizationExtras.InsertOnSubmit(ev);
     }
     return ev;
 }
Esempio n. 9
0
        public OrganizationExtra GetExtraValue(string field)
        {
            var ev = OrganizationExtras.AsEnumerable().FirstOrDefault(ee => ee.Field.Equal(field));
            if (ev == null)
            {
                ev = new OrganizationExtra()
                {
                    OrganizationId = OrganizationId,
                    Field = field,

                };
                OrganizationExtras.Add(ev);
            }
            return ev;
        }
Esempio n. 10
0
 private void detach_OrganizationExtras(OrganizationExtra entity)
 {
     this.SendPropertyChanging();
     entity.Organization = null;
 }