private void SERVicIoS_Detach(SERVicIoS entity) { entity.ClientEs = null; }
public void altaServicioCliente(int numeroCliente, int numeroServicio, string Nombre, string Direccion, string Telefonos, string Contacto, string email, string Celular, string CelularTrust, string Tareas, string Observaciones, bool Activo, DateTime? FechaBaja, string MotivoBaja) { SERVicIoS ser = null; try { DbLinq.Data.Linq.Table<SERVicIoS> tablaServicios = database.GetTable<SERVicIoS>(); ser = new SERVicIoS(); ser.NumeroCliente = (uint)numeroCliente; ser.NumeroServicio = (uint)numeroServicio; ser.Nombre = Nombre; ser.Email = email; ser.Direccion = Direccion; ser.Telefonos = Telefonos; ser.PersonaContacto = Contacto; //ser.DiaCobro = DiaDeCobro; //ser.NombreCobrar = NombreCobrar; ser.Celular = Celular; ser.CelularTrust = CelularTrust; ser.TareasAsignadas = Tareas; ser.Observaciones = Observaciones; ser.FechaAlta = DateTime.Now; if (Activo) ser.Activo = 1; else ser.Activo = 0; ser.FechaBaja = FechaBaja; ser.MotivoBaja = MotivoBaja; tablaServicios.InsertOnSubmit(ser); database.SubmitChanges(); } catch (MySqlException ex) { //database.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues); // database.Connection.Close(); if (ex.Number == 1062) { // int index = database.GetChangeSet().Inserts.IndexOf(cliente); // database.GetChangeSet().Inserts.RemoveAt(index); database.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues); } throw ex; } }
private void SERVicIoS_Attach(SERVicIoS entity) { entity.ClientEs = this; }
private void PosteriorBTN_Click(object sender, EventArgs e) { int numCli = int.Parse(ucCliente.ClienteNRO); ind = (ind + 1) % cant; servicio = datos.obtenerServicioCliente(int.Parse(ucCliente.ClienteNRO), numerosSer[ind]); mtServicio.Text = numerosSer[ind].ToString(); txtServicio.Text = servicio.Nombre; //mtFecha.Focus(); mtServicio.Focus(); SendKeys.Send("{ENTER}"); }
private void AnteriorBTN_Click(object sender, EventArgs e) { int numCli = int.Parse(ucCliente.ClienteNRO); if ((ind - 1) < 0) ind = cant - 1; else ind = ind - 1; servicio = datos.obtenerServicioCliente(int.Parse(ucCliente.ClienteNRO), numerosSer[ind]); mtServicio.Text = numerosSer[ind].ToString(); txtServicio.Text = servicio.Nombre; //mtFecha.Focus(); //mtFecha.Text = DateTime.Now.ToShortDateString(); mtServicio.Focus(); SendKeys.Send("{ENTER}"); }
private void ucCliente_cliPronto(object sender, EventArgs e) { //AgregarBTN.Enabled = false; //GuardarBTN.Enabled = false; //ContratoBTN.Enabled = false; AnteriorBTN.Visible = false; PosteriorBTN.Visible = false; if (ucCliente.find) { try { //DateTime tmpFecha = DateTime.Now; int numCli = int.Parse(ucCliente.ClienteNRO); cliente = datos.obtenerCliente(numCli); Cliente cli = sistema.obtenerCliente(numCli); List<Servicio> servicios = cli.getListaServicios(); if (servicios.Count != 0) { cant = servicios.Count; numerosSer = new int[cant]; int i = 0; foreach (Servicio ser in servicios) { numerosSer[i] = ser.getNumero(); i++; } ind = 0; servicio = datos.obtenerServicioCliente(numCli, numerosSer[ind]); mtServicio.Text = numerosSer[ind].ToString(); txtServicio.Text = servicio.Nombre; //mtFecha.Focus(); //MessageBox.Show(DateTime.Now.ToShortDateString()); //tmpFecha.Kind = DateTimeKind.Local; //MessageBox.Show(tmpFecha.ToShortDateString()); //string temp = DateTime.Now.ToShortDateString(); //mtFecha.Text = temp; SendKeys.Send("{ENTER}"); if (cant > 1) { AnteriorBTN.Visible = true; PosteriorBTN.Visible = true; } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //else // MessageBox.Show("No existe el Cliente "+ucCliente.ClienteNRO, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void mtServicio_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && mtServicio.Text != "") { try { //mtServicio.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; if (datos.existeClienteServicio(int.Parse(ucCliente.ClienteNRO),int.Parse(mtServicio.Text))) { servicio = datos.obtenerServicioCliente(int.Parse(ucCliente.ClienteNRO), int.Parse(mtServicio.Text)); txtServicio.Text = servicio.Nombre; cliente = datos.obtenerCliente(int.Parse(ucCliente.ClienteNRO)); cargarDatos(); SendKeys.Send("{ENTER}"); } else MessageBox.Show("No existe el servicio en el Cliente.","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (e.KeyCode == Keys.F2) { // Abrir ventana de busqueda de servicios de ese cliente. } }
private Servicio convertServicioDatosToServicioLogica(SERVicIoS ser) { Servicio servicio; bool act; try { if (ser.Activo == 1) act = true; else act = false; servicio = new Servicio((int)ser.NumeroServicio, ser.Nombre, ser.Direccion, ser.Telefonos, ser.PersonaContacto, ser.Email, ser.Celular, ser.CelularTrust, ser.TareasAsignadas, act, ser.FechaAlta.Value, ser.FechaBaja, ser.MotivoBaja, ser.Observaciones); return servicio; }catch(Exception ex) { throw ex; } }