public string LoadTemplate(string templateName, CultureInfo culture, FogBugzCase cases)
 {
     if (culture == null)
         culture = CultureInfo.InvariantCulture;
     string text = File.ReadAllText(Path.Combine("Views", culture.ToString(), templateName + ".cshtml"));
     return Razor.Parse(text, cases);
 }
Exemplo n.º 2
0
        private void btnRetrieve_Click(object sender, EventArgs e)
        {
            //Instantiate a new FogBugz class
            FogBugz fogBugz = new FogBugz("https://evildauphin.fogbugz.com");

            fogBugz.VerifyCertificate = false;

            //Verify the API
            if (!fogBugz.VerifyApi())
            {
                MessageBox.Show("FogBugz API not compatible with this plug-in");
            }

            //Now log-in
            fogBugz.Logon("*****@*****.**", "zigzag");

            //Now retrieve a specific case
            FogBugzCase fogBugzCase = fogBugz.GetCase(Int32.Parse(this.txtCaseId.Text));

            //Display the id of the retrieved case
            MessageBox.Show("Retrieved case " + fogBugzCase.Id.ToString() + ".");

            //Finally log-off
            fogBugz.Logoff();
        }
Exemplo n.º 3
0
 public string GetEmailBody(string templateName, FogBugzCase selectedCase)
 {
     string emailBody = null;
     if (templateName == null)
     {
         throw new ArgumentNullException("templateName");
     }
     var parser = new FileSystemTemplateLoader();
     emailBody = parser.LoadTemplate(templateName, null, selectedCase);
     return emailBody;
 }
Exemplo n.º 4
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            //Instantiate a new FogBugz class
            FogBugz fogBugz = new FogBugz("https://evildauphin.fogbugz.com");

            fogBugz.VerifyCertificate = false;

            //Verify the API
            if (!fogBugz.VerifyApi())
            {
                MessageBox.Show("FogBugz API not compatible with this plug-in");
            }

            //Now log-in
            fogBugz.Logon("*****@*****.**", "zigzag");

            //Now create a new case
            FogBugzCase newCase = new FogBugzCase();

            newCase.Title            = "Test Form Case";
            newCase.Project          = 1;
            newCase.Priority         = 3;
            newCase.Area             = 4;
            newCase.FixFor           = 2;
            newCase.Category         = 1;
            newCase.Computer         = "Windows 2003";
            newCase.Version          = "Version 1";
            newCase.HrsCurrEst       = 1;
            newCase.PersonAssignedTo = 2;
            newCase.Description      = "Long Description";
            newCase.Due = DateTime.Now.AddDays(2);
            newCase     = fogBugz.Add(newCase);

            //Display the id of the newly inserted case
            MessageBox.Show("Inserted new case " + newCase.Id.ToString() + ".");

            //Finally log-off
            fogBugz.Logoff();
        }
 public string Parse(string templateName, CultureInfo culture, FogBugzCase parameters)
 {
     return RazorEngine.Razor.Parse(templateLoader.LoadTemplate(templateName, culture),  parameters);
 }