Welcome Guest Search | Active Topics | Members | Log In | Register

Plugin keeping Tp from loading Options · View
John
Posted: Wednesday, June 02, 2010 2:05:17 PM
Rank: Newbie
Groups: New

Joined: 5/27/2010
Posts: 2
Points: 6
I've been trying to develop a Plugin to migrate in times from another application we use. However, it's making TP not load at all. I've included that I've got and the GetFromHarvest function should be working 100% as it's been thoroughly tested. I was thinking it has something to do with my Timer or how I'm creating a time. Any help is appreciated.

Note: Any files referenced are supplied in the Plugin folder.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;
using System.Xml;
using Common.Logging;
using Tp.Integration.Common;
using Tp.Integration.Common.Plugins;

namespace Tp.TimeManagement.Harvest
{
[Plugin(PLUGIN_NAME,
Description =
@"Migrates times entered into Harvest to Target Process"
)]
public class HarvestPlugin : IPlugin
{
public const string PLUGIN_NAME = "Harvest Time Extracter";
private IServiceProvider _serviceProvider;
private ITimeService _timeService;
private TimerCallback tcb;


public Type SettingsType
{
get { return typeof(Settings); }
}

public IServiceProvider Site
{
set
{
_serviceProvider = value;
_timeService = (ITimeService)_serviceProvider.GetService(typeof(ITimeService));
StartTimer();
}
}

private void StartTimer()
{
tcb = this.GetTimes;
TimeSpan currTime = DateTime.Now - DateTime.Today;//Current Time
TimeSpan runtime = TimeSpan.FromHours(79200000);//10 pm
runtime = runtime - currTime;//Time until 10 pm
if (runtime.Milliseconds > 0)
{
Timer timer = new Timer(tcb, null, runtime.Milliseconds, 86400000);//Timer ticks
//Once a day, starting today at 10pm
}
else
{
Timer timer = new Timer(tcb, null, runtime.Milliseconds + 86400000, 86400000);//Timer ticks
//Once a day, starting tommorrow at 10pm
}
}

private void GetTimes(Object stateInfo)
{
string name = "";
string pswd = "";

XmlReader reader = new XmlTextReader("info.xml");
while (reader.Read())
{
switch (reader.Name){

case "name":
name = reader.Name;
break;
case "password":
pswd = reader.Name;
break;
default:
break;
}
if(name != "" && pswd != ""){
EnterTimes( GetFromHarvest(name, pswd) );
name = "";
pswd = "";
}
}
StreamWriter sw = File.CreateText("LastRun.txt");
sw.Write(DateTime.Today.ToString());
}

private void EnterTimes(Dictionary<int, float> dict)
{
foreach (KeyValuePair<int, float> kvp in dict)
{
TimeDTO time = _timeService.GetByID(1);
time.AssignableName = "Bug1";
time.Spent = (decimal) kvp.Value;
time.SpentDate = DateTime.Today;
time.CreateDate = DateTime.Today;
_timeService.Create(time);
_timeService.Update(time);
}
}

private Dictionary<int, float> GetFromHarvest(string accName, string pswd)
{

//Log into Harvest
//Write XML to file
return new HarvestXMLParse.HarvestXMLParsewithReader("Sample.xml").GetTimes();
}

public void Dispose()
{
}

}
}

Oleg
Posted: Wednesday, June 02, 2010 2:49:13 PM

Rank: TargetProcess Team
Groups: TargetProcess Team

Joined: 3/1/2007
Posts: 78
Points: 34
Hello,

Please send the source code of solution (all files) to me: oleg@targetprocess.com. I will take a look.



Best,
Oleg

TargetProcess | Agile Project Management Software
Web: http://www.targetprocess.com
Blog: http://20.targetprocess.com
Oleg
Posted: Thursday, June 03, 2010 5:14:45 AM

Rank: TargetProcess Team
Groups: TargetProcess Team

Joined: 3/1/2007
Posts: 78
Points: 34
John,

