protected ClsCatZMasterCollection ConsultarZMasterDAL(string psCriterio) { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); ClsCatZMasterCollection zMasterColeccion = new ClsCatZMasterCollection(); ClsCatZMaster zMaster; try { da.SelectCommand = new SqlCommand(Procedimientos.sp_ConsCatZMaster, this.Conexion); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@Criterio", SqlDbType.VarChar).Value = psCriterio; da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { int renglones = ds.Tables[0].Rows.Count; int columnas = ds.Tables[0].Columns.Count; for (int contador = 0; contador < ds.Tables[0].Rows.Count; contador++) { zMaster = new ClsCatZMaster(); //ds.Tables[0].Columns[1].ColumnName zMaster.CreadoPor = ds.Tables[0].Rows[contador]["CreadoPor"].ToString().Trim(); zMaster.IdTarima = ds.Tables[0].Rows[contador]["IdTarima"].ToString().Trim(); zMaster.Werks = ds.Tables[0].Rows[contador]["Werks"].ToString().Trim(); zMaster.IdCaja = Convert.ToInt64(ds.Tables[0].Rows[contador]["IdCaja"].ToString().Trim()); zMaster.Matnr = ds.Tables[0].Rows[contador]["Matnr"].ToString().Trim(); zMaster.Charg = ds.Tables[0].Rows[contador]["Charg"].ToString().Trim(); zMaster.Cantidad = Convert.ToDouble(ds.Tables[0].Rows[contador]["Cantidad"].ToString().Trim()); zMaster.FechaCreacion = Convert.ToDateTime(ds.Tables[0].Rows[contador]["FechaCreacion"].ToString().Trim()); zMaster.FechaProduccion = Convert.ToDateTime(ds.Tables[0].Rows[contador]["FechaProduccion"].ToString().Trim()); zMaster.FechaCaducidad = Convert.ToDateTime(ds.Tables[0].Rows[contador]["FechaCaducidad"].ToString().Trim()); zMaster.HoraCreacion = Convert.ToDateTime(ds.Tables[0].Rows[contador]["HoraCreacion"].ToString().Trim()); zMaster.Desembalada = ds.Tables[0].Rows[contador]["Desembalada"].ToString().Trim(); zMaster.Borrado = ds.Tables[0].Rows[contador]["Borrado"].ToString().Trim(); zMaster.AsignadaEntrega = ds.Tables[0].Rows[contador]["AsignadaEntrega"].ToString().Trim(); zMasterColeccion.Add(zMaster); } } return(zMasterColeccion); } catch (Exception ex) { throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.Trim()); } finally { this.Conexion.Close(); } }
public ClsCatZMasterCollection ConsultarZMasterBAL(string psCriterio) { ClsCatZMasterCollection zMasterCollection = new ClsCatZMasterCollection(); try { zMasterCollection = base.ConsultarZMasterDAL(psCriterio); return(zMasterCollection); } catch { throw; } }
private void GuardarRegistro() { try { //Crear el objeto con la info de la forma ClsZCAT zCat = new ClsZCAT(); zCat.TARIMA = Convert.ToDecimal(textTarima.Text); zCat.Werks = textCentro.Text.Trim(); zCat.Lgort = textAlmacen.Text.Trim(); zCat.Ubicacion = textUbicacionDestino.Text.Trim(); zCat.TipoAlmacen = txtbxTipoAlmacen.Text.Trim(); ClsZCATBAL zCATBAL = new ClsZCATBAL(); zCATBAL.AgregarZCATBAL(zCat); String lsCriterio = "WHERE IDTarima = '" + tarima + "' AND WERKS = '" + centroC + "' "; ClsCatZMasterBAL zMasBal = new ClsCatZMasterBAL(); ClsCatZMasterCollection zMasColl = zMasBal.ConsultarZMasterBAL(lsCriterio); if (zMasColl.Count > 0) { ClsCatZMaster zMast = zMasColl[0]; zMast.CentroDestino = textCentro.Text; zMast.AlmacenDestino = textAlmacen.Text; zMast.UbicacionDestino = textUbicacionDestino.Text; zMasBal.ActualizarZMasterDestinosBAL(zMast); } base.MostrarMensaje("Pedido de traslado creado..."); PerformLayout(); Application.DoEvents(); System.Threading.Thread.Sleep(2000); textUbicacionDestino.Text = ""; textTarima.Text = ""; textCentro.Text = ""; textAlmacen.Text = ""; textTarima.Focus(); } catch { throw; } }