Пример #1
0
        public CVItemModel Add(CVItemModel model)
        {
            using (MVC_CV_DemoEntities entities = new MVC_CV_DemoEntities())
            {
                Guid newId = Guid.NewGuid();

                CVItem entity = new CVItem
                {
                    CVItemId     = newId,
                    PersoonID    = model.PersoonID,
                    Functienaam  = model.Functienaam,
                    PeriodeVan   = model.PeriodeVan,
                    PeriodeTot   = model.PeriodeTot,
                    Beschrijving = model.Beschrijving,
                    BedrijfsID   = model.BedrijfsID
                };

                entities.CVItem.Add(entity);

                int recordsAffected = entities.SaveChanges();
                if (recordsAffected != 1)
                {
                    return(null);
                }

                model.CVItemId = newId;

                return(model);
            }
        }
Пример #2
0
        public bool Post(CVItem item)
        {
            item.Id = AutoGenerateId();
            int beforeAdd = CvItems.Count;

            CvItems.Add(item);
            bool success = beforeAdd + 1 == CvItems.Count;

            return(success);
        }
Пример #3
0
        public bool Delete(Guid cvitemId)
        {
            using (MVC_CV_DemoEntities entities = new MVC_CV_DemoEntities())
            {
                CVItem entity = entities.CVItem.First(w => w.CVItemId == cvitemId);
                entities.CVItem.Remove(entity);

                int recordsAffected = entities.SaveChanges();
                return(recordsAffected == 1);
            }
        }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionHelper.current.fileSaved = false;
     if (!Page.IsPostBack)
     {
         if (lang.Equals("fr"))
         {
             sectionEng.Visible = false;
             sectionFra.Visible = true;
         }
         else
         {
             sectionEng.Visible = true;
             sectionFra.Visible = false;
         }
         //Load Health Canada SPL Controlled Vocabulary List.
         var hcSPLcvXml = ConfigurationManager.AppSettings["hcSPLcvFile"].ToString();
         if (File.Exists(hcSPLcvXml))
         {
             var cvList   = new List <SPLControlledVocabulary>();
             var cvDoc    = XDocument.Load(hcSPLcvXml);
             var elements = cvDoc.Descendants("items");
             if (elements != null)
             {
                 foreach (var element in elements)
                 {
                     var item = new SPLControlledVocabulary();
                     item.id       = element.Attribute("id").Value;
                     item.oid      = element.Attribute("oid").Value;
                     item.name     = element.Attribute("name").Value;
                     item.fra_name = element.Attribute("fra_name").Value;
                     item.cvList   = new List <CVItem>();
                     foreach (var sub in element.Elements("item"))
                     {
                         var subItem = new CVItem();
                         subItem.code           = sub.Attribute("code").Value;
                         subItem.name           = sub.Attribute("name").Value;
                         subItem.fra_name       = sub.Attribute("fra_name").Value;
                         subItem.definition     = sub.Attribute("definition").Value;
                         subItem.fra_definition = sub.Attribute("fra_definition").Value;
                         item.cvList.Add(subItem);
                     }
                     cvList.Add(item);
                 }
                 if (cvList.Count > 0)
                 {
                     SessionHelper.current.cvItems = cvList;
                 }
             }
         }
     }
 }
Пример #5
0
        public CVItemModel Update(CVItemModel model)
        {
            using (MVC_CV_DemoEntities entities = new MVC_CV_DemoEntities())
            {
                CVItem entity = entities.CVItem.FirstOrDefault(w => w.CVItemId == model.CVItemId);
                if (entity == null)
                {
                    return(null);
                }

                entity.PersoonID    = model.PersoonID;
                entity.Functienaam  = model.Functienaam;
                entity.PeriodeVan   = model.PeriodeVan;
                entity.PeriodeTot   = model.PeriodeTot;
                entity.Beschrijving = model.Beschrijving;
                entity.BedrijfsID   = model.BedrijfsID;

                int recordsAffected = entities.SaveChanges();
                return(recordsAffected == 1 ? Fetch(model.CVItemId) : null);
            }
        }
Пример #6
0
 public void Put(int id, [FromBody] CVItem item)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 public void Post([FromBody] CVItem item)
 {
     _manager.Post(item);
 }
Пример #8
0
        protected virtual void ResetData()
        {
            holderVisual.Children.Clear();

            slider.BeginAnimation(Slider.ValueProperty, null);
            currentAnim = null;
            slider.Value = 0;

            _rowcolToItem = new CVItem[Rows, Columns];
            for (int i = 0; i < Rows; i++)
            {
                for (int j = 0; j < Columns; j++)
                {
                    _rowcolToItem[i, j] = new CVItem();

                    // insert placeholder
                    ModelVisual3D tempVisual3D = RequestTemporaryVisual3D();
                    Transform3D tempTransform = GetObjectTransform(i, j);
                    tempVisual3D.Transform = tempTransform;
                    _rowcolToItem[i, j]._placeholder = tempVisual3D;
                }
            }
        }