Пример #1
0
 public List <string> findDataContentValueByDataValuesId(DataValues dataValue)
 {
     return(Dbase.getCurrentInstance().dataContents
            .Where(d => d.dataValuesId == dataValue.dataValuesId)
            .Select(d => d.value)
            .ToList());
 }
Пример #2
0
        public Object add(Object obj)
        {
            object resultObj = null;

            using (var db = new Dbase())
            {
                if (obj.GetType() == typeof(Area))
                {
                    Area area = (Area)obj;
                    db.areas.Add(area);
                    db.SaveChanges();

                    resultObj = area;
                }
                else if (obj.GetType() == typeof(Cooperative))
                {
                    Cooperative cooperative = (Cooperative)obj;
                    db.cooperatives.Add(cooperative);
                    db.SaveChanges();

                    resultObj = cooperative;
                }
                else if (obj.GetType() == typeof(Plant))
                {
                    Plant plant = (Plant)obj;
                    db.plants.Add(plant);
                    db.SaveChanges();

                    resultObj = plant;
                }
                else if (obj.GetType() == typeof(Regions))
                {
                    Regions region = (Regions)obj;
                    db.regions.Add(region);
                    db.SaveChanges();

                    resultObj = region;
                }
                else if (obj.GetType() == typeof(DataValues))
                {
                    DataValues dataValue = (DataValues)obj;
                    db.dataValues.Add(dataValue);
                    db.SaveChanges();

                    resultObj = dataValue;
                }
                else if (obj.GetType() == typeof(DataContent))
                {
                    DataContent dataContent = (DataContent)obj;
                    db.dataContents.Add(dataContent);
                    db.SaveChanges();

                    resultObj = dataContent;
                }
                else if (obj.GetType() == typeof(CooperativeDataValues))
                {
                    CooperativeDataValues cooperativeDataValues = (CooperativeDataValues)obj;
                    db.cooperativeDataValues.Add(cooperativeDataValues);
                    db.SaveChanges();

                    resultObj = cooperativeDataValues;
                }
                else if (obj.GetType() == typeof(CooperativeDataContent))
                {
                    CooperativeDataContent cooperativeDataContent = (CooperativeDataContent)obj;
                    db.cooperativeDataContent.Add(cooperativeDataContent);
                    db.SaveChanges();

                    resultObj = cooperativeDataContent;
                }
                else if (obj.GetType() == typeof(DataType))
                {
                    DataType dataType = (DataType)obj;
                    db.dataTypes.Add(dataType);
                    db.SaveChanges();

                    resultObj = dataType;
                }

                return(resultObj);
            }
        }
Пример #3
0
 public List <DataContent> findDataContentByDataValuesId(DataValues dataValue)
 {
     return((List <DataContent>)Dbase.getCurrentInstance().dataContents
            .Where(dc => dc.dataValuesId == dataValue.dataValuesId)
            .ToList <DataContent>());
 }