public void QuitaRelacionesEmbarque(EmbarquesDet embarquesDet, string conexion) { try { CapaDatos.CD_Datos CDDatos = new CapaDatos.CD_Datos(conexion); string[] parametros = { "@Id_Emp", "@Id_Cd", "@Id_Emb", "@Id_Fac" }; object[] valores = { embarquesDet.Id_Emp, embarquesDet.Id_Cd, embarquesDet.Id_Emp, embarquesDet.Id_Fac }; } catch (Exception ex) { throw ex; } }
private void Guardar() { try { if (!validarCamposDetalle()) { this.RadTabStrip1.Focus(); this.RadMultiPage1.Focus(); if (this.txtCamioneta.Text == string.Empty) { this.txtCamioneta.Focus(); } if (this.txtChofer.Text == string.Empty) { this.txtChofer.Focus(); } return; } if (!validarFecha(this.dpFecha)) { this.dpFecha.Focus(); this.RadTabStrip1.Focus(); this.RadMultiPage1.Focus(); return; } if (dt_detalles == null || dt_detalles.Rows.Count == 0) { Alerta("Aún no se han capturado facturas"); return; } if (this.dpFecha.SelectedDate > this.txtDia.SelectedDate) { this.Alerta("El día no puede ser menor a la fecha"); return; } Embarques embarques = new Embarques(); embarques.Id_Emp = sesion.Id_Emp; embarques.Id_Cd = sesion.Id_Cd_Ver; embarques.Emb_Fec = Convert.ToDateTime(this.dpFecha.SelectedDate); embarques.Emb_Chofer = this.txtChofer.Text; embarques.Emb_Dia = Convert.ToDateTime(this.txtDia.SelectedDate); embarques.Emb_Camioneta = this.txtCamioneta.Text; embarques.Emb_Estatus = "C"; embarques.Id_U = sesion.Id_U; if (this.HF_ID.Value != string.Empty) { embarques.Id_Emb = Convert.ToInt32(this.txtEmbarque.Text); } else { embarques.Id_Emb = -1; } List <EmbarquesDet> listaEmbarquesDet = new List <EmbarquesDet>(); EmbarquesDet embarquesDet = new EmbarquesDet(); foreach (DataRow dr in dt_detalles.Rows) { //Genera la lista para la tabla detalles del embarque (EmbarquesDet) embarquesDet = new EmbarquesDet(); embarquesDet.Id_Emp = sesion.Id_Emp; embarquesDet.Id_Cd = sesion.Id_Cd_Ver; embarquesDet.Id_Emb = Convert.ToInt32(this.txtEmbarque.Text); embarquesDet.Id_Fac = Convert.ToInt32(dr["Id_Fac"].ToString()); listaEmbarquesDet.Add(embarquesDet); } List <Factura> listaFactura = new List <Factura>(); Factura factura = new Factura(); foreach (DataRow dr in dt_detalles.Rows) { factura = new Factura(); //Genera la lista actualizar el estatus en la table factura factura.Id_Emp = sesion.Id_Emp; factura.Id_Cd = sesion.Id_Cd_Ver; factura.Id_Fac = Convert.ToInt32(dr["Id_Fac"].ToString()); factura.Fac_Estatus = "E"; listaFactura.Add(factura); } string mensaje = string.Empty; int verificador = -1; CN_Embarques CNEmbarques = new CN_Embarques(); CNEmbarques.GuardaEmbarques(embarques, listaEmbarquesDet, sesion, listaFactura, ref verificador); if (verificador > 0) { mensaje = "Los datos se guardaron correctamente"; RAM1.ResponseScripts.Add(string.Concat(@"CloseWindow('", mensaje, "')")); } else { this.Alerta("No fue posible guardar la información"); } } catch (Exception ex) { throw ex; } }