private void GuardaDoctor() { string tipo = "I"; int estatus; int cedula = Int32.Parse(dgwDoctor.CurrentRow.Cells[0].Value.ToString()); string nombre = dgwDoctor.CurrentRow.Cells[1].Value.ToString(); string domicilio = dgwDoctor.CurrentRow.Cells[2].Value.ToString(); //int estatus = Int32.Parse(dgwDoctor.CurrentRow.Cells[3].Value.ToString()); if (dgwDoctor.CurrentRow.Cells[3].Value.ToString() == "ACTIVO") { estatus = 1; c.AgregaDoctor(cedula, nombre, domicilio, estatus, tipo); c.cargaDoctor(dgwDoctor); btnGuardar.Visible = false; btnModificar.Visible = false; btnAgregar.Enabled = true; } else if (dgwDoctor.CurrentRow.Cells[3].Value.ToString() == "INACTIVO") { estatus = 2; c.AgregaDoctor(cedula, nombre, domicilio, estatus, tipo); c.cargaDoctor(dgwDoctor); btnGuardar.Visible = false; btnModificar.Visible = false; btnAgregar.Enabled = true; } /* c.AgregaDoctor(cedula, nombre, domicilio, estatus,tipo); c.cargaDoctor(dgwDoctor); btnGuardar.Visible = false; btnModificar.Visible = false; btnAgregar.Enabled = true;*/ }
private void btnGuardar_Click(object sender, EventArgs e) { string tipo = "I"; if (rbtnDoctor.Checked == true) { foreach (DataGridViewRow row in dgvCargaInformacion.Rows) { int cedula = Int32.Parse(dgvCargaInformacion[0, row.Index].Value.ToString()); ; string nombre = dgvCargaInformacion[1, row.Index].Value.ToString(); string direccion = dgvCargaInformacion[2, row.Index].Value.ToString(); int estatus = Int32.Parse(dgvCargaInformacion[3, row.Index].Value.ToString()); c.AgregaDoctor(cedula, nombre, direccion, estatus,tipo); LimpiaDataGrid(); } } if (rbtnProveedor.Checked == true) { foreach (DataGridViewRow row in dgvCargaInformacion.Rows) { string RFC = dgvCargaInformacion[0, row.Index].Value.ToString(); string razon = dgvCargaInformacion[1, row.Index].Value.ToString(); string mail = dgvCargaInformacion[2, row.Index].Value.ToString(); string tel = dgvCargaInformacion[3, row.Index].Value.ToString(); int estatus = Int32.Parse(dgvCargaInformacion[4, row.Index].Value.ToString()); string calle = dgvCargaInformacion[5, row.Index].Value.ToString(); string colonia = dgvCargaInformacion[6, row.Index].Value.ToString(); string delegacion = dgvCargaInformacion[7, row.Index].Value.ToString(); int numint = Int32.Parse(dgvCargaInformacion[8, row.Index].Value.ToString()); int numext = Int32.Parse(dgvCargaInformacion[9, row.Index].Value.ToString()); string localidad = dgvCargaInformacion[10, row.Index].Value.ToString(); int estado = Int32.Parse(dgvCargaInformacion[11, row.Index].Value.ToString()); int cp = Int32.Parse(dgvCargaInformacion[12, row.Index].Value.ToString()); // c.AgregaProveedor(RFC, razon, mail, tel, estatus, calle, colonia, delegacion, numint, numext, localidad, estado, cp,tipo); LimpiaDataGrid(); } } if (rbtnCliente.Checked == true) { foreach (DataGridViewRow row in dgvCargaInformacion.Rows) { string rfc = dgvCargaInformacion[0, row.Index].Value.ToString(); string cfdi = dgvCargaInformacion[1, row.Index].Value.ToString(); string nombre = dgvCargaInformacion[2, row.Index].Value.ToString(); string calle = dgvCargaInformacion[3, row.Index].Value.ToString(); int numext = Int32.Parse(dgvCargaInformacion[4, row.Index].Value.ToString()); int numint = Int32.Parse(dgvCargaInformacion[5, row.Index].Value.ToString()); string colonia = dgvCargaInformacion[6, row.Index].Value.ToString(); string delegacion = dgvCargaInformacion[7, row.Index].Value.ToString(); string localidad = dgvCargaInformacion[8, row.Index].Value.ToString(); int cp = Int32.Parse(dgvCargaInformacion[9, row.Index].Value.ToString()); int estado = Int32.Parse(dgvCargaInformacion[10, row.Index].Value.ToString()); int estatus = Int32.Parse(dgvCargaInformacion[11, row.Index].Value.ToString()); string mail = dgvCargaInformacion[12, row.Index].Value.ToString(); string telefono = dgvCargaInformacion[13, row.Index].Value.ToString(); // c.AgregaCliente(rfc, cfdi, nombre, calle, numext, numint, colonia, delegacion, localidad, cp, estado, estatus, mail,telefono,tipo); LimpiaDataGrid(); } } }