public JsonResult Get_History_Tickets() { DateTime finish = Get_Today(); DateTime start = Get_Today_Less_7_Days(); UserController uc = new UserController(); TicketController tc = new TicketController(); User us = uc.Get_User_By_Id(SessionHelper.GetUser()); string cod_tec = ""; if (us.cod_tec != "") { cod_tec = us.cod_tec; } List <History_Tickets_Dashboard> ls = tc.Get_CLoset_Tickets_By_Date(cod_tec, 7, "ENTREGA"); List <History_Tickets_Dashboard> lc = tc.Get_CLoset_Tickets_By_Date(cod_tec, 7, "CREADO"); List <List <History_Tickets_Dashboard> > array = new List <List <History_Tickets_Dashboard> >(); array.Add(ls); array.Add(lc); string data = ""; JavaScriptSerializer serializer = new JavaScriptSerializer(); data = serializer.Serialize(array); return(Json(data)); }
//obtinene los tickets entre fechas para generar el reporte. public ActionResult Get_Events_By_Dates() { DateTime F_INICIO = DateTime.Now.AddDays(-7); DateTime F_FIN = DateTime.Now; TicketController tc = new TicketController(); List <Ticket> list = tc.Get_Tickets_By_Dates(F_INICIO, F_FIN, "E", "C", "I", "T"); TempData["f_inicio"] = F_INICIO.ToString("MM/dd/yyyy"); TempData["f_fin"] = F_FIN.ToString("MM/dd/yyyy"); return(View(list)); }
//get client by specific id private Client Get_Client_By_Id(int id = 0) { DateTime now = DateTime.Now; BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from client in connection.SGA_AFILIADOS join province in connection.WEB_Provincia on client.N_COD_PROV equals province.idProvincia into provusr from province in provusr.DefaultIfEmpty() join canton in connection.WEB_Canton on(client.N_COD_PROV + client.N_COD_CANT).Trim() equals canton.idCanton into cantusr from canton in cantusr.DefaultIfEmpty() join distrito in connection.WEB_Distrito on(client.N_COD_PROV + client.N_COD_CANT + client.N_COD_DIST).Trim() equals distrito.idDistrito into distusr from distrito in distusr.DefaultIfEmpty() where client.ID == id select new Client { id = client.ID, membership_number = client.N_AFILIADO, local_name = client.NOMBRE_NEGOCIO, contact = client.NOMBRE, phone = client.TELEFONO, address = client.DIRECCION_1, province = province.nombreProvincia == null ? "N/A" : province.nombreProvincia, canton = canton.nombreCanton == null ? "N/A" : canton.nombreCanton, district = distrito.nombreDistrito == null ? "N/A" : distrito.nombreDistrito, updated = client.ACTUALIZADO.Value, status = client.ACTIVO.Value, last_membership = client.ANTIGUO_N_AFILIADO == null ? "N/A" : client.ANTIGUO_N_AFILIADO, changed = client.FECHA_CREACION == null ? now : client.FECHA_CREACION.Value, new_menbership = client.EXTRA_1 == null ? "N/A" : client.EXTRA_1, other = client.EXTRA_2, status_varchar = client.ESTATUS }); Client clientF = null; if (model.Count() > 0) { TicketController tc = new TicketController(); clientF = model.FirstOrDefault(); string fecha = tc.Get_Last_Mainteinance_By_Client(clientF.membership_number); clientF.last_mainteinance = fecha; } return(clientF); }
public JsonResult Get_Events_By_Dates_Json(string date_start = "", string date_end = "", string filter = "", string t_fecha = "", string t_movimiento = "", string t_estatus = "") { DateTime F_INICIO = DateTime.Now; DateTime F_FIN = DateTime.Now; if (date_start == "" && date_end == "") { F_INICIO = DateTime.Now.AddDays(-7); F_FIN = DateTime.Now; } else { string format = "MM/dd/yyyy"; F_INICIO = DateTime.ParseExact(date_start, format, CultureInfo.InvariantCulture); F_FIN = DateTime.ParseExact(date_end, format, CultureInfo.InvariantCulture); } TicketController tc = new TicketController(); List <Ticket> list = tc.Get_Tickets_By_Dates(F_INICIO, F_FIN, filter, t_fecha, t_movimiento, t_estatus); return(Json(list)); }
private Dashboard Get_Info_Dashboard() { TicketController tc = new TicketController(); UserController uc = new UserController(); User us = uc.Get_User_By_Id(SessionHelper.GetUser()); string cod_tec = ""; bool filtrar = false; if (us.cod_tec != "") { cod_tec = us.cod_tec; filtrar = true; } List <Ticket> listP = tc.Get_Tickets_By_Type("P", cod_tec, filtrar); Dashboard dash = new Dashboard(); dash.install = Get_Tycket_By_Type(listP, "INSTALACION"); dash.visite = Get_Tycket_By_Type(listP, "VISITA"); dash.retire = Get_Tycket_By_Type(listP, "RETIRO"); dash.open = listP; return(dash); }