protected void btn_buscar_articulo_Click(object sender, EventArgs e) { if (txt_articulo.Value != "") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Articulo obj = new WSGestion.MOD_Articulo(); obj = wsgest.SEL_GRID_BY_ID_Articulo(Convert.ToInt32(txt_articulo.Value), centro_seleccionado); if ( (obj.ART_id_articulo != 0) && (obj.ART_tipo == "T")) { Alert_Mensaje.Visible = false; txt_descripcion.Value = obj.ART_descripcion; } else { txt_descripcion.Value = null; txt_articulo.Value = null; txt_articulo.Attributes.Add("onfocus", "this.select();"); txt_articulo.Focus(); Alert_Mensaje.Attributes["class"] = "alert alert-danger"; if (obj.ART_tipo == "S") { mensaje_alerta = "El artículo digitado es de tipo servicio y este no puede ser agregado a una bodega"; } else { mensaje_alerta = "El artículo digitado no se encuentra en la base de datos"; } titulo_mensaje_alerta = "Error: "; Alert_Mensaje.Visible = true; } } else { txt_descripcion.Value = null; txt_articulo.Value = null; txt_articulo.Attributes.Add("onfocus", "this.select();"); txt_articulo.Focus(); Alert_Mensaje.Attributes["class"] = "alert alert-warning"; mensaje_alerta = "Debe de digitar un dato en el campo artículo"; titulo_mensaje_alerta = "Advertencia: "; Alert_Mensaje.Visible = true; } }
private void Carga_Editar() { try { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Articulo obj = new WSGestion.MOD_Articulo(); obj = wsgest.SEL_GRID_BY_ID_Articulo(codigo_seleccionado, centro_seleccionado); txt_descripcion.Value = obj.ART_descripcion; txt_codigo.Value = obj.ART_id_articulo.ToString(); txt_codigo_barras.Value = obj.ART_codigo_barras; txt_cea_codigo.Value = obj.ART_id_centro_atencion.ToString(); txt_cea_nombre.Value = obj.CEA_nombre; txt_precio.Value = obj.PRE_art_precio.ToString(CultureInfo.CreateSpecificCulture("en-US")); txt_fecha.Text = obj.PRE_art_fecha; dl_tipo_articulo.SelectedValue = obj.ART_tipo; dl_unidad_medida.SelectedValue = obj.ART_id_unidad_medida.ToString(); dl_categoria_articulo.SelectedValue = obj.ART_id_categoria_articulo.ToString(); dl_tipo_articulo.Enabled = false; txt_codigo.Disabled = true; } catch (Exception exc) { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0"; Alert_Mensaje.Attributes["class"] = "alert alert-danger"; mensaje_alerta = exc.ToString(); titulo_mensaje_alerta = "Error: "; Alert_Mensaje.Visible = true; } }
private void Carga_Lineas() { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); DataTable dt = new DataTable(); dt = (DataTable)Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Lineas"]; try { wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Articulo obj = new WSGestion.MOD_Articulo(); obj = wsgest.SEL_GRID_BY_ID_Articulo(Convert.ToInt32(buscar), centro_seleccionado); if (obj.CEA_nombre != null) { WSGestion.MOD_Bodega_Articulo obj2 = new WSGestion.MOD_Bodega_Articulo(); obj2.BXA_id_articulo = obj.ART_id_articulo; obj2.BXA_id_bodega = bodega_seleccionado; obj2.BXA_id_centro_atencion = centro_seleccionado; obj2.BXA_id_sucursal = bodega_seleccionado; obj2.BXA_cantidad = 0; if (wsgest.CRE_Bodega_Articulo(obj2)) { dt.Rows.Add(ult_linea, obj.ART_id_articulo, obj.ART_descripcion, 0); Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"ULT_Linea"] = dt.Rows.Count.ToString(); } else { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Error"] = "En la asignación del artículo a la bodega"; } } else { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Error"] = "Artículo digitado no se encuentra en la base de datos"; } gridview_lineas.DataSource = dt; gridview_lineas.DataBind(); } catch (Exception exc) { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Error"] = exc.ToString(); } }
private void Carga_Lineas() { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); DataTable dt = new DataTable(); dt = (DataTable)Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Lineas"]; try { WSGestion.MOD_Articulo obj = new WSGestion.MOD_Articulo(); obj = wsgest.SEL_GRID_BY_ID_Articulo(Convert.ToInt32(buscar), centro); if (obj.CEA_nombre != null) { dt.Rows.Add(obj.ART_id_articulo, obj.ART_descripcion, Convert.ToInt32(txt_cantidad.Value),obj.PRE_art_precio,(Convert.ToInt32(txt_cantidad.Value)*obj.PRE_art_precio)); } else { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Error"] = "Error: Artículo digitado no se encuentra en la base de datos"; } gridview_lineas.DataSource = dt; gridview_lineas.DataBind(); } catch (Exception exc) { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Error"] = "Error: " + exc.ToString(); } }