public static void ProcessRequest(GDPRMessageWrapper msg) { Type t = Type.GetType("GDPR.Util.Messages." + msg.Type); GDPRMessage actionMessage = (GDPRMessage)Newtonsoft.Json.JsonConvert.DeserializeObject(msg.Object, t); actionMessage.Process(); }
public static Guid SaveConsumerRequest(GDPRMessage msg) { Subject s = FindSubject(msg.Subject); if (s != null) { //check for a current pending request of same type... string sql = string.Format("select * from subjectrequest where subjectid = '{0}' and type = '{1}'", s.SubjectId, msg.GetType().Name); SubjectRequest sr = MasterGDPRHelper.GDPRDatabase.SubjectRequests.SqlQuery(sql).FirstOrDefault(); try { if (sr == null) { sr = new SubjectRequest(); sr.SubjectRequestId = Guid.NewGuid(); sr.Type = msg.GetType().Name; sr.SubjectId = s.SubjectId; sr.ModifyDate = DateTime.Now; sr.CreateDate = DateTime.Now; GDPRDatabase.Entry(sr).State = System.Data.Entity.EntityState.Added; GDPRDatabase.SaveChanges(); } } catch (Exception ex) { } return(sr.SubjectRequestId); } return(Guid.Empty); }
public void ProcessRequest(GDPRMessage message) { this.Request = message; GDPRSubject s = new GDPRSubject(message.Subject); switch (message.GetType().Name) { case "DeleteMessage": this.RecordDeleteIn(message.Subject); break; case "DataRequestMessage": List <GDPRSubject> customers = this.RecordSearch(s); foreach (GDPRSubject c in customers) { string storageLocation = this.ExportData(c.ApplicationSubjectId); //send a export message... ExportMessage em = new ExportMessage(); em.ApplicationId = Request.ApplicationId; em.ApplicationSubjectId = c.ApplicationSubjectId; em.SubjectRequestId = Request.SubjectRequestId; em.Subject = Request.Subject; em.BlobUrl = storageLocation; this.Response = em; MasterGDPRHelper.SendMessage(em); } break; } }
public string SubjectHold([FromUri] string applicationId, [FromUri] string subjectId, [FromUri] string emailAddress) { try { GDPRMessage msg = new GDPRMessage(); HoldMessage dm = new HoldMessage(); dm.ApplicationId = applicationId; dm.ApplicationSubjectId = subjectId; dm.Direction = "in"; msg = dm; GDPRSubject s = new GDPRSubject(); s.Email = emailAddress; msg.Subject = s; MasterGDPRHelper.SendMessage(msg); } catch { return("Failure"); } return("Success"); }
static public void SendMessage(GDPRMessage message) { GDPRMessageWrapper w = new GDPRMessageWrapper(); w.ApplicationId = message.ApplicationId; string msg = Newtonsoft.Json.JsonConvert.SerializeObject(message); w.Type = message.GetType().Name; w.Object = msg; w.MessageDate = DateTime.Now; SendMessage(w); }
public static void SaveApplicationRequest(GDPRMessage msg) { SubjectRequestApplication sr = new SubjectRequestApplication(); try { sr.SubjectRequestApplicationResultId = Guid.NewGuid(); sr.ApplicationId = Guid.Parse(msg.ApplicationId); sr.SubjectRequestId = Guid.Parse(msg.SubjectRequestId); sr.ModifyDate = DateTime.Now; sr.CreateDate = DateTime.Now; GDPRDatabase.Entry(sr).State = System.Data.Entity.EntityState.Added; GDPRDatabase.SaveChanges(); } catch (Exception ex) { GDPRDatabase.Entry(sr).State = System.Data.Entity.EntityState.Detached; } }
public static string CreateGDPRRequest(string emailAddress, string type) { try { GDPRMessage msg = new GDPRMessage(); switch (type) { case "Consent": DataSubjectConsentMessage dscm = new DataSubjectConsentMessage(); msg = dscm; break; case "Delete": DataSubjectDeleteMessage dm = new DataSubjectDeleteMessage(); msg = dm; break; case "Query": DataSubjectQueryMessage nm = new DataSubjectQueryMessage(); msg = nm; break; case "Update": DataSubjectUpdateMessage um = new DataSubjectUpdateMessage(); msg = um; break; } GDPRSubject s = new GDPRSubject(); s.Email = emailAddress; msg.Subject = s; MasterGDPRHelper.SendMessage(msg); } catch { return("Failure"); } return("Success"); }
public override string SendRequest(GDPRMessage message) { throw new NotImplementedException(); }
abstract public string SendRequest(GDPRMessage message);