protected override void OnAppearing() { base.OnAppearing(); try { tap = 0; Entidades.Respuesta Respuesta = new Entidades.Respuesta(); Usuario = db.GetAllLevantado(Usuario.Cedula); if (Usuario.Codigo_Ubicacion == 0) { Navigation.PopAsync(true); } if (buttonSelect == 3) { btnDiferencias_Clicked(null, null); } if (buttonSelect == 2) { btnContados_Clicked(null, null); } this.btnBusqueda.Text = ""; } catch (Exception) { return; } }
public void Cargar() { try { resp = Servicios.TraerDetalleEstantes(Producto); if (resp.Code == 1) { if (resp.Lista.Count > 0) { foreach (object i in resp.Lista) { Items.Add(JsonConvert.DeserializeObject <Entidades.DetalleEstante>(i.ToString())); } this.MyListView.ItemsSource = Items; this.BindingContext = Items; } else { this.Title = "No hay conteo para este Producto! "; } } Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } catch (Exception) { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); return; // throw; } }
protected override void OnAppearing() { base.OnAppearing(); try { tap = 0; Entidades.Respuesta Respuesta = new Entidades.Respuesta(); Usuario = db.GetAllLevantado(Usuario.Cedula); if (Usuario.Codigo_Ubicacion == 0) { Navigation.PopAsync(true); } if (Usuario.Conteo > 0) { if (listDiferencias.Count > 0) { listDiferencias.Remove(p); //eliminamos de la lista de Conteo con dif. if (buttonSelect != 1) { this.lvwProductos.ItemsSource = new List <Productos>(); this.lvwProductos.ItemsSource = listDiferencias; } } } } catch (Exception) { //throw; } }
private void Button_Clicked(object sender, EventArgs e) { Device.BeginInvokeOnMainThread(async() => { if (this.listDiferencias.Count != 0 && Usuario.Conteo > 0) { await DisplayAlert("Cerrar Estantes", "No se puede cerrar el estante hasta nque todos los productos con diferencias esten contados, la lista debe de estar limpia.", "Ok"); return; } var respuesta = await DisplayAlert("Cerrar Estantes", "Seguro que desea Cerrar el Estante Actual", "Aceptar", "Cancelar"); if (respuesta == true) { var resp = await Acr.UserDialogs.UserDialogs.Instance.PromptAsync("Ingrese su credencial para confirmar", "LIP", "Cerrar Estante", "Cancelar", "Tus Credenciales", Acr.UserDialogs.InputType.Default); if (resp.Text.ToUpper() == Usuario.Cedula.ToUpper()) { var estantes = new Services.EstantesServices(); Usuario.IsCerrado = true; Usuario.Codigo_Ubicacion = 0; if (db.CerrarEstante(Usuario) == 1) { var res = new Entidades.Respuesta(); res = estantes.CerrarUbicacion(Usuario); await Navigation.PopAsync(true); } } else { Acr.UserDialogs.UserDialogs.Instance.Toast(new Acr.UserDialogs.ToastConfig("Credenciales no validas!")); } } }); }
private void CerrarSession() { try { var servicio = new Services.LoginServices(); var respuesta = new Entidades.Respuesta(); respuesta = servicio.CerrarSession(Usuario); if (respuesta.Code == 1) { bd.DeleteUser(Usuario); Device.BeginInvokeOnMainThread(() => { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); DisplayAlert("LIP - PAISAS ", "La session ha sido cerrada!", "OK"); Navigation.PopAsync(true); }); } else { Device.BeginInvokeOnMainThread(() => { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); DisplayAlert("LIP - PAISAS ", respuesta.Response != ""?respuesta.Response:"Error de Conexion", "OK"); Navigation.PopAsync(true); }); } } catch (Exception) { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); DisplayAlert("LIP - PAISAS ", "Ocurrion un error", "OK"); // throw; } }
protected override void OnAppearing() { base.OnAppearing(); try { if (!this.VienededeLogin) { Entidades.Respuesta Respuesta = new Entidades.Respuesta(); Usuario = bd.GetAllLevantado(Usuario.Cedula); if (Usuario.IsCerrado) { Usuario.Codigo_Ubicacion = 0; } CargarDatos(); } } catch (Exception) { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); DisplayAlert("LIP", "Ocurrio Un error al Recuperar Datos Db Local", "Aceptar"); return; //throw; } }
private void Estantes_SelectedIndexChanged(object sender, EventArgs e) { if (cargarCombo) { return; } Entidades.Auth item = new Entidades.Auth(); Entidades.Respuesta Respuesta = new Entidades.Respuesta(); var r = (Entidades.Lista) this.Estantes.SelectedItem; item = Usuario; item.Codigo_Ubicacion = r.Codigo_Ubicacion; Respuesta = Servicio.SeleccionarEstantes(item); if (Respuesta.Code == 1) { this.VienededeLogin = false; BuscarProductoPage f = new BuscarProductoPage(); f.Usuario = item; f.Load(); this.Navigation.PushAsync(f, true); } else { DisplayAlert("LIP", "Ocurrio al seleccionar el estante, Intentelo de nuevo", "Aceptar"); } }
private void ActEstantes_Clicked(object sender, EventArgs e) { Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Cargando estantes"); Device.BeginInvokeOnMainThread(() => { Entidades.Respuesta Respuesta = new Entidades.Respuesta(); Usuario = bd.GetAllLevantado(Usuario.Cedula); CargarDatos(); }); }
private void Estantes_SelectedIndexChanged(object sender, EventArgs e) { if (cargarCombo) { return; } Entidades.Auth item = new Entidades.Auth(); Entidades.Respuesta Respuesta = new Entidades.Respuesta(); var r = (Entidades.Lista) this.Estantes.SelectedItem; item = Usuario; item.NombreUbicacion = r.Nombre; item.Codigo_Ubicacion = r.Codigo_Ubicacion; Respuesta = Servicio.SeleccionarEstantes(item); if (Respuesta.Code == 1) { this.VienededeLogin = false; BuscarProductoPage f = new BuscarProductoPage { Usuario = item }; f.Load(); this.Navigation.PushAsync(f, true); } else { DisplayAlert("LIP", "Ocurrio un error al seleccionar el estante, Intentelo de nuevo", "Aceptar"); Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Cerrando Sesión!", Acr.UserDialogs.MaskType.None); Device.BeginInvokeOnMainThread(() => { var Cd = new Boolean(); Cd = CargarDatos(); }); } }
void btnGuardar_Clicked(object sender, EventArgs e) { var pro = new Entidades.DetalleLevantadoTemp(); var Resp = new Entidades.Respuesta(); Services.ProductosServices Productos = new Services.ProductosServices(); if (string.IsNullOrEmpty(this.txtCantidad.Text)) { Acr.UserDialogs.UserDialogs.Instance.Toast("Ingrese una cantidad! "); return; } pro.Codigo_Usuario = Usuario.Codigo_Usuario; pro.CodigoSucursal = Usuario.Sucursal; pro.Codigo_Ubicacion = Usuario.Codigo_Ubicacion; pro.Codigo_Factura = Usuario.Parcial; pro.Codigo_Barra = this.lblResultado.Text; pro.Codigo_Producto = this.CodigoProducto; pro.Bodega = this.Usuario.Bodega; pro.Cargado = true; pro.Tipo_Origen = 1; if (Usuario.Conteo == 0) { pro.Cantidad = double.Parse(this.txtCantidad.Text); pro.Resultado = double.Parse(this.txtCantidad.Text);; } if (Usuario.Conteo == 1) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo1 = double.Parse(this.txtCantidad.Text); pro.UC1 = Usuario.Codigo_Usuario; } if (Usuario.Conteo == 2) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo2 = double.Parse(this.txtCantidad.Text); pro.UC2 = Usuario.Codigo_Usuario; } if (Usuario.Conteo == 3) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo3 = double.Parse(this.txtCantidad.Text); pro.UC3 = Usuario.Codigo_Usuario; } Device.BeginInvokeOnMainThread(async() => { var monto = new Double(); try { //g = Guar var g = await DisplayAlert(@"LIP Guardar Producto ", " Producto: " + this.NombreProducto + "\n\r" + " Cantidad :" + this.txtCantidad.Text + "\n\r" , "Cancelar", "Guardar"); //su guardar es cancelado if (g) { return; } if (!ProductosDiferencias) { Resp = Productos.GuardarProducto(pro); } else { Resp = Productos.ActualizarProducto(pro); } if (Resp.Code == 3) { var producto = new Entidades.DetalleLevantadoTemp(); producto = JsonConvert.DeserializeObject <Entidades.DetalleLevantadoTemp>(Resp.Objeto.ToString()); var respuesta = await DisplayAlert(@"LIP Producto Contado", " ya tiene conteo de " + producto.Resultado + "\n\r" + " que acción desea realizar?." + "\n\r" + " Actualizar = " + pro.Resultado + "\n\r" + " Agregar(Sumar) = " + (pro.Resultado + producto.Resultado), "Agregar", "Actualizar"); if (!respuesta) { //true -> Sobreescribir monto = pro.Resultado; } else {// Agregarla monto = (pro.Resultado + producto.Resultado); monto = (float)(Math.Round((double)monto, 2)); } if (Usuario.Conteo == 0) { pro.Cantidad = monto; pro.Resultado = monto; } if (Usuario.Conteo == 1) { pro.Resultado = monto; pro.Conteo1 = monto; pro.UC1 = Usuario.Codigo_Usuario; } if (Usuario.Conteo == 2) { pro.Resultado = monto; pro.Conteo2 = monto; pro.UC2 = Usuario.Codigo_Usuario; } if (Usuario.Conteo == 3) { pro.Resultado = monto; pro.Conteo3 = monto; pro.UC3 = Usuario.Codigo_Usuario; } var R = Productos.ActualizarProducto(pro); Resp.Response = R.Response; Resp.Code = R.Code; } if (Resp.Code == 1) { var lista = new List <Entidades.DetalleLevantadoTemp>(); lista = db.BuscarProductoDetalle(pro); if (lista.Count > 0) { db.ActualizarProductoDetalle(pro.Codigo_Usuario, pro.Codigo_Producto, pro.Codigo_Factura, pro.CodigoSucursal, pro.Codigo_Ubicacion, pro.Bodega, monto, Usuario.Conteo); } else { db.GuardarProductoDetalle(pro); } await DisplayAlert("LIP", Resp.Response, "Aceptar"); await Navigation.PopAsync(); } if (Resp.Code == 5) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); Usuario.Codigo_Ubicacion = 0; db.UpdateLevantado(Usuario); await Navigation.PopAsync(); } if (Resp.Code == 6) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); Usuario.Codigo_Ubicacion = 0; Usuario.IsCerrado = true; db.UpdateLevantado(Usuario); await Navigation.PopAsync(); } if (Resp.Code == 0) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); } if (Resp.Response == null) { await DisplayAlert("LIP", "Error Tiempo Espera Excedido!!", "Aceptar"); } } catch (Exception) { await DisplayAlert("LIP", "Ocurrio un error al guardar!", "Aceptar"); return; // throw; } }); //await Navigation.PopAsync(); //lblResultado.Text = resultado.Text; }
public void CargarDatos() { try { cargarCombo = true; Entidades.Auth item = new Entidades.Auth(); Entidades.Respuesta Respuesta = new Entidades.Respuesta(); BuscarProductoPage f = new BuscarProductoPage(); var Conteo = string.Empty; Conteo = Servicio.Conteo(Usuario); Respuesta = Servicio.TraerUbicaciones(Usuario); if (Respuesta.Code == 1) { Lista = Respuesta.Lista; } if (Usuario.IsCerrado) { Usuario.Codigo_Ubicacion = 0; } if ((int.Parse(Conteo)) - 1 != Usuario.Conteo) { Lista = Respuesta.Lista; Usuario.Conteo = (int.Parse(Conteo)) - 1; Usuario.Codigo_Ubicacion = 0; bd.EjecutarQueryScalar(string.Format("UPDATE Auth SET Conteo={0}, isCerrado= 0 ,Codigo_Ubicacion = {2} WHERE Codigo_Usuario ={1}", (int.Parse(Conteo) - 1), Usuario.Codigo_Usuario, Usuario.Codigo_Ubicacion)); } l.Clear(); foreach (object i in Lista) { l.Add(JsonConvert.DeserializeObject <Entidades.Lista>(i.ToString())); } this.BindingContext = l; this.Estantes.ItemsSource = l; this.lblBodega.Text = Usuario.Bodega.ToString(); this.lblSucursal.Text = Usuario.Sucursal.ToString(); this.lblUsuario.Text = Usuario.Nombre; if (this.Usuario.Codigo_Ubicacion != 0) { this.EstanteActivo = true; } else { this.EstanteActivo = false; } if (this.EstanteActivo) { this.btnContar.Text = "Seguir Contando "; this.btnContar.IsVisible = true; this.Estantes.IsVisible = false; this.lblEstante.Text = Usuario.Codigo_Ubicacion.ToString(); } else { this.Estantes.IsVisible = true; this.btnContar.IsVisible = false; this.btnContar.Text = "Iniciar Conteo"; this.lblEstante.Text = "Estante No Seleccionado"; } cargarCombo = false; Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } catch (Exception) { // throw;. cargarCombo = false; Acr.UserDialogs.UserDialogs.Instance.HideLoading(); Device.BeginInvokeOnMainThread(async() => { await DisplayAlert("LIP", " Error de Conexion", "Aceptar"); }); return; } }
void btnGuardar_Clicked(object sender, EventArgs e) { var pro = new Entidades.DetalleLevantadoTemp(); var Resp = new Entidades.Respuesta(); Services.ProductosServices Productos = new Services.ProductosServices(); if (string.IsNullOrEmpty(this.txtCantidad.Text)) { Acr.UserDialogs.UserDialogs.Instance.Toast("Ingrese una cantidad! "); return; } this.txtCantidad.Text = TruncateDecimal(decimal.Parse(this.txtCantidad.Text), 2).ToString(); pro.Codigo_Usuario = Usuario.Codigo_Usuario; pro.CodigoSucursal = Usuario.Sucursal; pro.Codigo_Ubicacion = Usuario.Codigo_Ubicacion; pro.Codigo_Factura = Usuario.Parcial; pro.Codigo_Barra = this.lblResultado.Text; pro.Codigo_Producto = this.CodigoProducto; pro.Bodega = this.Usuario.Bodega; pro.Cargado = true; pro.Tipo_Origen = 1; if (Usuario.Conteo == 0) { pro.Cantidad = double.Parse(this.txtCantidad.Text); pro.Resultado = double.Parse(this.txtCantidad.Text);; pro.Tipo_Origen = 1; } if (Usuario.Conteo == 1) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo1 = double.Parse(this.txtCantidad.Text); pro.UC1 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC1 = 1; } if (Usuario.Conteo == 2) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo2 = double.Parse(this.txtCantidad.Text); pro.UC2 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC2 = 1; } if (Usuario.Conteo == 3) { pro.Resultado = double.Parse(this.txtCantidad.Text); pro.Conteo3 = double.Parse(this.txtCantidad.Text); pro.UC3 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC3 = 1; } if (double.Parse(this.txtCantidad.Text) == 0) { pro.NoMostrarApp = 1; } Device.BeginInvokeOnMainThread(async() => { var monto = new Double(); try { //g = Guar var g = await DisplayAlert(@"LIP Guardar Producto ", "Producto: " + this.NombreProducto + "\n\r" + "Cantidad :" + this.txtCantidad.Text + "\n\r" , "Guardar", "Cancelar"); //su guardar es cancelado if (!g) { return; } if (!ProductosDiferencias) { Resp = Productos.GuardarProducto(pro); } else { Resp = Productos.ActualizarProducto(pro); } if (Resp.Code == 3) { var producto = new Entidades.DetalleLevantadoTemp(); producto = JsonConvert.DeserializeObject <Entidades.DetalleLevantadoTemp>(Resp.Objeto.ToString()); var respuesta = await Acr.UserDialogs.UserDialogs.Instance.PromptAsync(@"ya tiene conteo de " + TruncateDecimal((decimal)producto.Resultado, 2) + "\n\r" + "que monto desea Guardar?. Digite la Opción " + "\n\r" + "1 = " + pro.Resultado + "\n\r" + "2 = " + TruncateDecimal((decimal)(producto.Resultado + pro.Resultado), 2) + "\n\r" + "3 = Guardar lo mismo !", "LIP - Los Paisas", "Guardar", "Cancelar", "Escribe la Opción", Acr.UserDialogs.InputType.Default); if (!respuesta.Ok && respuesta.Text != "") { return; } if (respuesta.Text == "1") { //true -> Sobreescribir monto = (double)TruncateDecimal((decimal)pro.Resultado, 2); } else if (respuesta.Text == "2") {// Agregarla monto = (pro.Resultado + producto.Resultado); monto = (double)TruncateDecimal((decimal)monto, 2); } else if (respuesta.Text == "3") {// no hacer nada await Navigation.PopAsync(); } else { await DisplayAlert("LIP", "Ingresar Unicamente si es opción 1 , Opción 2 U Opción 3 ", "Aceptar"); return; } if (monto == 0) { pro.NoMostrarApp = 1; } if (Usuario.Conteo == 0) { pro.Cantidad = monto; pro.Resultado = monto; pro.Tipo_Origen = 1; } if (Usuario.Conteo == 1) { pro.Resultado = monto; pro.Conteo1 = monto; pro.UC1 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC1 = 1; } if (Usuario.Conteo == 2) { pro.Resultado = monto; pro.Conteo2 = monto; pro.UC2 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC2 = 1; } if (Usuario.Conteo == 3) { pro.Resultado = monto; pro.Conteo3 = monto; pro.UC3 = Usuario.Codigo_Usuario; pro.Tipo_OrigenC3 = 1; } var R = Productos.ActualizarProducto(pro); Resp.Response = R.Response; Resp.Code = R.Code; } if (Resp.Code == 1) { var lista = new List <Entidades.DetalleLevantadoTemp>(); lista = db.BuscarProductoDetalle(pro); if (lista.Count > 0) { db.ActualizarProductoDetalle(pro.Codigo_Usuario, pro.Codigo_Producto, pro.Codigo_Factura, pro.CodigoSucursal, pro.Codigo_Ubicacion, pro.Bodega, monto, Usuario.Conteo); } else { db.GuardarProductoDetalle(pro); } await DisplayAlert("LIP", "Cantidad Guardada!", "Aceptar"); await Navigation.PopAsync(); } if (Resp.Code == 5) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); Usuario.Codigo_Ubicacion = 0; db.UpdateLevantado(Usuario); await Navigation.PopAsync(); } if (Resp.Code == 6) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); Usuario.Codigo_Ubicacion = 0; Usuario.IsCerrado = true; db.UpdateLevantado(Usuario); await Navigation.PopAsync(); } if (Resp.Code == 0) { await DisplayAlert("LIP", Resp.Response, "Aceptar"); } if (Resp.Response == null) { await DisplayAlert("LIP", "Error Tiempo Espera Excedido!!", "Aceptar"); } } catch (Exception) { await DisplayAlert("LIP", "Ocurrio un error al guardar!", "Aceptar"); return; // throw; } }); }