Example #1
0
        public ActionResult DeleteLocalHelp(int id)
        {
            LocalHelp localhelp = db.LocalHelps.Find(id);

            localhelp.Description = Server.HtmlDecode(localhelp.Description);
            return(View(localhelp));
        }
Example #2
0
        public ActionResult CreateLocalHelp(int?orgId)
        {
            var vol = GetCurrentVolunteer();

            if (vol == null)
            {
                return(RedirectToAction("UnauthorizedError", "Home", null));
            }

            if (!User.IsInRole(LWSFRoles.admin) && !User.IsInRole(LWSFRoles.localhelpAdmin))
            {
                if (vol.OrganizationId != orgId)
                {
                    return(RedirectToAction("UnauthorizedError", "Home", null));
                }
            }

            var localhelp = new LocalHelp
            {
                OrganizationId = orgId,
                Restriction    = LocalHelpRestriction.INSIDE_ORG_ONLY,
            };

            return(View(localhelp));
        }
Example #3
0
        //
        // GET: /LocalHelp/Details/5
        public ViewResult LocalhelpDetails(int id)
        {
            LocalHelp localhelp = db.LocalHelps.Find(id);

            localhelp.Description = Server.HtmlDecode(localhelp.Description);

            return(View(localhelp));
        }
Example #4
0
 void getHelp(object sender, EventArgs e)
 {
     try
     {
         LocalHelp.OpenHelpFile(_localHelpUri);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not open help file at " + _localHelpUri + "\n" + ex.Message, "Could not open help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
        /// <summary>
        /// Demonstrate using the MessageSendingService to send a GovTalkMessage to the Government Gateway and receive a reply.
        /// </summary>
        /// <param name="loggingService"></param>
        /// <param name="sendMessage"></param>
        static XmlDocument DemonstrateSendMessage(ILoggingService loggingService, XmlDocument sendMessage, GovernmentGatewayEnvironment gatewayEnv)
        {
            string uri = LocalHelp.GetSendURI("Send", gatewayEnv, configurationRepository);

            // Create a client to send the file to the target gateway
            CharitiesOnline.MessageService.Client client = new MessageService.Client(loggingService);

            // Create an XmlDocument of the reply from the endpoint
            XmlDocument reply = client.SendRequest(sendMessage, uri);

            return(reply);
        }
Example #6
0
        public ActionResult DeleteLocalHelpConfirmed(int id)
        {
            LocalHelp localhelp = db.LocalHelps.Find(id);

            foreach (var r in localhelp.RegisterEntries.ToList())
            {
                r.NewStudents.Clear();
                foreach (var g in r.GuestParticipants.ToList())
                {
                    db.GuestParticipants.Remove(g);
                }
                db.RegisterEntries.Remove(r);
            }
            db.LocalHelps.Remove(localhelp);
            db.SaveChanges();
            return(RedirectToAction("Manage", new { orgId = localhelp.OrganizationId }));
        }
Example #7
0
        public ActionResult CreateLocalHelp(LocalHelp localhelp)
        {
            if (ModelState.IsValid)
            {
                if (String.IsNullOrEmpty(localhelp.Title))
                {
                    ModelState.AddModelError("", "活动名称不能为空!");
                    return(View(localhelp));
                }
                localhelp.Description = Server.HtmlEncode(localhelp.Description);
                db.LocalHelps.Add(localhelp);
                db.SaveChanges();
                return(RedirectToAction("CreateRegisterEntry", new { localhelpId = localhelp.Id }));
            }

            return(View(localhelp));
        }
Example #8
0
 void onlineHelpButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (WebUtilities.IsInternetAvailable() == false)
         {
             LocalHelp.OpenHelpFile(_localHelpUri);
         }
         else
         {
             OpenUri(_remoteHelpUri);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not open help file at " + _localHelpUri + "\n" + ex.Message, "Could not open help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #9
0
 void quickStartButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (WebUtilities.IsInternetAvailable() == false)
         {
             string quickStartGuideFile = Properties.Settings.Default.QuickStartGuideName;
             LocalHelp.OpenHelpFile(quickStartGuideFile);
         }
         else
         {
             OpenUri(_quickStartUri);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not open help file at " + _localHelpUri + "\n" + ex.Message, "Could not open help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #10
0
 public ActionResult EditLocalHelp(LocalHelp localhelp, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         localhelp.Description     = Server.HtmlEncode(localhelp.Description);
         db.Entry(localhelp).State = EntityState.Modified;
         db.SaveChanges();
         if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
             !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
         {
             return(Redirect(returnUrl));
         }
         else
         {
             return(RedirectToAction("Index", "LocalHelp", null));
         }
     }
     return(View(localhelp));
 }
Example #11
0
 private bool IsAuthorizedLocalHelpAdmin(LocalHelp localhelp)
 {
     if (localhelp == null)
     {
         return(false);
     }
     if (!Request.IsAuthenticated)
     {
         return(false);
     }
     if (User.IsInRole(LWSFRoles.admin) || User.IsInRole(LWSFRoles.localhelpAdmin))
     {
         return(true);
     }
     if (User.IsInRole(LWSFRoles.organizationLeader))
     {
         var vol = GetCurrentVolunteer();
         if (vol.OrganizationId == localhelp.OrganizationId)
         {
             return(true);
         }
     }
     return(false);
 }
Example #12
0
 /// <summary>
 /// Opens a help topic for the item in context when the user presses F1.
 /// </summary>
 private void ThemeExportDialog_HelpRequested(object sender, HelpEventArgs hlpevent)
 {
     LocalHelp.OpenHelpFile(_localHelpUri);
     hlpevent.Handled = true; // Signal that we've handled the help request.
 }
Example #13
0
 /// <summary>
 /// Opens a help topic for the item in context when the Help button is clicked.
 /// </summary>
 private void ThemeExportDialog_HelpButtonClicked(object sender, CancelEventArgs e)
 {
     LocalHelp.OpenHelpFile(_localHelpUri);
     e.Cancel = true; // Prevents mouse cursor from changing to question mark.
 }
Example #14
0
 private void linkLabelHelp_click(object sender, LinkLabelLinkClickedEventArgs e)
 {
     LocalHelp.OpenHelpFile("welcome.html");
 }
Example #15
0
 void getHelp(object sender, EventArgs e)
 {
     LocalHelp.OpenHelpFile(_localHelpUri);
 }
Example #16
0
        /// <summary>
        /// Demonstrate using the message reader strategies to get results from a message reply
        /// </summary>
        /// <param name="loggingService"></param>
        /// <param name="messageToRead"></param>
        static void DemonstrateReadMessage(ILoggingService loggingService, XmlDocument messageToRead)
        {
            // Set up a message reading strategy
            IMessageReader messageReader = new DefaultMessageReader(loggingService, configurationRepository, messageToRead.ToXDocument());

            messageReader.ReadMessage();

            // We don't know what we've got back from the Gateway, but all replies are GovTalkMessages
            if (messageReader.HasErrors())
            {
                //There are errors in the results file so we can deal with them

                // Get a DataTable of the results and have a look at that
                DataTable errorTable = messageReader.GetMessageResults <DataTable>();
                // Or set up an error return strategy and do something with that
                IErrorReturnCalculator            errorCalculator = new DefaultErrorReturnCalculator();
                GovTalkMessageGovTalkDetailsError error           = messageReader.GetMessageResults <GovTalkMessageGovTalkDetailsError>();

                Console.WriteLine(errorCalculator.CalculateErrorReturn(error));

                if (error.Number == "3001")
                {
                    ErrorResponse errResponse = messageReader.GetMessageResults <ErrorResponse>();
                }
            }
            else
            {
                // It's either an acknowledgement so we need to get the poll interval and URL, or a response.
                string[] results = messageReader.GetMessageResults <string[]>();

                foreach (var result in results)
                {
                    Console.WriteLine(result);
                }

                if (messageReader.GetQualifier() == "response")
                {
                    string body = messageReader.GetBodyType();

                    if (body != null)
                    {
                        DataTable responseTable = messageReader.GetMessageResults <DataTable>();

                        LocalHelp.ConsolePrintDataTable(responseTable);
                    }
                    else
                    {
                        Console.WriteLine("No body content");
                    }
                }
            }

            GovTalkMessageFileName ReplyNamer = new GovTalkMessageFileName.FileNameBuilder()
                                                .AddLogger(loggingService)
                                                .AddConfigurationRepository(configurationRepository)
                                                .AddMessageIntention("ReplyMessage")
                                                .AddCorrelationId(messageReader.GetCorrelationId())
                                                .AddFilePath(@"C:\Temp\")
                                                .BuildFileName();

            string replyFileName = ReplyNamer.ToString();

            messageToRead.Save(replyFileName);
        }
Example #17
0
 private void linkLabelQuickStart_click(object sender, LinkLabelLinkClickedEventArgs e)
 {
     LocalHelp.OpenHelpFile(QuickStartGuideFile);
 }