public void deleteMessageCatalog(int id) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); MessageCatalog existingMessageCatalog = dbhelp.GetByid(id); dbhelp.Delete(existingMessageCatalog); }
private MessageCatalog generateMessageCatalogForTest(int messageCatalogId) { MessageCatalog mc = new MessageCatalog(); mc.Id = messageCatalogId; switch (messageCatalogId) { case 79: mc.Name = "Message102"; mc.MonitorFrequenceInMinSec = 10000; break; case 84: mc.Name = "OPCUA-Msg-Temperature_C"; mc.MonitorFrequenceInMinSec = 10000; break; case 85: mc.Name = "ICP_DAS-UA5231"; mc.MonitorFrequenceInMinSec = 15000; break; default: throw new ArgumentException(); } mc.MessageElement = generateMessageElementList(messageCatalogId); mc.EventRuleCatalog = generateEventRuleCatalogList(messageCatalogId); return(mc); }
public void Init() { var catalog = new MessageCatalog(new Collection <MessageEntry> { new MessageEntry(typeof(Message1), typeof(MockMessageHandler <Message1>)) }); _dispatcher = new MessageDispatcher(new MessageHandlerFactory(catalog)); }
public void Init() { var catalog = new MessageCatalog(new Collection <MessageEntry> { new MessageEntry(typeof(Message1), typeof(MockMessageHandler <Message1>)), new MessageEntry(typeof(Message2), typeof(MockReusableMessageHandler <Message2>)) }); _factory = new MessageHandlerFactory(catalog); }
public void updateMessageCatalog(int id, Edit messageCatalog) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); MessageCatalog existingMessageCatalog = dbhelp.GetByid(id); existingMessageCatalog.Name = messageCatalog.Name; existingMessageCatalog.CompanyID = messageCatalog.CompanyId; existingMessageCatalog.Description = messageCatalog.Description; existingMessageCatalog.ChildMessageFlag = messageCatalog.ChildMessageFlag; dbhelp.Update(existingMessageCatalog); }
public Detail getMessageCatalogById(int id) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); MessageCatalog messageCatalog = dbhelp.GetByid(id); return(new Detail() { Id = messageCatalog.Id, Name = messageCatalog.Name, Description = messageCatalog.Description, ChildMessageFlag = messageCatalog.ChildMessageFlag }); }
public void addMessageCatalog(Edit messageCatalog) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); var newMessageCatalog = new MessageCatalog() { Name = messageCatalog.Name, CompanyID = messageCatalog.CompanyId, Description = messageCatalog.Description, ChildMessageFlag = messageCatalog.ChildMessageFlag, DeletedFlag = false }; dbhelp.Add(newMessageCatalog); }
public void DeleteById(int id) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { MessageCatalog existingData = dbEntity.MessageCatalog.Find(id); if (existingData == null) { throw new CDSException(10701); } dbEntity.MessageCatalog.Remove(existingData); dbEntity.SaveChanges(); } }
public void addMessageCatalog(Edit messageCatalog) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); var newMessageCatalog = new MessageCatalog() { Name = messageCatalog.Name, CompanyID = messageCatalog.CompanyId, Description = messageCatalog.Description, MonitorFrequenceInMinSec = (int)messageCatalog.MonitorFrequenceInMinSec, ChildMessageFlag = messageCatalog.ChildMessageFlag }; dbhelp.Add(newMessageCatalog); }
public int Create(int companyId, Format_Create parseData) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { MessageCatalog newData = new MessageCatalog(); newData.CompanyID = companyId; newData.Name = parseData.Name; newData.Description = parseData.Description ?? ""; newData.MonitorFrequenceInMinSec = parseData.MonitorFrequenceInMinSec; newData.ChildMessageFlag = parseData.ChildMessageFlag; dbEntity.MessageCatalog.Add(newData); dbEntity.SaveChanges(); return(newData.Id); } }
public Template GetMessageCatalogTemplate(int messageId, string iotHubDeviceId) { DBHelper._MessageCatalog dbhelp = new DBHelper._MessageCatalog(); MessageCatalog msgCatalog = dbhelp.GetByid(messageId); dynamic msgCatalogPayload = new ExpandoObject(); GetMessageCatalogPayload(messageId, msgCatalog.CompanyID, iotHubDeviceId, ref msgCatalogPayload, ""); Template template = new Template(); template.MessageId = messageId; template.MessageName = msgCatalog.Name; template.MessagePayload = msgCatalogPayload; return(template); }
public Format_Detail GetById(int id) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { MessageCatalog existingData = (from c in dbEntity.MessageCatalog.AsNoTracking() where c.Id == id select c).SingleOrDefault <MessageCatalog>(); if (existingData == null) { throw new CDSException(10701); } return(new Format_Detail() { Id = existingData.Id, Name = existingData.Name, Description = existingData.Description, MonitorFrequenceInMinSec = existingData.MonitorFrequenceInMinSec, ChildMessageFlag = existingData.ChildMessageFlag }); } }
protected virtual IMessageCatalog CreateMessageCatalog() { return(MessageCatalog = new MessageCatalog()); }