public Referencia GetCartItemById(string Nit, int oferta, string sReferencia) { Referencia referencias = new Referencia(); List <CartItemEntity> cartItems = null; var connectionString = ConfigurationManager.ConnectionStrings["dbComercial"].ConnectionString; using (var session = SessionManager.OpenSession(connectionString)) { cartItems = (from c in session.Query <CartItemEntity>() where c.Oferta.Equals(oferta) && c.Referencia.Equals(sReferencia) && c.Nit.Equals(Nit) orderby c.Referencia, c.Plu select c).ToList(); } ReferenciaService rs = new ReferenciaService(); Referencia referencia = rs.GetReferencia(oferta, sReferencia, true); foreach (CartItemEntity cartItem in cartItems) { Plu plu = referencia.Plu.Find(x => x.PLU == cartItem.Plu); int index = referencia.Plu.IndexOf(plu); plu.Cantidad = cartItem.Cantidad; plu.itemId = cartItem.Id; referencia.Plu[index] = plu; } return(referencia); }
public void fillPlu(ref Referencia referencia) { CustomerService cs = new CustomerService(); DataSet dsMaterial = cs.ObtenerMaterialCustomerService("'" + referencia.IdReferencia + "'"); foreach(DataRow dr in dsMaterial.Tables[0].Rows ){ Plu plu = new Plu(); plu.Codigo = dr["PLU"] == DBNull.Value ? "": dr["PLU"].ToString(); plu.Color = dr["COLOR"] == DBNull.Value ? "" : dr["COLOR"].ToString(); plu.Talla = dr["CODIGOTALLA"] == DBNull.Value ? "" : dr["CODIGOTALLA"].ToString(); plu.Precio = System.Convert.ToInt32( dr["PRECIO"] == DBNull.Value ? "": dr["PRECIO"]); plu.GrupoArticulo = dr["GRUPOART"] == DBNull.Value ? "": dr["GRUPOART"].ToString(); plu.AnoVenta = dr["ANOVENTA"] == DBNull.Value ? "": dr["ANOVENTA"].ToString(); plu.Clase = dr["CLASE"] == DBNull.Value ? "": dr["CLASE"].ToString(); plu.CodigoColor = dr["CODIGOCOLOR"] == DBNull.Value ? "": dr["CODIGOCOLOR"].ToString(); plu.Coleccion = dr["COLECCION"] == DBNull.Value ? "": dr["COLECCION"].ToString(); plu.ConcDiseno = dr["CONCDISENO"] == DBNull.Value ? "": dr["CONCDISENO"].ToString(); plu.DenomGrupoArtiulo = dr["DENOMGRUPOART"] == DBNull.Value ? "": dr["DENOMGRUPOART"].ToString(); plu.DenomIVA = System.Convert.ToDouble(dr["DENOMIVA"] == DBNull.Value ? "": dr["DENOMIVA"].ToString()); plu.Descripcion = dr["DESCRIPMATERIAL"] == DBNull.Value ? "" : dr["DESCRIPMATERIAL"].ToString(); plu.Destino = dr["DESTINO"] == DBNull.Value ? "": dr["DESTINO"].ToString(); plu.Edad = dr["EDAD"] == DBNull.Value ? "": dr["EDAD"].ToString(); plu.Edad1 = dr["EDAD1"] == DBNull.Value ? "": dr["EDAD1"].ToString(); plu.FechaInicio = dr["FECHAINICIO"] == DBNull.Value ? "": dr["FECHAINICIO"].ToString(); plu.FechaFin = dr["FECHAFIN"] == DBNull.Value ? "": dr["FECHAFIN"].ToString(); plu.Genero = dr["GENERO"] == DBNull.Value ? "": dr["GENERO"].ToString(); plu.Genero1 = dr["GENERO1"] == DBNull.Value ? "": dr["GENERO1"].ToString(); plu.GrupoArticuloExt = dr["GRUPOARTEXT"] == DBNull.Value ? "": dr["GRUPOARTEXT"].ToString(); plu.IVA = System.Convert.ToInt32(dr["IVA"] == DBNull.Value ? "": dr["IVA"].ToString()); plu.Marca = dr["MARCA"] == DBNull.Value ? "": dr["MARCA"].ToString(); plu.MesVenta = dr["MESVENTA"] == DBNull.Value ? "": dr["MESVENTA"].ToString(); plu.Moneda = dr["MONEDA"] == DBNull.Value ? "": dr["MONEDA"].ToString(); plu.PaisOrigen = dr["PAISORIG"] == DBNull.Value ? "": dr["PAISORIG"].ToString(); plu.PLU = dr["PLU"] == DBNull.Value ? "": dr["PLU"].ToString(); //Saldo = System.Convert.ToDouble(dr["SALDO"] == DBNull.Value ? "": dr["SALDO"].ToString()); plu.stock = System.Convert.ToDouble(dr["STOCK"] == DBNull.Value ? "": dr["STOCK"].ToString()); plu.SubLinea = dr["SUBLINEA"] == DBNull.Value ? "": dr["SUBLINEA"].ToString(); plu.SubLinea1 = dr["SUBLINEA1"] == DBNull.Value ? "": dr["SUBLINEA1"].ToString(); plu.TipoMaterial = dr["TIPOMAT"] == DBNull.Value ? "": dr["TIPOMAT"].ToString(); plu.TipoNegocio = dr["TIPONEGOCIO"] == DBNull.Value ? "": dr["TIPONEGOCIO"].ToString(); plu.TipoNegocio1 = dr["TIPONEGOC"] == DBNull.Value ? "": dr["TIPONEGOC"].ToString(); plu.TipoReferencia = dr["TIPOREFERENCIA"] == DBNull.Value ? "": dr["TIPOREFERENCIA"].ToString(); plu.TipoTejido = dr["TIPOTEJIDO"] == DBNull.Value ? "": dr["TIPOTEJIDO"].ToString(); plu.ValorComposicion = dr["VALORCOMPOSICION"] == DBNull.Value ? "": dr["VALORCOMPOSICION"].ToString(); plu.Mundo = Utility.GetMundo(plu.Genero, plu.Edad); referencia.Plu.Add(plu); if (!referencia.Tallas.Contains(dr["CODIGOTALLA"].ToString())) { referencia.Tallas.Add(dr["CODIGOTALLA"].ToString()); } if (!referencia.Colores.Contains(dr["COLOR"].ToString())) { referencia.Colores.Add(dr["COLOR"].ToString()); } } }
public List <Referencia> GetCartItemsByNit(string Nit) { List <Referencia> referencias = new List <Referencia>(); List <CartItemEntity> cartItems = null; var connectionString = ConfigurationManager.ConnectionStrings["dbComercial"].ConnectionString; using (var session = SessionManager.OpenSession(connectionString)) { cartItems = (from c in session.Query <CartItemEntity>() where c.Nit.Equals(Nit) orderby c.Referencia, c.Plu select c).ToList(); } if (cartItems != null && cartItems.Count > 0) { ReferenciaService rs = new ReferenciaService(); Referencia referencia = rs.GetReferencia(cartItems[0].Oferta, cartItems[0].Referencia, true); List <string> Colors = new List <string>(); foreach (CartItemEntity cartItem in cartItems) { if (cartItem.Cantidad > 0) { if (referencia.IdReferencia != cartItem.Referencia) { referencia.Colores = Colors; referencias.Add(referencia); Colors = new List <string>(); referencia = rs.GetReferencia(cartItem.Oferta, cartItem.Referencia, true); } Plu plu = referencia.Plu.Find(x => x.PLU == cartItem.Plu); int index = referencia.Plu.IndexOf(plu); plu.Cantidad = cartItem.Cantidad; plu.itemId = cartItem.Id; referencia.Plu[index] = plu; if (!Colors.Contains(plu.Color)) { Colors.Add(plu.Color); } } } if (cartItems.Count > 0) { referencia.Colores = Colors; referencias.Add(referencia); } } return(referencias); }
public bool IsOk() { var rt = true; if (Descripcion.Trim() == "") { Helpers.Msg.Error("CAMPO [ DESCRIPCION ] DEBE SER LLENADO"); return(false); } if (AutoDepartamento.Trim() == "") { Helpers.Msg.Error("CAMPO [ DEPARTAMENTO ] DEBE SER LLENADO"); return(false); } if (AutoGrupo.Trim() == "") { Helpers.Msg.Error("CAMPO [ GRUPO ] DEBE SER LLENADO"); return(false); } if (AutoMarca.Trim() == "") { Helpers.Msg.Error("CAMPO [ MARCA ] DEBE SER LLENADO"); return(false); } if (AutoEmpCompra.Trim() == "") { Helpers.Msg.Error("CAMPO [ EMPAQUE COMPRA ] DEBE SER LLENADO"); return(false); } if (AutoImpuesto.Trim() == "") { Helpers.Msg.Error("CAMPO [ TASA IMPUESTO ] DEBE SER LLENADO"); return(false); } if (IdOrigen.Trim() == "" || IdOrigen.Trim() == "-1") { Helpers.Msg.Error("CAMPO [ ORIGEN ] DEBE SER LLENADO"); return(false); } if (IdCategoria.Trim() == "" || IdCategoria.Trim() == "-1") { Helpers.Msg.Error("CAMPO [ CATEGORIA ] DEBE SER LLENADO"); return(false); } if (IdDivisa.Trim() == "" || IdDivisa.Trim() == "-1") { Helpers.Msg.Error("CAMPO [ ADMINISTRADO x DIVISA ] DEBE SER LLENADO"); return(false); } if (IdClasificacionAbc.Trim() == "" || IdClasificacionAbc.Trim() == "-1") { Helpers.Msg.Error("CAMPO [ CLASIFICACION ] DEBE SER LLENADO"); return(false); } if (EsPesado) { if (Plu.Trim() == "") { Helpers.Msg.Error("CAMPO [ PLU ] DEBE SER LLENADO"); return(false); } } return(rt); }