Hi
I’ve found a kind of weird behaviour that occurs during change a progress value directly on a gantt chart, when after it, end of date is also changing. I tried to debug this scenario, to exclude bug on my webservices side. But in the same controller i cannot see any what supposed to be wrong. In a tracing, values to be set in business logic was fine.
My model responsible for read/update looks like:
public class GetTasksController : ApiController
{
public IEnumerable<DCProdTask> Get()
{
Soneta.Business.App.Login t = WebApiApplication.EnovaLogin;
using (Session sesja = t.CreateSession(true, false))
{
DritProdukcjaModule PM = DritProdukcjaModule.GetInstance(sesja);
return PM.ProdTasks.CreateView()
.Cast<ProdTask>()
.Select(x => Mapper.Map<ProdTask, DCProdTask>(x));
}
}
public async Task<DCProdTask> Get([FromUri] ModelType value, string type)
{
IList<DCProdTask> persons = new System.Web.Script.Serialization.JavaScriptSerializer()
.Deserialize<IList<DCProdTask>>(value.models);
DCProdTask[] arr = persons.ToArray<DCProdTask>();
DCProdTask task = arr[0];
Soneta.Business.App.Login l = WebApiApplication.EnovaLogin;
List<ProdTask> list = new List<ProdTask>();
switch (type)
{
case "Update": using (Session sesja = l.CreateSession(false, false))
{
using (ITransaction t = sesja.Logout(true))
{
DritProdukcjaModule PM = DritProdukcjaModule.GetInstance(sesja);
Soneta.Business.View view = PM.ProdTasks.CreateView();
view.Condition &= new FieldCondition.Equal("ID", task.ID);
view.LoadingRowsCount = 1;
ProdTask PTask = (ProdTask)view.GetFirst();
if (PTask != null)
{
DateTime _start = Convert.ToDateTime(task.Start);
DateTime _end = Convert.ToDateTime(task.End);
Soneta.Types.Percent _percentComplete =
new Soneta.Types.Percent(Convert.ToDecimal(task.PercentComplete));
PTask.DataOd = new Soneta.Types.Date(_start);
PTask.CzasOd = new Soneta.Types.Time(_start.Hour, _start.Minute);
PTask.DataDo = new Soneta.Types.Date(_end);
PTask.CzasDo = new Soneta.Types.Time(_end.Hour, _end.Minute);
PTask.PercentComplete = _percentComplete;
list.Add(PTask);
}
t.CommitUI();
}
sesja.Save();
sesja.InvokeChanged();
}
break;
default: break;
}
return Mapper.Map<ProdTask, DCProdTask>(list.ToArray<ProdTask>()[0]);
}
I’ve attached a couple of screenshots to show a fake values providing to web service through the url, and response as JSON. What is curious, it only happen on a tasks with small data intervals between start and end. When i have huge gantt tasks and i change progress from Month view, i have not noticed such behaviour.
I’ve found a kind of weird behaviour that occurs during change a progress value directly on a gantt chart, when after it, end of date is also changing. I tried to debug this scenario, to exclude bug on my webservices side. But in the same controller i cannot see any what supposed to be wrong. In a tracing, values to be set in business logic was fine.
My model responsible for read/update looks like:
public class GetTasksController : ApiController
{
public IEnumerable<DCProdTask> Get()
{
Soneta.Business.App.Login t = WebApiApplication.EnovaLogin;
using (Session sesja = t.CreateSession(true, false))
{
DritProdukcjaModule PM = DritProdukcjaModule.GetInstance(sesja);
return PM.ProdTasks.CreateView()
.Cast<ProdTask>()
.Select(x => Mapper.Map<ProdTask, DCProdTask>(x));
}
}
public async Task<DCProdTask> Get([FromUri] ModelType value, string type)
{
IList<DCProdTask> persons = new System.Web.Script.Serialization.JavaScriptSerializer()
.Deserialize<IList<DCProdTask>>(value.models);
DCProdTask[] arr = persons.ToArray<DCProdTask>();
DCProdTask task = arr[0];
Soneta.Business.App.Login l = WebApiApplication.EnovaLogin;
List<ProdTask> list = new List<ProdTask>();
switch (type)
{
case "Update": using (Session sesja = l.CreateSession(false, false))
{
using (ITransaction t = sesja.Logout(true))
{
DritProdukcjaModule PM = DritProdukcjaModule.GetInstance(sesja);
Soneta.Business.View view = PM.ProdTasks.CreateView();
view.Condition &= new FieldCondition.Equal("ID", task.ID);
view.LoadingRowsCount = 1;
ProdTask PTask = (ProdTask)view.GetFirst();
if (PTask != null)
{
DateTime _start = Convert.ToDateTime(task.Start);
DateTime _end = Convert.ToDateTime(task.End);
Soneta.Types.Percent _percentComplete =
new Soneta.Types.Percent(Convert.ToDecimal(task.PercentComplete));
PTask.DataOd = new Soneta.Types.Date(_start);
PTask.CzasOd = new Soneta.Types.Time(_start.Hour, _start.Minute);
PTask.DataDo = new Soneta.Types.Date(_end);
PTask.CzasDo = new Soneta.Types.Time(_end.Hour, _end.Minute);
PTask.PercentComplete = _percentComplete;
list.Add(PTask);
}
t.CommitUI();
}
sesja.Save();
sesja.InvokeChanged();
}
break;
default: break;
}
return Mapper.Map<ProdTask, DCProdTask>(list.ToArray<ProdTask>()[0]);
}
I’ve attached a couple of screenshots to show a fake values providing to web service through the url, and response as JSON. What is curious, it only happen on a tasks with small data intervals between start and end. When i have huge gantt tasks and i change progress from Month view, i have not noticed such behaviour.