public void DataCorrectTest() { RespuestaGeneral respuestaGeneral = operacion.Ejecutar(DATA_CORRECTA); Assert.IsNotNull(respuestaGeneral); Assert.IsTrue(respuestaGeneral.EstadoOperacion); }
private void ValidacionesGenerales(RespuestaGeneral respuestaGeneral, HttpResponseMessage responseMessage) { Assert.IsNotNull(respuestaGeneral); Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode); Assert.IsFalse(respuestaGeneral.Estado); respuestaGeneral.Mensaje = respuestaGeneral.Mensaje.Replace("\n", string.Empty); }
public void ErrorTamano() { RespuestaGeneral respuestaGeneral = operacion.Ejecutar(ERROR_TAMANO); Assert.IsNotNull(respuestaGeneral); Assert.IsTrue(respuestaGeneral.EstadoOperacion); }
public void ErrorCoordenadas() { RespuestaGeneral respuestaGeneral = operacion.Ejecutar(COORDENADAS_ERRONEAS); Assert.IsNotNull(respuestaGeneral); Assert.IsTrue(respuestaGeneral.EstadoOperacion); }
public void Update() { RespuestaGeneral respuestaGeneral = operacion.Ejecutar(ERROR_ACTUALIZAR); Assert.IsNotNull(respuestaGeneral); Assert.IsTrue(respuestaGeneral.EstadoOperacion); }
private List <Cubo> MapearCupo(string[] informacion, ref RespuestaGeneral respuestaGeneral) { List <Cubo> listCubo = new List <Cubo>(); Cubo cubo = new Cubo(); for (int i = 1; i < informacion.Length; i++) { string[] datos = informacion[i].Split(' '); if (datos.Length == 2) { if (!ValidarTamanoMatrizOperaciones(datos, ref respuestaGeneral)) { return(new List <Cubo>()); } cubo = new Cubo { TamanoMatriz = Convert.ToInt32(informacion[i].Split(' ')[0]), CantidadOperaciones = Convert.ToInt32(informacion[i].Split(' ')[1]), OperacionesCubo = new List <OperacionCubo>() }; listCubo.Add(cubo); continue; } cubo.OperacionesCubo.Add(new OperacionCubo { TipoOperacion = datos[0], InformacionOperacion = ObtenerInformacionOperacion(datos) }); } return(listCubo); }
public ActionResult ReportePorHora(DateTime Fecha) { try { RespuestaGeneral respuestaGeneral = new RespuestaGeneral(); clsDControlEnfundado = new clsDControlEnfundado(); var model = clsDControlEnfundado.ReporteControlEnfundadoPorHora(Fecha); if (!model.Any()) { respuestaGeneral.Codigo = 0; respuestaGeneral.Mensaje = "No Existen Registros"; return(Json(respuestaGeneral, JsonRequestBehavior.AllowGet)); } return(PartialView(model)); } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }
public ActionResult Parametro(PARAMETRO model) { try { RespuestaGeneral Respuesta = new RespuestaGeneral(); if (string.IsNullOrEmpty(model.Codigo)) { Respuesta.Codigo = 0; Respuesta.Mensaje = "Ingrese un Codigo"; return(Json(Respuesta, JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(model.Descripcion)) { Respuesta.Codigo = 0; Respuesta.Mensaje = "Ingrese una Descripcion"; return(Json(Respuesta, JsonRequestBehavior.AllowGet)); } //if (model.Valor<0) //{ // Respuesta.Codigo = 0; // Respuesta.Mensaje = "Ingrese un Valor"; // return Json(Respuesta, JsonRequestBehavior.AllowGet); //} ViewBag.dataTableJS = "1"; ViewBag.JavaScrip = RouteData.Values["controller"] + "/" + RouteData.Values["action"]; lsUsuario = User.Identity.Name.Split('_'); clsDParametro = new clsDParametro(); model.UsuarioIngresoLog = lsUsuario[0]; model.FechaIngresoLog = DateTime.Now; // model.EstadoRegistro = clsAtributos.EstadoRegistroActivo; model.TerminalIngresoLog = Request.UserHostAddress; string Mensaje = clsDParametro.GuardarModificarParametro(model); Respuesta.Codigo = 1; Respuesta.Mensaje = Mensaje; return(Json(Respuesta, JsonRequestBehavior.AllowGet)); } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }
public void TamanoCasosPruebaMayorCincuenta_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(TAMANO_CASOS_PRUEBA_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Cantidad_CasosPruebas, respuestaGeneral.Mensaje); }
public void CantidadCoordenatasOperacionQuery_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(QUERY_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Cantidad_Datos_OperacionQuery, respuestaGeneral.Mensaje); }
public void WMayor_Diez_n_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(W_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Valores_Máximos_OperacionUpdate, respuestaGeneral.Mensaje); }
public void DatosVacios_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(string.Empty); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Datos_Entrada_Vacio, respuestaGeneral.Mensaje); }
public void CoordenadaMayorTamanoMatriz_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(COORDENADAS_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Coordenadas, respuestaGeneral.Mensaje); }
public void TamanoOperacionesaMayorMil_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(TAMANO_OPERACIONES_PRUEBA_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Tamano_Operaciones, respuestaGeneral.Mensaje); }
public void TamanoMatrizMayorCien_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(TAMANO_MATRIZ_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; ValidacionesGenerales(respuestaGeneral, responseMessage); Assert.AreEqual(CubeSummationResources.Error_Tamano_Matriz, respuestaGeneral.Mensaje); }
public void CubeSummation_Test() { HttpResponseMessage responseMessage = controller.ProcesarInformacion(CORRECT_DATA); RespuestaGeneral respuestaGeneral = responseMessage.Content.ReadAsAsync <RespuestaGeneral>().Result; Assert.IsNotNull(respuestaGeneral); Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode); Assert.IsTrue(respuestaGeneral.Estado); }
public RespuestaGeneral EjecutarUpdate(OperacionCubo operacion, long[,,] matriz) { respuestaGeneral = validacionDatos.ValidarOperacionUpdate(operacion.InformacionOperacion, ref respuestaGeneral); if (respuestaGeneral.EstadoOperacion) { ActualizarValor(operacion.InformacionOperacion, matriz); } return(respuestaGeneral); }
private RespuestaGeneral ValidarOperacionQuery(long[] infoOperacion, ref RespuestaGeneral respuesta) { if (infoOperacion.Length != 6) { return(FuncionesGenericas.ObtenerRespuesta(false, respuesta.Mensaje + "\n" + CubeSummationResources.Error_Cantidad_Datos_OperacionQuery)); } return(respuesta); }
public RespuestaGeneral EjecutarQuery(OperacionCubo operacion, long[,,] matriz) { respuestaGeneral = validacionDatos.ValidarOperacionQuery(operacion.InformacionOperacion, ref respuestaGeneral); if (!respuestaGeneral.EstadoOperacion) { return(respuestaGeneral); } AcumularValores(operacion.InformacionOperacion, matriz); return(respuestaGeneral); }
public List <Cubo> ValidarMapearDatos(string data, ref RespuestaGeneral respuestaGeneral) { string[] informacion = data.Split('\n'); if (Convert.ToInt32(informacion[0]) <= 0 || Convert.ToInt32(informacion[0]) > 50) { respuestaGeneral = FuncionesGenericas.ObtenerRespuesta(false, CubeSummationResources.Error_Cantidad_CasosPruebas); return(new List <Cubo>()); } return(MapearCupo(informacion, ref respuestaGeneral)); }
protected HttpResponseMessage GenerarRespuestaGeneral(HttpStatusCode statusCode, string mensaje, bool estado) { RespuestaGeneral respuestaGeneral = new RespuestaGeneral { Estado = estado, Mensaje = mensaje }; return(GenerarMensajeRespuesta(statusCode, respuestaGeneral)); }
public ActionResult GeneraControl(string Linea, DateTime Fecha, string Turno) { try { lsUsuario = User.Identity.Name.Split('_'); if (string.IsNullOrEmpty(lsUsuario[0])) { return(Json("101", JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(Linea) || string.IsNullOrEmpty(Turno)) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(Json("Faltan Parametros", JsonRequestBehavior.AllowGet)); } RespuestaGeneral respuesta = new RespuestaGeneral(); clsDControlMaterialQuebradizo = new clsDControlMaterialQuebradizo(); CONTROL_MATERIAL control = new CONTROL_MATERIAL { Fecha = Fecha, Linea = Linea, Turno = Turno, FechaIngresoLog = DateTime.Now, UsuarioIngresoLog = lsUsuario[0], TerminalIngresoLog = Request.UserHostAddress, EstadoRegistro = clsAtributos.EstadoRegistroActivo }; var id = clsDControlMaterialQuebradizo.GenerarControlMaterialQuebradizo(control); respuesta.Codigo = id; if (id > 0) { var model = clsDControlMaterialQuebradizo.ConsultaControlMaterial(id); respuesta.Mensaje = model.Observacion; } return(Json(respuesta, JsonRequestBehavior.AllowGet)); } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }
public void ValidarDatosEntrada(string data, ref RespuestaGeneral respuestaGeneral, out List <ArregloCubo> listCubo) { string[] datos = data.Split('\n'); if (Convert.ToInt32(datos[0]) <= 0 || Convert.ToInt32(datos[0]) > 50) { respuestaGeneral.EstadoOperacion = false; respuestaGeneral.Mensaje = "La cantidad de casos de prueba debe ser entre 1 y 50."; } listCubo = CrearOjetoCubo(datos, ref respuestaGeneral); }
private RespuestaGeneral ValidarOperacionUpdate(long[] infoOperacion, ref RespuestaGeneral respuestaGeneral) { if (infoOperacion.Length != 4) { return(FuncionesGenericas.ObtenerRespuesta(false, respuestaGeneral.Mensaje + "\n" + CubeSummationResources.Error_Cantidad_Datos_OperacionUpdate)); } if (infoOperacion[3] <= Math.Pow(10, -9) || infoOperacion[3] >= Math.Pow(10, 9)) { return(FuncionesGenericas.ObtenerRespuesta(false, respuestaGeneral.Mensaje + "\n" + CubeSummationResources.Error_Valores_Máximos_OperacionUpdate)); } return(respuestaGeneral); }
public RespuestaGeneral ValidarOperacionQuery(long[] infoOperacion, ref RespuestaGeneral respuesta) { if (infoOperacion.Length != 6) { return new RespuestaGeneral { EstadoOperacion = false, Mensaje = "La operación 'QUERY' solo permite seis (6) datos de entrada." } } ; return(respuesta); } }
private bool ValidarTamanoMatrizOperaciones(string[] infoMatriz, ref RespuestaGeneral respuestaGeneral) { if (Convert.ToInt32(infoMatriz[0]) < 1 || Convert.ToInt32(infoMatriz[0]) > 100) { respuestaGeneral = FuncionesGenericas.ObtenerRespuesta(false, respuestaGeneral.Mensaje + "\n" + CubeSummationResources.Error_Tamano_Matriz); } if (Convert.ToInt32(infoMatriz[1]) < 1 || Convert.ToInt32(infoMatriz[1]) > 1000) { respuestaGeneral = FuncionesGenericas.ObtenerRespuesta(false, respuestaGeneral.Mensaje + "\n" + CubeSummationResources.Error_Tamano_Operaciones); } return(respuestaGeneral.Estado); }
public JsonResult InactivarControlEnfundado(int IdControl) { try { RespuestaGeneral respuestaGeneral = new RespuestaGeneral(); clsDControlEnfundado = new clsDControlEnfundado(); lsUsuario = User.Identity.Name.Split('_'); if (IdControl > 0) { CONTROL_ENFUNDADO model = new CONTROL_ENFUNDADO(); model.IdControlEnfundado = IdControl; model.FechaModificacionLog = DateTime.Now; model.UsuarioModificacionLog = lsUsuario [0]; model.TerminalModificacionLog = Request.UserHostAddress; clsDControlEnfundado.InactivarControlEnfundado(model); respuestaGeneral.Codigo = 1; respuestaGeneral.Mensaje = "Registro Elimminado con Éxito"; return(Json(respuestaGeneral, JsonRequestBehavior.AllowGet)); } else { respuestaGeneral.Codigo = 0; respuestaGeneral.Mensaje = "No ha seleccionado ningun Control de Enfundado"; return(Json(respuestaGeneral, JsonRequestBehavior.AllowGet)); } } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario [0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario [0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }
public void ValidarCoordenadas(long[] informacionOperacion, Cubo cubo, ref RespuestaGeneral respuestaGeneral, string tipoOperacion) { if (!respuestaGeneral.Estado) { return; } int length = tipoOperacion.Equals(TipoOperacion.UPDATE.ToString()) ? informacionOperacion.Length - 1 : informacionOperacion.Length; for (int i = 0; i < length; i++) { if (informacionOperacion[i] > cubo.TamanoMatriz || informacionOperacion[i] <= 0) { respuestaGeneral = FuncionesGenericas.ObtenerRespuesta(false, respuestaGeneral.Mensaje + "\n" + CubeSummationResources.Error_Coordenadas); return; } } }
public ActionResult CuchilloEmpleado(EmpleadoCuchilloViewModel model) { try { lsUsuario = User.Identity.Name.Split('_'); if (string.IsNullOrEmpty(lsUsuario[0])) { return(Json("101", JsonRequestBehavior.AllowGet)); } if (!ModelState.IsValid) { return(Json("1", JsonRequestBehavior.AllowGet)); } else { clsDCuchillo = new clsDCuchillo(); model.EstadoRegistro = model.EstadoRegistro == "true" ? clsAtributos.EstadoRegistroActivo : clsAtributos.EstadoRegistroInactivo; model.FechaIngresoLog = DateTime.Now; model.UsuarioIngresoLog = lsUsuario[0]; model.TerminalIngresoLog = Request.UserHostAddress; RespuestaGeneral respuesta = new RespuestaGeneral(); respuesta = clsDCuchillo.GuardarModificarEmpleadoCuchillo(model); return(Json(respuesta, JsonRequestBehavior.AllowGet)); } } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }
private bool ValidarTamanoMatrizOperaciones(string[] infoMatriz, ref RespuestaGeneral respuestaGeneral) { if (Convert.ToInt32(infoMatriz[0]) < 1 || Convert.ToInt32(infoMatriz[0]) > 100) { respuestaGeneral.EstadoOperacion = false; respuestaGeneral.Mensaje = "El tamaño de la matriz debe estar entre 1 y 100."; return(false); } if (Convert.ToInt32(infoMatriz[1]) < 1 || Convert.ToInt32(infoMatriz[1]) > 1000) { respuestaGeneral.EstadoOperacion = false; respuestaGeneral.Mensaje = "La cantidad de operaciones debe estar entre 1 y 1000."; return(false); } return(true); }