示例#1
0
        public static int initializeBO(int BusinessObjectId, string connectionString)
        {
            BODb _db = new BODb(connectionString);

            BO_BusinessObjectInstance boi = new BO_BusinessObjectInstance();

            var bo = _db.BusinessObjects.Find(BusinessObjectId);

            boi.BusinessObjectId = bo.Id;
            boi.Data             = bo.DefaultData;

            _db.BusinessObjectInstances.Add(boi);
            _db.SaveChanges();

            return(boi.Id);
        }
        private void initavailablebos(string selected)
        {
            AvailableBOs = new List <SelectListItem>();

            BODb _BOdb = new BODb();

            foreach (var e in _BOdb.BusinessObjects.ToList())
            {
                var i = new SelectListItem()
                {
                    Text = e.Name, Value = e.Id.ToString()
                };

                if (i.Value == selected)
                {
                    i.Selected = true;
                }
                AvailableBOs.Add(i);
            }
        }