public Task CreateAsync(Submitter invitee, Submission submission, UnconfirmedSubmissionOwner invitation) { using (var db = new WebGalleryDbContext()) { // remove invitation db.UnconfirmedSubmissionOwners.RemoveRange(from u in db.UnconfirmedSubmissionOwners where u.RequestID == invitation.RequestID select u); // if the invitee has no ownership for this app, add one var alreadyHasOwnership = db.SubmissionOwners.Any(o => o.SubmissionID == submission.SubmissionID && o.SubmitterID == invitee.SubmitterID); if (!alreadyHasOwnership) { db.SubmissionOwners.Add(new SubmissionOwner { SubmissionID = submission.SubmissionID, SubmitterID = invitee.SubmitterID }); } db.SaveChanges(); return(Task.FromResult(0)); } }
static public IControlBody ClientMain() { var rvInput = Var.Create(""); var submit = Submitter.CreateOption(rvInput.View); var vReversed = submit.View.MapAsync(input => { if (input == null) { return(Task.FromResult("")); } return(Remoting.DoSomething(input.Value)); }); return(div( input(rvInput), button("Send", submit.Trigger), hr(), h4( attr.@class("text-muted"), "The server responded:", div( attr.@class("jumbotron"), h1(vReversed) ) ) )); }
protected void Page_Init(object sender, EventArgs e) { Classes.AllData.Update(); SocialAPI fbAPI = new SocialAPI(); string code = Request.QueryString["code"]; #if DEBUG Session["Submitter"] = Submitter.GetSubmitterFromFBID(Hidden.TestFBID, Hidden.TestFBName); #endif if (Session["Submitter"] == null) { if (!string.IsNullOrEmpty(code)) { string[] accessTokenDetails = SocialAPI.GetAccessTokenAndExpirationDays(code, fbAPI); //store access token and expiration in your database for reuse/renew it fbAPI.AccessToken = accessTokenDetails[0]; string expiration = accessTokenDetails[1]; Submitter clsSubmitter = GetSubmitter(fbAPI); NLog.LogManager.GetCurrentClassLogger().Debug(UExtensionLibrary.Serialization.Serialization.Serialize(clsSubmitter)); Session["Submitter"] = clsSubmitter; btnFBLogin.OnClientClick = "return false;"; btnFBLogin.Text = clsSubmitter.strName; } } else { IsSubmitter = true; btnFBLogin.OnClientClick = "return false;"; btnFBLogin.Text = ((Submitter)Session["Submitter"]).strName; } }
static public IControlBody Main() { var rvInput = Var.Create(new JobSearchCriteria()); var submit = Submitter.CreateOption(rvInput.View); var vReversed = submit.View.MapAsync(input => { if (input == null) { return(Task.FromResult("")); } return(Task.FromResult("perd")); }); return(Html.div( Html.input(rvInput), Html.button("Send", submit.Trigger), Html.hr(), Html.h4( Html.attr.@class("text-muted"), "The server responded:", Html.div( Html.attr.@class("jumbotron"), Html.h1(vReversed) ) ) )); }
static void ClaimFile() { //process the import file List <Claim> claims = new ImportFile <Claim>().Import(IMPORT_FILENAME); //create submitter because this isn't in the import file (however, it'd be simple to use the import file //functionality to do so; however, my files were all from the same submitter) var submitter = new Submitter() { EIN = "SubmitterEIN", OrganizationName = "SubmitterORG", NPINumber = "NPI00000123", Type = EntityType.NonPerson, Address = new Address() { State = "TX", Street = "5250 N.Old Orchard Road", City = "Skokie", Zip = "60077-4462" }, Phone = "123-456-4567", Email = "*****@*****.**" }; //add submitter to each claim claims.ForEach(c => { c.Submitter = submitter; }); //generate the file var claimFile = new EDI_Claim_File(new XMLControlNumbers(), DataType.Test); File.WriteAllText(claimFile.ExportFilename, claimFile.ToEDI(claims, submitter)); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as DetailsComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (Predecessor != null) { dest.Predecessor = (Hl7.Fhir.Model.Identifier)Predecessor.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (Submitter != null) { dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopy(); } if (Response != null) { dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopy(); } if (Responsible != null) { dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopy(); } if (Payee != null) { dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopy(); } if (Amount != null) { dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopy(); } return(dest); }
public Task AddSuperSubmitterAsync(string microsoftAccount, string firstName, string lastName) { using (var db = new WebGalleryDbContext()) { var submitter = (from s in db.Submitters where s.MicrosoftAccount.Equals(microsoftAccount, StringComparison.OrdinalIgnoreCase) select s).FirstOrDefault(); // If the super submitter to be added hasn't had a submittership yet, add a new one first in the Submitters table. if (submitter == null) { submitter = new Submitter { MicrosoftAccount = microsoftAccount, PersonalID = string.Empty, PersonalIDType = 1, IsSuperSubmitter = true }; db.Submitters.Add(submitter); db.SaveChanges(); // save to database for new submitter id. } else { submitter.IsSuperSubmitter = true; } // For a new super submitter who has no record in table SubmitterContactDetails, // make a new one with the parameters firstName and lastName. // If the super submitter already has contact details in the table SubmittersContactDetails, we do nothing here. var contactDetail = (from c in db.SubmittersContactDetails where c.SubmitterID == submitter.SubmitterID select c).FirstOrDefault(); if (contactDetail == null) { contactDetail = new SubmittersContactDetail { SubmitterID = submitter.SubmitterID, FirstName = firstName, LastName = lastName }; db.SubmittersContactDetails.Add(contactDetail); } db.SaveChanges(); return(Task.FromResult(0)); } }
public static List <Claim> GenerateClaims(Submitter submitter) { var claims = new List <Claim>(); if (submitter == null) { return(claims); } claims.Add(new Claim(SubmitterClaimTypes.SubmitterId, submitter.SubmitterID.ToString())); claims.Add(new Claim(SubmitterClaimTypes.MicrosoftAccount, submitter.MicrosoftAccount ?? string.Empty)); claims.Add(new Claim(SubmitterClaimTypes.IsSuperSubmitter, submitter.IsSuperSubmitter().ToString().ToLower())); return(claims); }
private static void GameBananaAddSubmitter(GameBananaMod result, WebDownloadablePackage package) { var gbSubmitter = result.Submitter; var pkgSubmitter = new Submitter { UserName = gbSubmitter.Name, JoinDate = gbSubmitter.JoinDate, ProfileUrl = new Uri(gbSubmitter.ProfileUrl) }; if (gbSubmitter.AvatarUrl != null) { pkgSubmitter.AvatarUrl = new Uri(gbSubmitter.AvatarUrl); } package.Submitter = pkgSubmitter; }
public Submitter GetSubmitter(SocialAPI fbAPI) { try { dynamic userProfile = fbAPI.FbClient.Get("me?fields=id,name,birthday,email,education,photos{picture,album},cover"); try { NLog.LogManager.GetCurrentClassLogger().Debug(UExtensionLibrary.Serialization.Serialization.Serialize(userProfile)); } catch { } return(Submitter.GetSubmitterFromFBID(userProfile.id, userProfile.name)); } catch (FacebookApiException ex) { throw ex; } }
public Task <Submitter> SaveContactDetailAsync(string email, SubmittersContactDetail contactDetail) { using (var db = new WebGalleryDbContext()) { var submitter = (from s in db.Submitters where s.MicrosoftAccount.Equals(email, StringComparison.OrdinalIgnoreCase) select s).FirstOrDefault(); if (submitter == null) { submitter = new Submitter { MicrosoftAccount = email, PersonalID = string.Empty, PersonalIDType = 1, IsSuperSubmitter = null }; db.Submitters.Add(submitter); db.SaveChanges(); // save to database for new submitter id. } var contactDetailInDb = (from c in db.SubmittersContactDetails where c.SubmitterID == submitter.SubmitterID select c).FirstOrDefault(); if (contactDetailInDb == null) { contactDetail.SubmitterID = submitter.SubmitterID; db.SubmittersContactDetails.Add(contactDetail); } else { SyncContactDetailProperties(contactDetailInDb, contactDetail); } db.SaveChanges(); return(Task.FromResult(submitter)); } }
public PullRequest ToPullRequest() { var pr = new PullRequest { Title = Title.Trim(), Number = Number, Id = Number, HtmlUrl = Links["html"].Href, State = State, Submitter = Submitter.ToUser(), OpenedAt = CreatedAt, UpdatedAt = UpdatedAt, // BitBucket does not have a timestamp associated with closure. We use the time a PR was closed to group pull request into day-based // aggregates. We never overwrite ClosedAt, but we do overwrite UpdatedAt in the event that Scorer configuration changes, among other things // TODO: at some point when we do a C# 9 upgrade, make ClosedAt an init-only property so no one accidentally overwrites the value and // TODO: messes up their aggregations ClosedAt = UpdatedAt, Body = Summary.Raw.Trim(), }; return(pr); }
protected override void Seed(ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. context.Database.ExecuteSqlCommand("sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'"); context.Database.ExecuteSqlCommand("sp_MSForEachTable 'IF OBJECT_ID(''?'') NOT IN (ISNULL(OBJECT_ID(''[dbo].[__MigrationHistory]''),0)) DELETE FROM ?'"); context.Database.ExecuteSqlCommand("EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'"); /*Roles*/ string[] roles = { "Admin", "Manager", "Developer", "Submitter" }; foreach (var RoleName in roles) { if (!context.Roles.Any(r => r.Name == RoleName))/*Developer Role*/ { var store = new RoleStore <IdentityRole>(context); var manager = new RoleManager <IdentityRole>(store); var role = new IdentityRole { Name = RoleName }; manager.Create(role); } } /*Users*/ var appUsers = new List <ApplicationUser>(); string[] Users = { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**","*****@*****.**", "*****@*****.**","*****@*****.**" }; foreach (var usr in Users) { var PasswordHash = new PasswordHasher(); ApplicationUser user; if (usr.StartsWith("sub")) { user = new Submitter { UserName = usr, Email = usr, PasswordHash = PasswordHash.HashPassword("123456"), Tickets = new HashSet <Ticket>() }; } else if (usr.StartsWith("dev")) { user = new Developer { UserName = usr, Email = usr, PasswordHash = PasswordHash.HashPassword("123456") }; } else { user = new ApplicationUser { UserName = usr, Email = usr, PasswordHash = PasswordHash.HashPassword("123456") }; } if (!context.Users.Any(u => u.UserName == usr)) { var store = new UserStore <ApplicationUser>(context); var manager = new UserManager <ApplicationUser>(store); manager.Create(user); if (usr.StartsWith("admin")) { manager.AddToRole(user.Id, "Admin"); } else if (usr.StartsWith("manager")) { manager.AddToRole(user.Id, "Manager"); } else if (usr.StartsWith("developer")) { manager.AddToRole(user.Id, "Developer"); } else if (usr.StartsWith("submitter")) { manager.AddToRole(user.Id, "Submitter"); } appUsers.Add(user); } } if (appUsers.Count == 0) { appUsers = context.Users.ToList(); } TicketProperty[] ticketProperties = { new TicketProperty { Id = 1, Name = "Normal" }, new TicketProperty { Id = 2, Name = "Property 2" }, new TicketProperty { Id = 3, Name = "Urgent" }, }; TicketType[] ticketTypes = { new TicketType { Id = 1, Name = "Request" }, new TicketType { Id = 2, Name = "Incident" }, new TicketType { Id = 3, Name = "Question" }, }; TicketStatus[] ticketStatuses = { new TicketStatus { Id = 1, Name = "Assigned" }, new TicketStatus { Id = 2, Name = "Unassigned" }, new TicketStatus { Id = 3, Name = "Completed" }, }; context.Properties.AddOrUpdate(t => t.Name, ticketProperties); context.Types.AddOrUpdate(t => t.Name, ticketTypes); context.Statuses.AddOrUpdate(t => t.Name, ticketStatuses); Ticket[] tickets = { new Ticket() { Id = 1, Title = "ticket 1", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 1, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 2, Title = "ticket 2", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 1, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 3, Title = "ticket 3", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 1, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 2, TicketStatusId = 1, }, new Ticket() { Id = 4, Title = "ticket 4", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 1, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 2, TicketTypeId = 1, TicketStatusId = 3, }, new Ticket() { Id = 5, Title = "ticket 5", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 1, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 2, TicketTypeId = 2, TicketStatusId = 2, }, new Ticket() { Id = 6, Title = "ticket 6", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 7, Title = "ticket 7", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 8, Title = "ticket 8", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 9, Title = "ticket 9", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 10, Title = "ticket 10", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 11, Title = "ticket 11", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 12, Title = "ticket 12", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 13, Title = "ticket 13", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 1, TicketTypeId = 1, TicketStatusId = 1, }, new Ticket() { Id = 14, Title = "ticket 14", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 3, TicketTypeId = 1, TicketStatusId = 2, }, new Ticket() { Id = 15, Title = "ticket 15", OwnerId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, ProjectId = 2, AssignedUserId = appUsers.Find(i => i.UserName == "*****@*****.**").Id, Created = DateTime.Now, Updated = DateTime.Now, TicketPropertyId = 2, TicketTypeId = 2, TicketStatusId = 3, } }; Project[] projects = { new Project { Id = 1, Title = "Bug Track Project 1", IsArchived = false, // Tickets= tickets.Where(i=>i.ProjectId==1).ToList(), ApplicationUsers = appUsers.Where(i => i.UserName.StartsWith("admin") || i.UserName.StartsWith("manager1")).ToList() }, new Project { Id = 2, Title = "Bug Track Project 2", IsArchived = false, // Tickets= tickets.Where(i=>i.ProjectId==2).ToList(), ApplicationUsers = appUsers.Where(i => i.UserName.StartsWith("admin") || i.UserName.StartsWith("manager2")).ToList() } }; context.Projects.AddOrUpdate(t => t.Title, projects); context.Tickets.AddOrUpdate(t => t.Title, tickets); }
public static IControlBody Main() { //var myList = Var.Create<IEnumerable<string>>(OddJobRemoting.Handle()); var criteria = Var.Create(new JobSearchCriteria()); var useQueueLens = criteria.Lens(q => q.UseQueue, (a, b) => { a.UseQueue = b; return(a); }); var statusLens = criteria.Lens(q => q.Status, (a, b) => { a.Status = b; return(a); }); var useStatus = criteria.Lens(q => q.UseStatus, (a, b) => { a.UseStatus = b; return(a); }); var methodLens = criteria.Lens(q => q.MethodName, (a, b) => { a.MethodName = b; return(a); }); var useMethod = criteria.Lens(q => q.UseMethod, (a, b) => { a.UseMethod = b; return(a); }); var statusOptions = Var.Create <IEnumerable <string> >(new[] { null, "Processed", "New", "Failed", "Retry", "InProgress", "Inserting" }); var dummyQueueCriteriaFiller = Var.Create(""); var criteriaFiller = Submitter.CreateOption(dummyQueueCriteriaFiller.View); var updateSet = new ListModel <string, JobUpdateViewModel>(q => q.JobGuid.ToString()); var queueNames = Var.Create <IEnumerable <string> >(new string[] { null }); var queueNameView = criteriaFiller.View.MapAsync(async input => { queueNames.Value = await WebSharper.JavaScript.Pervasives .Remote <OddJobRemotingWrapper>().Handle(new QueueNameListRequest()); return(queueNames.Value); }); criteriaFiller.Trigger(); var methodCriteria = Var.Create <IEnumerable <string> >(new string[] { null }); var submit = Submitter.CreateOption(criteria.View); var result = updateSet.Doc(juvm => { var map = updateSet.Lens(juvm.JobGuid.ToString()); var myUpdateItem = Var.Create(Html.div()); var jobParamUpdate = juvm.UpdateData.ParamUpdates.Select((updateDateParamUpdate, i) => { return(CreateParamterUpdateElement(map, i, juvm)); }).ToArray(); var newMethodName = map.Lens(uvm => uvm.UpdateData.NewMethodName, (a, b) => { a.UpdateData.NewMethodName = b; return(a); }); var updateMethodName = map.Lens(uvm => uvm.UpdateData.UpdateMethodName, (a, b) => { a.UpdateData.UpdateMethodName = b; return(a); }); var updateStatus = map.Lens(uvm => uvm.UpdateData.UpdateStatus, (a, b) => { a.UpdateData.UpdateStatus = b; return(a); }); var newStatus = map.Lens(uvm => uvm.UpdateData.NewStatus, (a, b) => { a.UpdateData.NewStatus = b; return(a); }); var updateQueue = map.Lens(uvm => uvm.UpdateData.UpdateQueueName, (a, b) => { a.UpdateData.UpdateQueueName = b; return(a); }); var newQueue = map.Lens(uvm => uvm.UpdateData.NewQueueName, (a, b) => { a.UpdateData.NewQueueName = b; return(a); }); var updateMaxRetryCount = map.Lens(uvm => uvm.UpdateData.UpdateRetryCount, (a, b) => { a.UpdateData.UpdateRetryCount = b; return(a); }); var newMaxRetryCount = map.Lens(uvm => uvm.UpdateData.NewMaxRetryCount, (a, b) => { a.UpdateData.NewMaxRetryCount = b; return(a); }); var blurFilter = Var.Create(""); var disableUpdate = Var.Create(false); var disabledVar = Var.Create("Disabled"); var disabledColor = Var.Create(""); return(Html.div(Html.style("display", "grid"), Html.style("grid-template-columns", "50% 50%"), Html.style("filter", blurFilter.View), Html.style("background", disabledColor.View), Html.div( new Jobitem.JobItem().MethodName(juvm.MetaData.MethodName).QueueName(juvm.MetaData.Queue) .Status(juvm.MetaData.Status) .JobGuid(juvm.MetaData.JobId.ToString()).Doc() ), Html.div( Html.div( Html.div(ElementCreators.CheckableTextInput("Status", updateStatus, newStatus, juvm.MetaData.Status)), Html.div(ElementCreators.CheckableTextInput("MethodName", updateMethodName, newMethodName, juvm.MetaData.MethodName)), Html.div(ElementCreators.CheckableTextInput("QueueName", updateQueue, newQueue, juvm.MetaData.Queue)), Html.div(ElementCreators.CheckableNumberInput("MaxRetryCount", updateMaxRetryCount, newMaxRetryCount, juvm.MetaData.RetryParameters.MaxRetries)) ) ), //TODO: This looks bad with lots of Parameters. Html.div(Html.div(juvm.MetaData.JobArgs.Select((r, i) => Html.div(new Jobparameter.JobParameter().Type(r.Type).Name(r.Name).Value(r.Value) .Ordinal(i.ToString()).Doc())).ToArray())), Html.div(Html.style("margin-left", "5%"), Html.div(jobParamUpdate)), Html.button("Update", async() => { if (juvm == null) { myUpdateItem.Value = Html.div(""); } var success = await PerformJobUpdate(juvm); if (success) { myUpdateItem.Value = Html.div("Updated"); blurFilter.Value = "blur(1px)"; disabledColor.Value = "lightgrey"; disableUpdate.Value = true; } else { myUpdateItem.Value = Html.div("Failed update"); } }, Html.attr.disabled(disabledVar.View, disableUpdate.View)), Html.div(myUpdateItem) )); }); var results = submit.View.MapAsync(async input => { return(await CreateSearchResults(input, methodCriteria, updateSet, result)); }); var queueNameLens = criteria.Lens(q => q.QueueName, (a, b) => { a.QueueName = b; return(a); }); var useCreatedLens = criteria.Lens(q => q.useCreatedDate, (a, b) => { a.useCreatedDate = b; return(a); }); var createdBeforeDateLens = criteria.Lens(q => q.createdBefore, (a, b) => { a.createdBefore = b; return(a); }); var createdAfterDateLens = criteria.Lens(q => q.createdAfter, (a, b) => { a.createdBefore = b; return(a); }); var createdBeforeTimeLens = criteria.Lens(q => q.createdBeforeTime, (a, b) => { a.createdBeforeTime = b; return(a); }); var createdAfterTimeLens = criteria.Lens(q => q.createdAfterTime, (a, b) => { a.createdAfterTime = b; return(a); }); var useAttemptedDTLens = criteria.Lens(q => q.useLastAttemptDate, (a, b) => { a.useLastAttemptDate = b; return(a); }); var lastExecutedBeforeTimeLens = criteria.Lens(q => q.attemptedBeforeTime, (a, b) => { a.attemptedBeforeTime = b; return(a); }); var lastExecutedBeforeDateLens = criteria.Lens(q => q.attemptedBeforeDate, (a, b) => { a.attemptedBeforeDate = b; return(a); }); var lastExecutedAfterTimeLens = criteria.Lens(q => q.attemptedAfterTime, (a, b) => { a.attemptedAfterTime = b; return(a); }); var lastExecutedAfterDateLens = criteria.Lens(q => q.attemptedAfterDate, (a, b) => { a.attemptedAfterDate = b; return(a); }); var content = Html.div(Html.div(Html.style("width", "100%"), Html.div(ElementCreators.OptionSearch("Queue Name", queueNameLens, queueNameView, useQueueLens, (r, e) => submit.Trigger()), ElementCreators.TextSearch("Method Name", methodLens, useMethod), ElementCreators.OptionSearch("Status", statusLens, statusOptions.View, useStatus, (a, b) => submit.Trigger()), ElementCreators.OptionSearch("Method", methodLens, methodCriteria.View, useMethod, (a, b) => submit.Trigger()), ElementCreators.DateTimeRangeSearch("Created", useCreatedLens, createdBeforeDateLens, createdBeforeTimeLens, createdAfterDateLens, createdAfterTimeLens), ElementCreators.DateTimeRangeSearch("Attempt", useAttemptedDTLens, lastExecutedBeforeDateLens, lastExecutedBeforeTimeLens, lastExecutedAfterDateLens, lastExecutedAfterTimeLens), Html.div(Html.button("Search", submit.Trigger)))), Html.div(Html.br()), Html.div(Html.style("overflow-y", "scroll"), results) ); return(content); }
public string ToEDI(IEnumerable <Claim> claims, Submitter submitter) //todo: group by submitter { EDILines = new List <string>(); int HLLevel = 1; //get ISA header AddEDILine(EDIVal(SegmentType.InterchangeBegin_ISA), "00", new string(' ', 10), "00", new string(' ', 10), "ZZ", SENDER_TIN.PadToLength(15), "ZZ", RECEIVER_TIN.PadToLength(15), DateTime.UtcNow.ToString("yyMMdd"), DateTime.UtcNow.ToString("HHmm"), REPETITION_DELIM, "00501", ControlNumbers.GetIncrementedStr(EDIVal(SegmentType.InterchangeBegin_ISA), 9), "0", //ack not required EDIVal(DataType), USAGE_DELIM ); //group header AddEDILine(EDIVal(SegmentType.GroupBegin_GS), EDIVal(EDIFileType.HealthcareClaim), PARTNER_ID, RECEIVER_ID, DateTime.UtcNow.ToString(DT_FMT_D8), DateTime.UtcNow.ToString("HHmm"), ControlNumbers.GetIncrementedStr(EDIVal(SegmentType.GroupBegin_GS)), "X", VRI_ID_CODE ); //837 transaction starts here AddEDILine(EDIVal(SegmentType.TransactionSetBegin_ST), TX_SET_ID, ControlNumbers.GetIncrementedStr(EDIVal(SegmentType.TransactionSetBegin_ST)).PadToLength(4, '0'), VRI_ID_CODE ); AddEDILine(EDIVal(SegmentType.HLTxBegin_BHT), "0019", //structure code "00", //tx purpose: original, other option: 18 ControlNumbers.GetIncrementedStr(EDIVal(SegmentType.HLTxBegin_BHT)), DateTime.UtcNow.ToString(DT_FMT_D8), DateTime.UtcNow.ToString("HHmm"), "CH" //chargeable (other option: RP) ); //1000A: submitter AddEDILine(EDIVal(SegmentType.ResponsiblePerson_NM1), EDIVal(ResponsiblePersonType.Submitter), EDIVal(submitter.Type), submitter.SubmitterName, submitter.FirstName, //empty if organization submitter.Name.MiddleInitial, //empty if organization "", //NM106 - prefix "", //suffix "46", //ID code qualifier: ETIN SENDER_TIN ); //submitter contact info AddEDILine(EDIVal(SegmentType.ContactInfo_PER), EDIVal(ContactInfoPersonType.InformationContact), submitter.SubmitterName, EDIVal(ContactInfoType.Telephone), submitter.Phone.ToNumeric(), EDIVal(ContactInfoType.Email), submitter.Email ); //1000B: receiver (Insurer/TPA) AddEDILine(EDIVal(SegmentType.ResponsiblePerson_NM1), EDIVal(ResponsiblePersonType.Receiver), EDIVal(EntityType.NonPerson), RECEIVER_ID, "", "", "", "", //NM104-NM107 EDIVal(IDType.ETIN), RECEIVER_TIN ); foreach (var claim in claims) { //2000A: billing provider Loop AddEDILine(EDIVal(SegmentType.HierarchicalLevel_HL), (HLLevel).ToString(), "", //HL02 EDIVal(HierarchicalLevelCode.InformationSource), EDIVal(HierarchicalChildCode.HasChild) ); AddEDILine(EDIVal(SegmentType.BillingProviderTaxonomy_PRV), "BI", "PXC", Taxonomy_Code ); //2010AA: Billing Provider AddEDILine(EDIVal(SegmentType.ResponsiblePerson_NM1), EDIVal(ResponsiblePersonType.BillingProvider), EDIVal(submitter.Type), submitter.SubmitterName, submitter.FirstName, //empty if organization submitter.Name.MiddleInitial, //empty if organization "", //NM106 "", //suffix EDIVal(IDType.NationalProviderID), submitter.NPINumber ); AddEDILine(EDIVal(SegmentType.AddressStreet_N3), submitter.Address.Street, "" //second address line ); AddEDILine(EDIVal(SegmentType.AddressCSZ_N4), submitter.Address.City, submitter.Address.State, submitter.Address.Zip ); AddEDILine(EDIVal(SegmentType.Info_REF), EDIVal(IDType.EIN), submitter.EIN ); //2000B: Subscriber loop AddEDILine(EDIVal(SegmentType.HierarchicalLevel_HL), (HLLevel + 1).ToString(), (HLLevel).ToString(), EDIVal(HierarchicalLevelCode.Subscriber), EDIVal(claim.ChildCode) ); HLLevel += 2; AddEDILine(EDIVal(SegmentType.Subscriber_SBR), EDIVal(ResponsibilitySequence.PrimaryPayer), EDIVal(claim.Patient.Relationship), claim.EmploymentInfo.GroupID, claim.EmploymentInfo.EmployerName, "", //insurance type code "", "", "", //SBR06-SBR08 "15" //type of claim ); //2010BA AddEDILine(EDIVal(SegmentType.ResponsiblePerson_NM1), EDIVal(ResponsiblePerson.InsuredOrSubscriber), EDIVal(EntityType.Person), claim.LastName, claim.FirstName, claim.Name.MiddleInitial, "", "", //prefix & suffix: NM106-NM107 EDIVal(IDType.MemberID), claim.SubscriberID ); AddEDILine(EDIVal(SegmentType.AddressStreet_N3), claim.Address.Street, "" //second address line ); AddEDILine(EDIVal(SegmentType.AddressCSZ_N4), claim.Address.City, claim.Address.State, claim.Address.Zip ); AddEDILine(EDIVal(SegmentType.Demographics_DMG), "D8", claim.DOB.ToString(DT_FMT_D8), EDIVal(claim.Gender), EDIVal(claim.MaritalStatus) ); AddEDILine(EDIVal(SegmentType.ResponsiblePerson_NM1), EDIVal(ResponsiblePersonType.Payer), EDIVal(EntityType.NonPerson), RECEIVER_ID, "", "", "", "", //NM104-NM107 EDIVal(IDType.PlanID), RECEIVER_TIN //I'm at a loss as to how this is the PlanID ); //2300: Claim Information AddEDILine(EDIVal(SegmentType.ClaimInfo_CLM), claim.ClaimNumber, claim.ClaimAmount, "", "", //CLM03 & CLM04 claim.Facility, EDIVal(ResponseCode.No), //no physical signature "C", //medicare assignment code EDIVal(ResponseCode.No), //response code to... I'm not actually sure. "I", //release of information, other option "Y" "P" //patient signature on file ); AddEDILine(EDIVal(SegmentType.Diagnosis_HI), $"{EDIVal(CodeList.ICD10)}{USAGE_DELIM}{claim.ICDCode}" ); foreach (var service in claim.Services) { //2400: Service Line AddEDILine(EDIVal(SegmentType.ServiceLine_LX), ControlNumbers.GetIncrementedStr(EDIVal(SegmentType.ServiceLine_LX)) ); AddEDILine(EDIVal(SegmentType.ProfessionalService_SV1), $"HC{USAGE_DELIM}{service.ProcedureCode}", service.Amount.ToString(), "UN", //Units service.Units.ToString(), "", "", "1", //diagnosis code pointer "", "", "", "", "", "", "", "", "", //SV108-SV116 service.ServiceID ); AddEDILine(EDIVal(SegmentType.DateTime_DTP), EDIVal(DateType.DateOfService), "D8", service.DateOfService.ToString(DT_FMT_D8) ); } } var segmentCount = EDILines.Count() - 1; //initial ISA segment doesn't count AddEDILine(EDIVal(SegmentType.TransactionSetEnd_SE), segmentCount.ToString(), ControlNumbers.GetCurrentStr(EDIVal(SegmentType.TransactionSetBegin_ST)).PadToLength(4, '0') ); AddEDILine(EDIVal(SegmentType.GroupEnd_GE), "1", ControlNumbers.GetCurrentStr(EDIVal(SegmentType.GroupBegin_GS)) ); AddEDILine(EDIVal(SegmentType.InterchangeEnd_IEA), "1", ControlNumbers.GetCurrentStr(EDIVal(SegmentType.InterchangeBegin_ISA), 9) ); //save control numbers ControlNumbers.SaveControlNumbers(); return(string.Join(JoinString, EDILines)); }
public void SendMessageForSubmission(Submitter submitter, Submission submission, string action, string urlAuthority, Func <string, string> htmlEncode) { if (submitter == null || submission == null) { return; } using (var db = new WebGalleryDbContext()) { var contactInfo = (from c in db.SubmittersContactDetails where c.SubmitterID == submitter.SubmitterID select c).FirstOrDefault(); var metadata = (from m in db.SubmissionLocalizedMetaDatas where m.SubmissionID == submission.SubmissionID select m).ToList(); var packages = (from p in db.Packages where p.SubmissionID == submission.SubmissionID select p).ToList(); var frameworkName = (from f in db.FrameworksAndRuntimes where f.FrameworkOrRuntimeID == submission.FrameworkOrRuntimeID select f.Name).FirstOrDefault(); var categoryName1 = (from c in db.ProductOrAppCategories where c.CategoryID.ToString() == submission.CategoryID1 select c.Name).FirstOrDefault(); var categoryName2 = (from c in db.ProductOrAppCategories where c.CategoryID.ToString() == submission.CategoryID2 select c.Name).FirstOrDefault(); var owners = (from o in db.SubmissionOwners join d in db.SubmittersContactDetails on o.SubmitterID equals d.SubmitterID where o.SubmissionID == submission.SubmissionID select d).ToList(); // html encode some fields submission.Version = htmlEncode(submission.Version); submission.SubmittingEntity = htmlEncode(submission.SubmittingEntity); submission.AdditionalInfo = htmlEncode(submission.AdditionalInfo); foreach (var m in metadata) { m.Name = htmlEncode(m.Name); m.Description = htmlEncode(m.Description); m.BriefDescription = htmlEncode(m.BriefDescription); } foreach (var p in packages) { p.StartPage = htmlEncode(p.StartPage); p.SHA1Hash = htmlEncode(p.SHA1Hash); } // build subject and body var subject = BuildSubject(submission, action); var body = BuildBody(submitter, contactInfo, submission, categoryName1, categoryName2, frameworkName, metadata, packages, action, urlAuthority); body += "Submission:<br/>"; // create a new anonymous object for serialization // to avoid the error "The ObjectContext instance has been disposed ..." var submissionJson = new { SubmissionID = submission.SubmissionID, Nickname = submission.Nickname, Version = submission.Version, SubmittingEntity = submission.SubmittingEntity, SubmittingEntityURL = submission.SubmittingEntityURL, AppURL = submission.AppURL, SupportURL = submission.SupportURL, ReleaseDate = submission.ReleaseDate, ProfessionalServicesURL = submission.ProfessionalServicesURL, CommercialProductURL = submission.CommercialProductURL, CategoryID1 = submission.CategoryID1, CategoryID2 = submission.CategoryID2, LogoUrl = submission.LogoUrl, ScreenshotUrl1 = submission.ScreenshotUrl1, ScreenshotUrl2 = submission.ScreenshotUrl2, ScreenshotUrl3 = submission.ScreenshotUrl3, ScreenshotUrl4 = submission.ScreenshotUrl4, ScreenshotUrl5 = submission.ScreenshotUrl5, ScreenshotUrl6 = submission.ScreenshotUrl6, FrameworkOrRuntimeID = submission.FrameworkOrRuntimeID, DatabaseServerIDs = submission.DatabaseServerIDs, WebServerExtensionIDs = submission.WebServerExtensionIDs, AgreedToTerms = submission.AgreedToTerms, AdditionalInfo = submission.AdditionalInfo, Created = submission.Created, Updated = submission.Updated, }; body += JsonConvert.SerializeObject(submissionJson, Formatting.Indented).Replace(" ", " ").Replace("\r\n", "<br/>"); body += "<hr/><br/><br/>Submission Metadata:<br/>"; body += JsonConvert.SerializeObject(metadata, Formatting.Indented).Replace(" ", " ").Replace("\r\n", "<br/>"); // get the from email address var from = GetFromMailAddress(); // First send email internally (to folks at MS). var to = from.Address; SendGridEmailHelper.SendAsync(subject, BuildHtmlStyles() + body, from.Address, from.DisplayName, to); // Second, send email externally (to the app owners). Here, we don't include the XML. foreach (var owner in owners) { var note = string.Empty; switch (action) { case "VERIFIED": note = BuildSubmissionNote(htmlEncode(owner.FullName), from.Address, submission.Nickname, submission.Version, urlAuthority); break; case "PUBLISHED": note = BuildPublishNote(htmlEncode(owner.FullName), submission.Nickname, submission.Version, urlAuthority); break; default: break; } to = owner.EMail; body = note + BuildBody(submitter, contactInfo, submission, categoryName1, categoryName2, frameworkName, metadata, packages, action, urlAuthority); SendGridEmailHelper.SendAsync(subject, BuildHtmlStyles() + body, from.Address, from.DisplayName, to); } } }
public void SendMessageForSubmissionPublished(Submitter submitter, Submission submission, string urlAuthority, Func <string, string> htmlEncode) { SendMessageForSubmission(submitter, submission, "PUBLISHED", urlAuthority, htmlEncode); }
public void SendMessageForSubmissionVerified(Submitter submitter, Submission submission, string urlAuthority, Func <string, string> htmlEncode) { SendMessageForSubmission(submitter, submission, "VERIFIED", urlAuthority, htmlEncode); }
private static string BuildBody(Submitter submitter, SubmittersContactDetail contactInfo, Submission submission, string categoryName1, string categoryName2, string frameworkName, IList <SubmissionLocalizedMetaData> metadata, IList <Package> packages, string action, string urlAuthority) { var body = new StringBuilder(); body.Append($"SUBMISSION {action}: {submission.Nickname}<br /><br />"); body.Append(submitter.IsSuperSubmitter() ? string.Empty : $"<a href='https://{urlAuthority}/profiles/{submitter.SubmitterID}'>{contactInfo.FullName}'s contact information</a><br />"); body.Append($"<a href='https://{urlAuthority}/apps/{submission.SubmissionID}/preview'>Preview this submission</a><br />"); body.Append($"<a href='https://{urlAuthority}/apps/{submission.SubmissionID}/edit'>Edit this submission</a><br />"); // logo and screenshots body.Append($"<a href='{submission.LogoUrl}'>Logo</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl1) ? string.Empty : $"<a href='{submission.ScreenshotUrl1}'>Screenshot 1</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl2) ? string.Empty : $"<a href='{submission.ScreenshotUrl2}'>Screenshot 2</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl3) ? string.Empty : $"<a href='{submission.ScreenshotUrl3}'>Screenshot 3</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl4) ? string.Empty : $"<a href='{submission.ScreenshotUrl4}'>Screenshot 4</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl5) ? string.Empty : $"<a href='{submission.ScreenshotUrl5}'>Screenshot 5</a><br />"); body.Append(string.IsNullOrWhiteSpace(submission.ScreenshotUrl6) ? string.Empty : $"<a href='{submission.ScreenshotUrl6}'>Screenshot 6</a><br />"); // nickname, version, ... body.Append("<table><caption>General</caption>"); body.Append($"<tr><td class='name'>Nickname</td><td>{submission.Nickname}</td></tr>"); body.Append($"<tr><td class='name'>Version</td><td>{submission.Version}</td></tr>"); body.Append($"<tr><td class='name'>Submitting Entity</td><td>{submission.SubmittingEntity}</td></tr>"); body.Append($"<tr><td class='name'>Submitting Entity URL</td><td>{GenerateLink(submission.SubmittingEntityURL)}</td></tr>"); body.Append($"<tr><td class='name'>App URL</td><td>{GenerateLink(submission.AppURL)}</td></tr>"); body.Append($"<tr><td class='name'>Support URL</td><td>{GenerateLink(submission.SupportURL)}</td></tr>"); body.Append($"<tr><td class='name'>Release Date</td><td>{submission.ReleaseDate.ToShortDateString()}</td></tr>"); body.Append($"<tr><td class='name'>Primary Category</td><td>{categoryName1}</td></tr>"); body.Append($"<tr><td class='name'>Secondary Category</td><td>{categoryName2}</td></tr>"); body.Append($"<tr><td class='name'>Professional Services URL</td><td>{GenerateLink(submission.ProfessionalServicesURL)}</td></tr>"); body.Append($"<tr><td class='name'>Commercial Product URL</td><td>{GenerateLink(submission.CommercialProductURL)}</td></tr>"); body.Append($"<tr><td class='name'>Release Notes</td><td>{submission.AdditionalInfo}</td></tr>"); body.Append("</table>"); // add metadata body.Append("<table><caption>Language Dependent Data</caption>"); body.Append("<tr><td class='parent-of-table'>"); foreach (var lang in Language.SupportedLanguages) { var md = metadata.FirstOrDefault(m => m.Language == lang.Name && m.SubmissionID == submission.SubmissionID); if (md != null) { body.Append("<table>"); body.Append($"<caption>{lang.ShortDisplayName}</caption>"); body.Append("<tr>"); body.Append($"<td class='name'>Name</td><td dir='{lang.TextDirection}'>{md.Name}</td>"); body.Append("</tr>"); body.Append("<tr>"); body.Append($"<td class='name'>Description</td><td dir='{lang.TextDirection}'>{md.Description}</td>"); body.Append("</tr>"); body.Append("<tr>"); body.Append($"<td class='name'>Brief Description</td><td dir='{lang.TextDirection}'>{md.BriefDescription}</td>"); body.Append("</tr>"); body.Append("</table>"); } } body.Append("</td></tr>"); body.Append("</table>"); // add Dependencies body.Append("<table><caption>Dependencies</caption>"); body.Append($"<tr><td class='name'>Framework or Runtime</td><td>{frameworkName}</td></tr>"); body.Append($"<tr><td class='name'>DatabaseServerIDs</td><td>{submission.DatabaseServerIDs}</td></tr>"); body.Append($"<tr><td class='name'>WebServerExtensionIDs</td><td>{submission.WebServerExtensionIDs}</td></tr>"); body.Append("</table>"); // add packages body.Append("<table><caption>Packages</caption>"); body.Append("<tr><td class='parent-of-table'>"); foreach (var lang in Language.SupportedLanguages) { var package = packages.FirstOrDefault(p => p.Language == lang.Name && p.SubmissionID == submission.SubmissionID); if (package != null) { body.Append("<table>"); body.Append($"<caption>{lang.ShortDisplayName}</caption>"); body.Append("<tr>"); body.Append("<td>"); body.Append("<table><caption>x86 Package</caption>"); body.Append($"<tr><td class='name'>Package URL</td><td>{GenerateLink(package.PackageURL)}</td></tr>"); body.Append($"<tr><td class='name'>Start Page</td><td>{package.StartPage}</td></tr>"); body.Append($"<tr><td class='name'>SHA-1 Hash</td><td>{package.SHA1Hash}</td></tr>"); body.Append($"<tr><td class='name'>File Size</td><td>{package.FileSize}</td></tr>"); body.Append($"<tr><td class='name'>Language</td><td>{package.Language}</td></tr>"); body.Append("</table>"); body.Append("</td>"); body.Append("</tr>"); body.Append("</table>"); } } body.Append("</td></tr>"); body.Append("</table>"); // the end body.Append("<hr /><br /><br />"); return(body.ToString()); }
public static void SignInAsSubmitter(this IAuthenticationManager authMangaer, Submitter submitter) { var userIdentity = authMangaer.User.Identity as ClaimsIdentity; if (userIdentity != null && submitter != null) { var claims = SubmitterClaims.GenerateClaims(submitter); userIdentity.AddClaims(claims); authMangaer.SignIn(userIdentity); } }
public bool IsOwner(Object other) { return(other.ToString().Equals(Submitter.ToString())); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false); if (Identifier != null) { writer.WritePropertyName("identifier"); Identifier.SerializeJson(writer, options); } if (Predecessor != null) { writer.WritePropertyName("predecessor"); Predecessor.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (Request != null) { writer.WritePropertyName("request"); Request.SerializeJson(writer, options); } if (Submitter != null) { writer.WritePropertyName("submitter"); Submitter.SerializeJson(writer, options); } if (Response != null) { writer.WritePropertyName("response"); Response.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Date)) { writer.WriteString("date", (string)Date !); } if (_Date != null) { writer.WritePropertyName("_date"); _Date.SerializeJson(writer, options); } if (Responsible != null) { writer.WritePropertyName("responsible"); Responsible.SerializeJson(writer, options); } if (Payee != null) { writer.WritePropertyName("payee"); Payee.SerializeJson(writer, options); } if (Amount != null) { writer.WritePropertyName("amount"); Amount.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
protected void Page_Init(object sender, EventArgs e) { SocialAPI fbAPI = new SocialAPI(); var provider = Request.QueryString["provider"]; if (provider == "google") { var result = OAuthWeb.VerifyAuthorization(); if (!result.IsSuccessfully) { throw new UnauthorizedAccessException("Not authorized"); } if (result.ProviderName != "Google") { throw new NotSupportedException("Provider not supported"); } fbAPI.AccessToken = result.AccessToken; Submitter clsSubmitter = Submitter.GetSubmitterFromFBID("google-" + result.UserId, result.UserInfo.DisplayName); Session["Submitter"] = clsSubmitter; IsSubmitter = true; btnFBLogin.OnClientClick = "return false;"; btnFBLogin.Text = ((Submitter)Session["Submitter"]).strName; btnGoogleLogin.Visible = false; return; } Classes.AllData.Update(); string code = Request.QueryString["code"]; //#if DEBUG // Session["Submitter"] = Submitter.GetSubmitterFromFBID(Hidden.TestFBID, Hidden.TestFBName); //#endif if (Session["Submitter"] == null) { if (!string.IsNullOrEmpty(code)) { string[] accessTokenDetails = SocialAPI.GetAccessTokenAndExpirationDays(code, fbAPI); //store access token and expiration in your database for reuse/renew it fbAPI.AccessToken = accessTokenDetails[0]; string expiration = accessTokenDetails[1]; Submitter clsSubmitter = GetSubmitter(fbAPI); NLog.LogManager.GetCurrentClassLogger().Debug(UExtensionLibrary.Serialization.Serialization.Serialize(clsSubmitter)); Session["Submitter"] = clsSubmitter; btnFBLogin.OnClientClick = "return false;"; btnFBLogin.Text = clsSubmitter.strName; btnGoogleLogin.Visible = false; } } else { IsSubmitter = true; btnFBLogin.OnClientClick = "return false;"; btnFBLogin.Text = ((Submitter)Session["Submitter"]).strName; btnGoogleLogin.Visible = false; } }