Hello community
I'm facing an issue creating the command method to insert data in grid.
I have the following Select method in BLL.
public List GetAllFiles(int IDRecursoHumano = 0)
{
try
{
using (GestaoProjectosEntities lt = new GestaoProjectosEntities())
{
var query = lt.ListagemTimesheets.Include("RecursoHumano").Include("EstadoTimesheet").AsQueryable();
if (IDRecursoHumano > 0)
query = query.Where(a => a.IDRecursoHumano == IDRecursoHumano);
return query.ToList();}
}
catch (Exception ex)
{
//
log.Error("BLL => GetAllFiles:" + ex.Message);return new List();
}
}
And i used the following struture for the Edit operation. I was trying to use a similar one to insert operations, but i am not finding the way to properly do it.
if (e.CommandName == "EditItem")
{
try
{
divUC.Visible = true; //divUC
e.Canceled = true;
int idtimesheet = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
ListagemTimesheet timesheet = listagembll.GetFileByID(idtimesheet);
EditTimesheet.Objecto = timesheet;
EditTimesheet.DataBind();
}
catch (System.Exception)
{
}
}
if (e.CommandName == "InsertItem")
{
List<ListagemTimesheet> idtimesheet = new List<ListagemTimesheet>();
try
{
divUC.Visible = true; //divUC
e.Canceled = true;
//int idtimesheet = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
ListagemTimesheet timesheet = listagembll.GetFileByID(idtimesheet);
EditTimesheet.Objecto = timesheet;
EditTimesheet.DataBind();
}
}
Any ideas?