public int Guardar(Orden ordenEntrada) { id += 1; ordenEntrada.Id = id; using (writer = File.AppendText(direccion)) { writer.WriteLine(ordenEntrada.ToString()); } return(id); }
public String NuevoCodigo(String Tabla) { Int32 Orden; object top = cd.Contar("select top (1) Codigo from " + Tabla + " order by Codigo desc"); if (top != null) { Orden = Convert.ToInt32(top.ToString()) + 1; } else { Orden = 1; } return(Orden.ToString()); }
/// <summary> /// Devuelve una cadena representando la instancia actual /// </summary> /// <returns></returns> public override string ToString() { return string.Join( " | ", new string[] { Mapeo, Orden.ToString(), Destino, TipoDestino, Fuente, TipoFuente } ); } // end ToString()
/// <summary> /// Devuelve una cadena representando la instancia actual de la clase /// </summary> /// <returns></returns> public override string ToString() { return(string.Join( " | ", new string[] { Mapeo, Orden.ToString(), Destino_Tabla, Destino_Campo, Destino_TipoDatos, Destino_Tamano, Transformacion_Tipo, Transformacion_Detalle, Transformacion_Atributos, Fuente_Tabla, Fuente_Campo, Fuente_TipoDatos, Fuente_Tamano } )); } // end ToString()
public void Modificar(Orden ordenEntrada) { using (reader = File.OpenText(direccion)) { using (writer = File.AppendText(direccionTemp)) { while (!reader.EndOfStream) { string registro = reader.ReadLine(); string[] campos = registro.Split('#'); if (Int32.Parse(campos[0]) != ordenEntrada.Id) { writer.WriteLine(registro); } else { writer.WriteLine(ordenEntrada.ToString()); } } } } File.Replace(direccionTemp, direccion, direccionBackup); }
private void btnAceptar_Click(object sender, EventArgs e) { bool isEmpty = !Helper.Llenos(txtEquipo, txtObservaciones, txtFolio); if (cliente == null || isEmpty) { return; } int folio = int.Parse(txtFolio.Text); string equipo = txtEquipo.Text; string observaciones = txtObservaciones.Text; DateTime recepcion = cdtpFechaRecepcion.Value; var orden = new Orden() { Folio = folio, Equipo = equipo, FechaRecepcion = recepcion, Observaciones = observaciones, Status = (int)OrdenStatus.ESPERA, IdCliente = cliente.Id }; var res = OrdenValidator.Validate(orden); if (ShowErrorValidation.Valid(res)) { orden = OrdenController.I.Add(orden); } if (orden == null) { MessageBox.Show("Error al agregar a la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Agrega el estado de la orden al historial var ordenHistorial = new OrdenHistorial() { IdOrden = orden.Id, FechaStatus = DateTime.Now, Status = (int)OrdenStatus.ESPERA }; res = OrdenHistorialValidator.Validate(ordenHistorial); if (ShowErrorValidation.Valid(res)) { var saved = OrdenHistorialController.I.Add(ordenHistorial); if (saved == null) { MessageBox.Show("No se puede agregar al historial de ordenes", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (orden != null) { Helper.VaciarTexto(txtFolio, txtEquipo, txtObservaciones, txtTelefono, txtDireccion, txtCliente); Console.WriteLine(orden.ToString()); orden = null; cliente = null; ordenHistorial = null; } }
public override string ToString() { text elementoComplejo = ""; text simpleContent = ""; elementoComplejo = "<xs:complexType"; if (Nombre != null) { elementoComplejo &= " name=\"" + nombre + "\""; } elementoComplejo &= ">"; if (IsTextOnly) { elementoComplejo &= "xs:simpleContent>"; simpleContent = SimpleContent.ToString(); simpleContent.Remove("</xs:restriccion>"); elementoComplejo &= simpleContent; //con sus restricciones } else if (!IsEmpty) { elementoComplejo = "<xs:complexType"; if (Nombre != null) { elementoComplejo &= " name=\"" + nombre + "\""; } elementoComplejo &= " mixed=\"" + mixed.ToString().ToLower() + "\"><xs:complexContent>"; if (tipoXsdBase != null) { elementoComplejo &= "<xs:extension base=\"" + tipoXsdBase + "\">"; } elementoComplejo &= "<" + orden.ToString().ToLower() + ">"; foreach (KeyValuePair <ElementoXsdOrdenado, string> elemento in elementos) { elementoComplejo &= elemento.Value; } elementoComplejo &= "</" + orden.ToString().ToLower() + ">"; if (IsExtensibleElement) { elementoComplejo &= "<xs:any minOccurs=\"0\"/>"; } } foreach (KeyValuePair <AtributoXsd, string> atributo in atributos) { elementoComplejo &= atributo.Value; } if (tipoXsdBase != null && !IsEmpty && !IsTextOnly) { elementoComplejo &= "</xs:extension>"; } if (IsExtensibleAttribute) { elementoComplejo &= "<xs:anyAttribute/>"; } if (!IsEmpty && !IsTextOnly) { elementoComplejo &= "</xs:complexContent>"; } if (IsTextOnly) { elementoComplejo &= "</xs:restriccion>"; elementoComplejo &= "</xs:simpleContent>"; } elementoComplejo &= "</xs:complexType>"; return(elementoComplejo); }