protected void BindByDataRow(DataRow dr, Orden_trabajo_servicio o) { try { int.TryParse(dr["id"].ToString(), out entero); o.Id = entero; entero = 0; if (dr["id_orden_trabajo"] != DBNull.Value) { int.TryParse(dr["id_orden_trabajo"].ToString(), out entero); o.Id_orden_trabajo = entero; entero = 0; } if (dr["id_servicio"] != DBNull.Value) { int.TryParse(dr["id_servicio"].ToString(), out entero); o.Id_servicio = entero; entero = 0; } if (dr["id_etiqueta_tipo"] != DBNull.Value) { int.TryParse(dr["id_etiqueta_tipo"].ToString(), out entero); o.Id_etiqueta_tipo = entero; entero = 0; } if (dr["piezas"] != DBNull.Value) { int.TryParse(dr["piezas"].ToString(), out entero); o.Piezas = entero; entero = 0; } o.Ref1 = dr["ref1"].ToString(); o.Ref2 = dr["ref2"].ToString(); if (dr["parcial"] != DBNull.Value) { int.TryParse(dr["parcial"].ToString(), out entero); o.Parcial = entero; entero = 0; } } catch { throw; } }
public override void fillLst() { try { this.comm = GenericDataAccess.CreateCommandSP("sp_Orden_trabajo_servicio"); addParameters(0); this.dt = GenericDataAccess.ExecuteSelectCommand(comm); this._lst = new List <Orden_trabajo_servicio>(); foreach (DataRow dr in dt.Rows) { Orden_trabajo_servicio o = new Orden_trabajo_servicio(); BindByDataRow(dr, o); this._lst.Add(o); } } catch { throw; } }
public static List <Orden_trabajo> OrdenTrabajoGetLst() { List <Orden_trabajo> lst = new List <Orden_trabajo>(); string folioError = string.Empty; try { Orden_trabajoMng oMng = new Orden_trabajoMng(); oMng.fillOpen(); lst = oMng.Lst; Orden_trabajo_servicioMng oOTSMng = new Orden_trabajo_servicioMng(); Entrada_liverpoolMng oELMng = new Entrada_liverpoolMng(); Entrada_liverpool oEL; Etiqueta_tipoMng oETMng = new Etiqueta_tipoMng(); MaquilaMng oMaqMng = new MaquilaMng(); Maquila_pasoMng oMaqPasoMng = new Maquila_pasoMng(); Entrada oE; EntradaMng oEMng = new EntradaMng(); foreach (Orden_trabajo itemOT in lst) { itemOT.PLstOTSer = new List <Orden_trabajo_servicio>(); Orden_trabajo_servicio oOTS = new Orden_trabajo_servicio() { Id_orden_trabajo = itemOT.Id }; oOTSMng.O_Orden_trabajo_servicio = oOTS; oOTSMng.fillLstByIdOT(); itemOT.Servicios = oOTSMng.Lst.Count(); oEL = new Entrada_liverpool(); oEL.Trafico = itemOT.Referencia; oELMng.O_Entrada_liverpool = oEL; oELMng.selByTrafico(); if (oEL.Id_entrada > 0) { oE = new Entrada(); oE.Id = oEL.Id_entrada; oEMng.O_Entrada = oE; oEMng.selById(); itemOT.PEnt = oE; } foreach (Orden_trabajo_servicio itemOTS in oOTSMng.Lst) { Etiqueta_tipo oET = new Etiqueta_tipo() { Id = itemOTS.Id_etiqueta_tipo }; oETMng.O_Etiqueta_tipo = oET; oETMng.selById(); itemOTS.PEtiquetaTipo = oET; Maquila oMaq = new Maquila() { Id_ord_tbj_srv = itemOTS.Id }; oMaqMng.O_Maquila = oMaq; oMaqMng.fillLstByOTS(); itemOTS.PLstMaq = oMaqMng.Lst; itemOTS.PiezasMaq = itemOTS.PLstMaq.Sum(p => p.Piezas); Maquila_paso oMaqPaso = new Maquila_paso() { Id_ord_tbj_srv = itemOTS.Id }; oMaqPasoMng.O_Maquila_paso = oMaqPaso; oMaqPasoMng.fillByIdOTS(); itemOTS.PLstPasos = oMaqPasoMng.Lst; switch (itemOTS.Id_servicio) { case 1: //etiqueta de precio oEL = new Entrada_liverpool() { Trafico = itemOTS.Ref1, Pedido = Convert.ToInt32(itemOTS.Ref2), Parcial = itemOTS.Parcial }; oELMng.O_Entrada_liverpool = oEL; oELMng.selByUniqueKey(); itemOTS.PEntLiv = oEL; break; default: break; } itemOT.PLstOTSer.Add(itemOTS); } } } catch { throw new Exception(folioError); } return(lst); }
public Orden_trabajo_servicioMng() { this._oOrden_trabajo_servicio = new Orden_trabajo_servicio(); this._lst = new List <Orden_trabajo_servicio>(); }