I didn't receive any email from you. Please re-send it to me.

Best,
Oleg

TargetProcess | Agile Project Management Software
Web: http://www.targetprocess.com
Blog: http://20.targetprocess.com
John
Posted: Monday, June 14, 2010 7:44:49 AM
Rank: Newbie
Groups: New

Joined: 5/27/2010
Posts: 2
Points: 6
I won't start a new thread, since this is a problem with the same project.

I've been trying to make a scheduled task occur in my plugin using a Timer from the System.Threading library, in C#. The problem is that it seems as though the time is skewed and I can't set the event to occur after a long period of time, for example, every 24 hours.

What I'm really asking is whether or not there is a suggested or preferred method for scheduling tasks in a plugin. I'd like to have a simple process occur every night at 10pm. Whether this happens by checking the time at certain intervals or scheduling task to occur at 10 and then again every 24 hours, it wouldn't matter. Thanks.
Oleg
Posted: Monday, July 19, 2010 1:21:12 AM

Rank: TargetProcess Team
Groups: TargetProcess Team

Joined: 3/1/2007
Posts: 78
Points: 34
Clear.

It is because plugins jobs work under IIS and it is required to configure pool timeout for IIS settings. Looks like it is too small for you.

Thanks,
Oleg

Best,
Oleg

TargetProcess | Agile Project Management Software
Web: http://www.targetprocess.com
Blog: http://20.targetprocess.com
16shoes
Posted: Monday, August 16, 2010 8:10:39 PM
Rank: Guest
Groups: Guest

Joined: 1/15/2005
Posts: 393
Points: -5,181
www.16shoes.com
I live a shoes name ugg
shoes
. Classic Tall UGG Boots? are believed to have been
first developed in Australia or New Zealand, although the exact date is
uncertain—they have been, at different times,UGG Women's Tall
Boots? identified with pilots in World War I who are said to have worn them
for warmth in unpressurized planes, shearers in rural Australia during the
1920s, surfers and competitive swimmers who wore them in the 1960s and 1970s for
keeping warm while out of the water. UGG Sheepskin Slippers?In the
early 2000s, they became a fashion trend in the United States, leading to
increased global sales.Classic Tall UGG Boots UK-Cozy UGG Tall look fab teamed
with jeans.Show off your classic style with Classic Tall UGG Boots.Be fantastic
with UGG Tall.wholesale ugg shoes

UGG Kids
Boots?
The persistently trendy boots are the subject of a new wave
of criticism by health experts in the United Kingdom, who say that the furry
footwear - and its many cheap knockoffs - are &quot;harming the feet of a
generation of young women,&quot; Classic UGG Knit Bootsaccording to the
Mirror.are you want to it ?order now!!
&nbsp;
16shoes
Posted: Monday, August 16, 2010 8:18:23 PM
Rank: Guest
Groups: Guest

Joined: 1/15/2005
Posts: 393
Points: -5,181
Can you tell me that what are Ugg Boots?Cheap UGG New Arrival Boots In New Zealand and Australia Ugg Boot is a generic term for Sheepskin Boot and it does not relate to a specific brand. We’ve been wearing Ugg Boots downunder for a hundred years and the best quality Ugg Boots are made here.www.2010newshoes.com HOT!UGG Sheepskin Slippers
When it comes to ugg boots, there seems to be three kinds of people. Those who love ugg boots, those who hate ugg boots, and those who just aren't sure what ugg boots are -- but, when I’m finished here, I’m sure, they'll fall into the first category. Classic Cardy Online Clearance

New Zealand Nature Company offers you New Zealand made Ugg Boots (Sheepskin Boots) made from premium quality, twin-face sheepskin and your choice of supertread rubber, or lightweight EVA,Buy UGG Bailey Button Boot So, here I’ll address those of you who don't know what an ugg boot is.UGG Classic Tall for sale
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.0 (NET v2.0) - 10/10/2006
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.