public static int InsertEDM(EDM edm) { int isInsert = 0; try { string query = SQLClass.INSERT_INTO_EDM; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("edm_code", edm.EDMCode); command.Parameters.Add("description", edm.Description); command.Parameters.Add("revision", edm.Revision); command.Parameters.Add("cust_code", edm.CustCode); command.Parameters.Add("format", edm.Format); command.Parameters.Add("scale", edm.Scale); command.Parameters.Add("first_published", edm.FirstPubl); command.Parameters.Add("last_published", edm.LastPubl); command.Parameters.Add("remarks", edm.Remarks); command.Parameters.Add("author", edm.Author); command.Parameters.Add("last_edited", edm.LastEdited); command.Parameters.Add("last_edited_by", edm.LastEditedBy); command.Parameters.Add("deleted", edm.Deleted); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isInsert = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isInsert); }
private void PopulateGrid() { List <DisplayItems> lst = new List <DisplayItems>(); EDM edm = new EDM(); var prog = from tb in edm.GetLastOfEach() select new DisplayItems { device_id = (int)tb.device_id, log_date_time = tb.date_time.ToString(), location_provider = tb.provider, battery = (int)tb.battery, device = tb.device_name, latitude = (decimal)tb.latitude, longitude = (decimal)tb.longitude }; lst = prog.ToList(); grdLastLogs.DataSource = lst; grdLastLogs.DataBind(); MapBuilder map = new MapBuilder(); string strMap = string.Empty; strMap = map.BuildMap(MapType.AllMarkersOnly); litMapScript.Text = strMap; }
public static EDM CreateEDMFromIDatabase(IDatabase database, string modelNamespace) { EDM edm = new EDM(); edm.SSDLContainer = SSDLConverter.CreateSSDLContainer(database, modelNamespace); return(edm); }
public EFRepository() { if (HttpContext.Current.Session["contexte"] == null) { contexte = new EDM(); HttpContext.Current.Session["contexte"] = contexte; } else { contexte = (EDM)HttpContext.Current.Session["contexte"]; } }
private static EDM Read(XElement edmx, Action <XElement> readMoreAction) { XElement edmxRuntime = edmx.Element(XName.Get("Runtime", edmxNamespace.NamespaceName)); SSDLContainer ssdlContainer = SSDLIO.ReadXElement(edmxRuntime); CSDLContainer csdlContainer = CSDLIO.ReadXElement(edmxRuntime); XElement edmxDesigner = edmx.Element(XName.Get("Designer", edmxNamespace.NamespaceName)); if (ssdlContainer == null && csdlContainer == null) { return(new EDM()); } EDM edm = new EDM() { SSDLContainer = ssdlContainer, CSDLContainer = MSLIO.IntegrateMSLInCSDLContainer(csdlContainer, ssdlContainer, edmxRuntime), }; if (edmxDesigner != null) { if (edmxDesigner.Element(XName.Get("Connection", edmxNamespace.NamespaceName)) != null) { edm.DesignerProperties = edmxDesigner.Element(XName.Get("Connection", edmxNamespace.NamespaceName)).Element(XName.Get("DesignerInfoPropertySet", edmxNamespace.NamespaceName)).Elements(XName.Get("DesignerProperty", edmxNamespace.NamespaceName)).Select(e => new DesignerProperty { Name = e.Attribute("Name").Value, Value = e.Attribute("Value").Value }); } if (edmxDesigner.Element(XName.Get("Options", edmxNamespace.NamespaceName)) != null) { edm.EDMXDesignerDesignerProperties = edmxDesigner.Element(XName.Get("Options", edmxNamespace.NamespaceName)).Element(XName.Get("DesignerInfoPropertySet", edmxNamespace.NamespaceName)).Elements(XName.Get("DesignerProperty", edmxNamespace.NamespaceName)).Select(e => new DesignerProperty { Name = e.Attribute("Name").Value, Value = e.Attribute("Value").Value }); } if (edmxDesigner.Element(XName.Get("Diagrams", edmxNamespace.NamespaceName)) != null) { edm.EDMXDesignerDiagrams = edmxDesigner.Element(XName.Get("Diagrams", edmxNamespace.NamespaceName)).Elements(XName.Get("Diagram", edmxNamespace.NamespaceName)); } } readMoreAction(edmx); return(edm); }
public int InsertEDM(string EDMCode, string CustCode, int Deleted, string Author, string Description, string LastEdBy, string Revision, string Remarks, string Scale, string Format) { EDM edm = new EDM(); edm.EDMCode = EDMCode; edm.CustCode = CustCode; edm.Deleted = Deleted; edm.Author = Author; edm.Description = Description; edm.Format = Format; edm.FirstPubl = DateTime.Now; edm.LastPubl = DateTime.Now; edm.LastEditedBy = LastEdBy; edm.Revision = Revision; edm.Remarks = Remarks; edm.Scale = Scale; edm.LastEdited = DateTime.Now; int item = new FacadeManager().InsertEDM(edm); return(item); }
public static XElement Write(EDM edm) { CSDLContainer csdlContainer = edm.CSDLContainer; string entityContainerNamespace = string.Concat(csdlContainer.Namespace, "."); // Instantiate Mapping XElement mapping = new XElement(mslNamespace + "Mapping", new XAttribute("Space", "C-S")); // EntityContainerMapping XElement entityContainerMapping = new XElement(mslNamespace + "EntityContainerMapping", new XAttribute("StorageEntityContainer", edm.SSDLContainer.Name), new XAttribute("CdmEntityContainer", csdlContainer.Name)); foreach (EntityType entitySet in csdlContainer.EntitySets) { IEnumerable <EntityType> entityTypes = csdlContainer.EntityTypes.Where(entityType => entityType.EntitySetName == entitySet.EntitySetName); // EntityContainerMapping : EntitySetMapping XElement entitySetMappingElement = new XElement(mslNamespace + "EntitySetMapping", new XAttribute("Name", entitySet.Name)); // EntityContainerMapping : EntitySetMapping : EntityTypeMapping foreach (EntityType entityType in entityTypes) { XElement entityTypeMappingElement = new XElement(mslNamespace + "EntityTypeMapping", new XAttribute("TypeName", string.Format("IsTypeOf({0}{1})", entityContainerNamespace, entityType.Name))); // EntityContainerMapping : EntitySetMapping : EntityTypeMapping : MappingFragment foreach (EDMObjects.SSDL.EntityType.EntityType table in entityType.Mapping.MappedSSDLTables) { XElement mappingFragmentElement = new XElement(mslNamespace + "MappingFragment", new XAttribute("StoreEntitySet", table.EntitySetName)); IEnumerable <PropertyMapping> scalarMappings = entityType.Mapping.GetSpecificMappingForTable(table); foreach (PropertyMapping scalarMapping in scalarMappings) { mappingFragmentElement.AddElement(new XElement(mslNamespace + "ScalarProperty", new XAttribute("Name", scalarMapping.Property.Name), new XAttribute("ColumnName", scalarMapping.Column.Name))); } mappingFragmentElement.Add(MappingComplexProperties(entityType, entityType.Mapping, table, entityContainerNamespace)); IEnumerable <ConditionMapping> conditionMappings = entityType.Mapping.ConditionsMapping.Where(condition => condition.Table == table); foreach (ConditionMapping conditionMapping in conditionMappings) { XElement conditionElement = new XElement(mslNamespace + "Condition"); if (conditionMapping is ColumnConditionMapping) { conditionElement.AddAttribute("ColumnName", (conditionMapping as ColumnConditionMapping).Column.Name); } else if (conditionMapping is PropertyConditionMapping) { conditionElement.AddAttribute("Name", (conditionMapping as PropertyConditionMapping).CSDLProperty.Name); } mappingFragmentElement.Add(conditionElement.AddMappingConditionAttribute(conditionMapping)); } entityTypeMappingElement.Add(mappingFragmentElement); } entitySetMappingElement.Add(entityTypeMappingElement); } // EntityContainerMapping : EntitySetMapping : CUDFunctionMapping foreach (EntityType entityType in entityTypes) { entitySetMappingElement.Add(CUDFunctionMapping(entityType, entityContainerNamespace, string.Concat(edm.SSDLContainer.Namespace, "."))); } entityContainerMapping.Add(entitySetMappingElement); } // EntityContainerMapping : AssociationSetMappings IEnumerable <Association> associations = csdlContainer.Associations.Where(association => association.Mapping.SSDLTableMapped != null); foreach (Association association in associations) { XElement associationSetMappingElement = new XElement(mslNamespace + "AssociationSetMapping", new XAttribute("Name", association.AssociationSetName), new XAttribute("TypeName", string.Concat(entityContainerNamespace, association.Name)), new XAttribute("StoreEntitySet", association.Mapping.SSDLTableMapped.Name)); XElement endPropertyElement1 = new XElement(mslNamespace + "EndProperty", new XAttribute("Name", association.PropertyEnd1Role)); foreach (PropertyMapping navigationPropertyMapping in association.PropertyEnd1.Mapping) { endPropertyElement1.AddElement(new XElement(mslNamespace + "ScalarProperty", new XAttribute("Name", navigationPropertyMapping.Property.Name), new XAttribute("ColumnName", navigationPropertyMapping.Column.Name))); } XElement endPropertyElement2 = new XElement(mslNamespace + "EndProperty", new XAttribute("Name", association.PropertyEnd2Role)); foreach (PropertyMapping navigationPropertyMapping in association.PropertyEnd2.Mapping) { endPropertyElement2.AddElement(new XElement(mslNamespace + "ScalarProperty", new XAttribute("Name", navigationPropertyMapping.Property.Name), new XAttribute("ColumnName", navigationPropertyMapping.Column.Name))); } associationSetMappingElement.Add(endPropertyElement1); associationSetMappingElement.Add(endPropertyElement2); entityContainerMapping.Add(associationSetMappingElement); } // EntityContainerMapping : Conditions foreach (Function function in csdlContainer.Functions) { entityContainerMapping.Add(new XElement(mslNamespace + "FunctionImportMapping", new XAttribute("FunctionImportName", function.Name), new XAttribute("FunctionName", string.Format("{0}.{1}", edm.SSDLContainer.Namespace, function.SSDLFunction.Name)))); } return(mapping.AddElement(entityContainerMapping)); }
public int InsertEDM(EDM edm) { return(BusinessObjectManager.InsertEDM(edm)); }