public void registrarCataCorrecta() { Cata cata = new Cata("CATA-01", 1, 7, 9, 4, 6, 2, 8, 5, 7, 8, "Excelente Cafe"); var response = apiCata.registrarCata(cata); Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK); }
public void registrarCataFallida() { Cata cata = new Cata("CATA-01", -1, 7, 9, 4, 6, 2, 8, 5, 11, 8, "Excelente Cafe"); var response = apiCata.registrarCata(cata); Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.BadRequest); }
private void mostrarCata() { l_mensajes.Text = string.Empty; ControladorCata cc = new ControladorCata(); int estado = cc.ConsultarTodasCatas(); switch (estado) { case 1: dgvCata.Rows.Clear(); Cata ct = new Cata(); List <Cata> listacata = new List <Cata>(); listacata = cc.obtenerDatostodasCata(); for (int c = 0; c < listacata.Count; c++) { object[] registroCata = new object[3]; registroCata[0] = listacata[c].IdCata; registroCata[1] = listacata[c].FechaCata; registroCata[2] = listacata[c].NombreCata; dgvCata.Rows.Add(registroCata); } break; default: l_mensajes.Text = "NO existe Conexión BD. Contacte a ..."; break; } }
private void CargarDetalleCata(Cata cata) { fmrDetalleCata fDetCata = fmrDetalleCata.GetInstance(); fDetCata.SetCata(cata); fDetCata.ShowDialog(); }
public void Include(string equipmentName, string specNaem) { try { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); var builder = new Builder(); var spec = MDB.CurrentMDB.FindElement(DbType.Catalog, specNaem); var equi = MDB.CurrentMDB.FindElement(DbType.Design, equipmentName); builder.Cata = Cata.GetWritable(equi); builder.Cate = new Cate(); builder.Reader = new Reader(); builder.Reader.Converter = new ConvertToBuildable.Convert(); var scom = builder.BuildScom(equi); var session = builder.Reader.GetLastSessionModified(equi); Console.WriteLine($" sessionmod : {session}"); var spcoInfo = new Create.SpcoRepresentation(scom, equi, builder.Text); spcoInfo.DefineMatxt(builder.Cata); var specManager = new Create.SpecManager(spec, spcoInfo.FirstSeleTans); specManager.AddSpco(spcoInfo); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.WriteLine(e.Source); } }
private void dgvCata_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgvCata.CurrentRow != null) { Cata cata = new Cata(); cata.IdCata = Convert.ToInt32(dgvCata.CurrentRow.Cells["dgvId_cata"].Value.ToString()); cata.FechaCata = Convert.ToDateTime(dgvCata.CurrentRow.Cells["fecha"].Value.ToString()); cata.NombreCata = dgvCata.CurrentRow.Cells["nombre"].Value.ToString(); CargarDetalleCata(cata); } }
public int ConsultarTodasCatas() { int estado = 2; try { conexion = new SqlConnection(cadenaConexion); if (tieneConexion().Equals("OkConexion")) { int idcata; DateTime fechacata; string nombre; listacata.Clear(); conexion.Open(); comando = new SqlCommand("sp_ConsultaCata", conexion); comando.CommandType = CommandType.StoredProcedure; lector = comando.ExecuteReader(); while (lector.Read()) { idcata = lector.GetInt32(0); fechacata = lector.GetDateTime(1); nombre = lector.GetString(2); Cata ct = new Cata(); ct.IdCata = idcata; ct.FechaCata = fechacata; ct.NombreCata = nombre; listacata.Add(ct); } return(1); } else { return(estado); } } catch (Exception e) { return(3); } finally { conexion.Close(); } }
// Update is called once per frame void Update() { if (_CarSelectionGridInt == 0) { Cata.SetActiveRecursively(true); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); _target = CataMass; } if (_CarSelectionGridInt == 1) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(true); } if (_CarSelectionGridInt == 2) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(true); Lotus.SetActiveRecursively(false); } if (_CarSelectionGridInt == 3) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(true); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); } if (_CarSelectionGridInt == 4) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(true); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); } }
/// <summary> /// Este metodo permite convertir una cata de la base de datos en un objeto de tipo Cata, /// con el fin de que pueda ser interpretada, dicha cata es consultada en el repositorio /// a partir de su codigo /// </summary> /// <param name="codigo">Codigo de la cata</param> /// <returns>Retorna una cata con la informacion del repositorio</returns> protected internal Cata convertirCATA(string codigo) { CATA cataDB = repositorio.consultarCata(codigo); Cata cata = new Cata( cataDB.CODCATACION, cataDB.VEZCATADA, cataDB.RANCIDEZ.GetValueOrDefault(), cataDB.DULCE.GetValueOrDefault(), cataDB.ACIDEZ.GetValueOrDefault(), cataDB.AROMA.GetValueOrDefault(), cataDB.AMARGO.GetValueOrDefault(), cataDB.FRAGANCIA.GetValueOrDefault(), cataDB.SABORESIDUAL.GetValueOrDefault(), cataDB.CUERPO.GetValueOrDefault(), cataDB.IMPRESIONGLOBAL.GetValueOrDefault(), cataDB.OBSERVACIONES ); return(cata); }
public HttpResponseMessage registrarCata(Cata cata) { try { var response = new HttpResponseMessage(HttpStatusCode.OK); if (repositorio.registrarCata(cata.codCata, cata.rancidez, cata.dulce, cata.acidez, cata.cuerpo, cata.aroma, cata.amargo, cata.impresionGlobal, cata.fragancia, cata.saborResidual, cata.observaciones)) { return(response); } else { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } } catch { return(new HttpResponseMessage(HttpStatusCode.BadGateway)); } }
void OnGUI() { GUI.BeginGroup(new Rect(Screen.width - buttonWidth * 2 - 130 - buttonSpacing * 40, buttonSpacing, buttonWidth + buttonSpacing * 160, buttonHeight / 3 - buttonSpacing * 4)); GUI.Box(new Rect(0, 0, buttonWidth * 2 - 135 + buttonSpacing * 2, buttonHeight / 6 + 18 + buttonSpacing * 5), ""); CarSelectionGridInt = GUI.SelectionGrid(new Rect(buttonSpacing, buttonSpacing, buttonWidth * 2, buttonHeight / 4), CarSelectionGridInt, ThumbnailsLocked, 6); GUI.EndGroup(); /* * If selected car is bought you can see filled info box and car itself */ if (xmlReaderRights.lotusStatus_ != 0) { ThumbnailsLocked[1] = LotusLogo; if (CarSelectionGridInt == 1) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(true); GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lotus Evora"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), LotusCarInfo); CarSelectionGridInt = 1; } } if (xmlReaderRights.lamboStatus_ != 0) { ThumbnailsLocked[2] = LamborghiniLogo; if (CarSelectionGridInt == 2) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(true); Lotus.SetActiveRecursively(false); GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lamborghini Murcielago"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), LamboCarInfo); } } if (xmlReaderRights.fCaStatus_ != 0) { ThumbnailsLocked[3] = FerrariCALogo; if (CarSelectionGridInt == 3) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(true); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari California"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), FCaCarInfo); } } if (xmlReaderRights.f599Status_ != 0) { ThumbnailsLocked[4] = Ferrari599Logo; if (CarSelectionGridInt == 4) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(true); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari 599"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), F599CarInfo); } } /* * Shows Price tag for every car that is not bought */ if (xmlReaderRights.lotusStatus_ == 0) // for Lotus { if (CarSelectionGridInt == 1) { GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lotus Evora"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), lotusPrice + " \n Your money $" + money); } } if (xmlReaderRights.lamboStatus_ == 0) //for Lambo { if (CarSelectionGridInt == 2) { GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Lamborghini Murcielago"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), lamboPrice + " \n Your money $" + money); } } if (xmlReaderRights.fCaStatus_ == 0) //for Ferrari CA { if (CarSelectionGridInt == 3) { GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari California"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), fCaPrice + " \n Your money $" + money); } } if (xmlReaderRights.f599Status_ == 0) //for Ferrari 599 { if (CarSelectionGridInt == 4) { GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Ferrari F599"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), f599Price + " \n Your money $" + money); } } /* * Unity car is always active! */ if (CarSelectionGridInt == 0) { Cata.SetActiveRecursively(true); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); CarSelectionGridInt = 0; GUI.Box(new Rect(0, 0, Screen.width - 1150, Screen.height - 400), "Unit One"); GUI.Box(new Rect(0, 20, Screen.width - 1150, Screen.height - 400), UnityCarInfo); } if (GUI.Button(new Rect(0, Screen.height - 50, 100, 50), "Back")) // Brings you back to the Main Menu { Application.LoadLevel("Menu"); } xmlReaderRights reader = new xmlReaderRights(); reader.Start(); }
private void ImportarCata(string[] Files) { foreach (var s in Files) { int counter = 1; string line; int cero = 0; progressCata.Maximum = File.ReadAllLines(s).Length; FileStream stream = new FileStream(s, FileMode.Open); txtDescripcion.Text = ""; progressCata.Value = 0; try { System.IO.StreamReader file = new System.IO.StreamReader(stream); while ((line = file.ReadLine()) != null) { if (line.Substring(0, 1).Contains("1")) { numerolote = int.TryParse(line.Substring(17, 6), out numerolote) ? int.Parse(line.Substring(17, 6)) : cero; } if (numerolote != cero) { if (line.Contains("2;")) { numerocata = Int64.Parse(line.Substring(2, 14)); if (numerocata != cero) { var catas = Context.Cata .Where(x => x.Lote == numerolote && x.NumCata == numerocata) .Any(); if (catas.Equals(false)) { try { Cata cata; cata = new Cata(); cata.Id = Guid.NewGuid(); cata.Lote = numerolote; cata.NumCata = numerocata; Context.Cata.Add(cata); Context.SaveChanges(); } catch { throw; } } } } } if (numerocata != cero) { backgroundWorker1.ReportProgress(counter, "Nro Lote: " + numerolote + " - Nro CATA: " + numerocata); } counter++; } file.Close(); stream.Close(); MessageBox.Show("El archivo de afip se subió con exito.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } }
// Update is called once per frame void Update() { if (_CarSelectionGridInt == 0) { Cata.SetActiveRecursively(true); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); if (CataColorChange.ColorsSelectionGridInt == 0) { body.renderer.material.mainTexture = red; } if (CataColorChange.ColorsSelectionGridInt == 1) { body.renderer.material.mainTexture = blue; } if (CataColorChange.ColorsSelectionGridInt == 2) { body.renderer.material.mainTexture = yellow; } if (CataColorChange.ColorsSelectionGridInt == 3) { body.renderer.material.mainTexture = pink; } if (CataColorChange.ColorsSelectionGridInt == 4) { body.renderer.material.mainTexture = green; } if (CataColorChange.ColorsSelectionGridInt == 5) { body.renderer.material.mainTexture = orange; } _target = CataMass; } if (_CarSelectionGridInt == 1) { Cata.SetActiveRecursively(false); Lotus.SetActiveRecursively(true); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); lotusBlack.active = false; lotusRed.active = false; lotusYellow.active = false; lotusGreen.active = false; lotusSilver.active = false; lotusBlue.active = false; if (selectedColorInt == 0) { lotusBlack.SetActiveRecursively(true); } if (selectedColorInt == 1) { lotusRed.SetActiveRecursively(true); } if (selectedColorInt == 2) { lotusYellow.SetActiveRecursively(true); } if (selectedColorInt == 3) { lotusGreen.SetActiveRecursively(true); } if (selectedColorInt == 4) { lotusSilver.SetActiveRecursively(true); } if (selectedColorInt == 5) { lotusBlue.SetActiveRecursively(true); } } if (_CarSelectionGridInt == 2) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); Lambo.SetActiveRecursively(true); FCa.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); lamboRed.active = false; lamboOrange.active = false; lamboYellow.active = false; lamboBlue.active = false; lamboBlack.active = false; lamboGreen.active = false; if (selectedColorInt == 0) { lamboBlack.SetActiveRecursively(true); } if (selectedColorInt == 1) { lamboRed.SetActiveRecursively(true); } if (selectedColorInt == 2) { lamboYellow.SetActiveRecursively(true); } if (selectedColorInt == 3) { lamboGreen.SetActiveRecursively(true); } if (selectedColorInt == 4) { lamboOrange.SetActiveRecursively(true); lamboOrange.active = true; } if (selectedColorInt == 5) { lamboBlue.SetActiveRecursively(true); } } if (_CarSelectionGridInt == 3) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(false); FCa.SetActiveRecursively(true); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); fCaBlack.active = false; fCaBlue.active = false; fCaYellow.active = false; fCaRed.active = false; fCaSilver.active = false; fCaGreen.active = false; if (selectedColorInt == 0) { fCaBlack.SetActiveRecursively(true); } if (selectedColorInt == 1) { fCaRed.SetActiveRecursively(true); } if (selectedColorInt == 2) { fCaYellow.SetActiveRecursively(true); } if (selectedColorInt == 3) { fCaGreen.SetActiveRecursively(true); } if (selectedColorInt == 4) { fCaSilver.SetActiveRecursively(true); } if (selectedColorInt == 5) { fCaBlue.SetActiveRecursively(true); } } if (_CarSelectionGridInt == 4) { Cata.SetActiveRecursively(false); F599.SetActiveRecursively(true); FCa.SetActiveRecursively(false); Lambo.SetActiveRecursively(false); Lotus.SetActiveRecursively(false); f599Black.active = false; f599Blue.active = false; f599Red.active = false; f599White.active = false; f599Yellow.active = false; f599Silver.active = false; if (selectedColorInt == 0) { f599Black.SetActiveRecursively(true); } if (selectedColorInt == 1) { f599Red.SetActiveRecursively(true); } if (selectedColorInt == 2) { f599Yellow.SetActiveRecursively(true); } if (selectedColorInt == 3) { f599White.SetActiveRecursively(true); } if (selectedColorInt == 4) { f599Silver.SetActiveRecursively(true); } if (selectedColorInt == 5) { f599Blue.SetActiveRecursively(true); } } }
private void bt_consultar_Click(object sender, EventArgs e) { l_mensajes.Text = string.Empty; if (txt_idcata.Text.Equals("")) { l_mensajes.Text = "Ingresar id de Cata"; txt_idcata.Focus(); } else { int idcata; if (int.TryParse(txt_idcata.Text, out idcata)) { if (idcata > 0) { ControladorCata cc = new ControladorCata(); int res = cc.existeCata(idcata); switch (res) { case 0: l_mensajes.Text = "Datos del Producto NO existen en BD"; break; case 1: int estado = cc.ConsultarUnCata(idcata); switch (estado) { case 1: Cata ct = new Cata(); ct = cc.obtenerDatosCata(); txt_idcata.Text = ct.IdCata.ToString();; txt_fecha.Text = ct.FechaCata.ToString(); txt_nom.Text = ct.NombreCata; dgvCata.Rows.Clear(); object[] registroCata = new object[3]; registroCata[0] = ct.IdCata; registroCata[1] = ct.FechaCata; registroCata[2] = ct.NombreCata; dgvCata.Rows.Add(registroCata); habilitarActualizar(); break; default: l_mensajes.Text = "NO existe Conexión BD. Contacte a ..."; break; } break; default: l_mensajes.Text = "Error al conectarse a BD. Contacte a ..."; break; } } else { l_mensajes.Text = "Ingresar id de Producto > 0"; txt_idcata.Focus(); } } else { l_mensajes.Text = "Ingresar id de Producto numerico entero"; txt_idcata.Focus(); } } }
internal void SetCata(Cata cata) { txt_idcata.Text = cata.IdCata.ToString(); txt_fecha.Text = cata.FechaCata.ToString(); txt_nom.Text = cata.NombreCata.ToString(); }