private async void Save() { place.Nombre = txtNombre.Text; int response = await Places.save(place); if (response > 0) { CloureManager.GoBack(new CloureParam("place_id", response)); } }
public SupportPage() { this.InitializeComponent(); moduleInfo = CloureManager.GetModuleInfo(); txtInquiryTypePrompt.Text = moduleInfo.locales.GetNamedString("inquiry_type"); txtCommentsPrompt.Text = moduleInfo.locales.GetNamedString("comments"); GetSupportTypes(); }
public ChangePassPage() { this.InitializeComponent(); ModuleInfo moduleInfo = CloureManager.GetModuleInfo(); txtNewPassPrompt.Text = moduleInfo.locales.GetNamedString("new_password"); txtOldPassPrompt.Text = moduleInfo.locales.GetNamedString("old_password"); txtRepeatPassPrompt.Text = moduleInfo.locales.GetNamedString("repeat_password"); }
public async static Task <List <UserGroup> > GetList() { List <UserGroup> items = new List <UserGroup>(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "users_groups")); cparams.Add(new CloureParam("topic", "get_list")); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); JsonArray registers = api_response.GetNamedArray("Registros"); foreach (JsonValue jsonValue in registers) { JsonObject register = jsonValue.GetObject(); UserGroup item = new UserGroup(); item.Id = register.GetNamedString("Id"); item.Name = register.GetNamedString("Nombre"); item.Type = register.GetNamedString("TipoGrupoId"); item.IsStaff = CloureManager.ParseBoolObject(register.GetNamedValue("PerteneceAEmpresa")); JsonArray available_commands_arr = register.GetNamedArray("AvailableCommands"); item.AvailableCommands = new List <AvailableCommand>(); foreach (JsonValue available_cmd_obj in available_commands_arr) { JsonObject available_cmd_item = available_cmd_obj.GetObject(); int available_cmd_id = (int)available_cmd_item.GetNamedNumber("Id"); string available_cmd_name = available_cmd_item.GetNamedString("Name"); string available_cmd_title = available_cmd_item.GetNamedString("Title"); AvailableCommand availableCommand = new AvailableCommand(available_cmd_id, available_cmd_name, available_cmd_title); item.AvailableCommands.Add(availableCommand); } items.Add(item); } } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(items); }
public async static Task <List <ModulePrivileges> > GetPrivileges(string grupo_id = "") { List <ModulePrivileges> items = new List <ModulePrivileges>(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("topic", "get_modules_privileges")); cparams.Add(new CloureParam("grupo_id", grupo_id)); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); JsonArray registers = api_response.GetNamedArray("Registros"); foreach (JsonValue jsonValue in registers) { JsonObject register = jsonValue.GetObject(); ModulePrivileges modulePrivileges = new ModulePrivileges(); modulePrivileges.ClourePrivileges = new List <ClourePrivilege>(); modulePrivileges.ModuleTitle = register.GetNamedString("Title"); modulePrivileges.ModuleId = register.GetNamedString("Id"); JsonArray privileges_tmp = register.GetNamedArray("Privileges"); foreach (JsonValue privilege_tmp in privileges_tmp) { JsonObject privilegeObj = privilege_tmp.GetObject(); ClourePrivilege item = new ClourePrivilege(); item.Id = privilegeObj.GetNamedString("Id"); item.Title = privilegeObj.GetNamedString("Titulo"); item.Type = privilegeObj.GetNamedString("Type"); item.Value = privilegeObj.GetNamedString("Value"); modulePrivileges.ClourePrivileges.Add(item); } items.Add(modulePrivileges); } } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(items); }
public static async Task <GenericResponse> GetList(string filtro = "", string ordenar_por = "", string orden = "", int Page = 1) { GenericResponse genericResponse = new GenericResponse(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "transports")); cparams.Add(new CloureParam("topic", "listar")); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); JsonArray registers = api_response.GetNamedArray("Registros"); foreach (JsonValue jsonValue in registers) { JsonObject register = jsonValue.GetObject(); Transport item = new Transport(); item.Id = (int)register.GetNamedNumber("Id"); item.Name = register.GetNamedString("Nombre"); JsonArray available_commands_arr = register.GetNamedArray("AvailableCommands"); item.availableCommands = new List <AvailableCommand>(); foreach (JsonValue available_cmd_obj in available_commands_arr) { JsonObject available_cmd_item = available_cmd_obj.GetObject(); int available_cmd_id = (int)available_cmd_item.GetNamedNumber("Id"); string available_cmd_name = available_cmd_item.GetNamedString("Name"); string available_cmd_title = available_cmd_item.GetNamedString("Title"); AvailableCommand availableCommand = new AvailableCommand(available_cmd_id, available_cmd_name, available_cmd_title); item.availableCommands.Add(availableCommand); } genericResponse.Items.Add(item); } genericResponse.PageString = api_response.GetNamedString("PageString"); } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(genericResponse); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); lstPhotographers.ItemsSource = null; if (e.Parameter != null) { if (e.Parameter.GetType() == typeof(int)) { int id = (int)e.Parameter; show = await Shows.Get(id); txtFecha.Date = show.Fecha.Value; txtBandaArtista.SelectedValue = show.ArtistaId; txtLugar.SelectedValue = show.LugarId; lstPhotographers.ItemsSource = null; lstPhotographers.ItemsSource = show.Fotografos; //LoadData(id); } } else { show = new Show(); show.Id = 0; txtFecha.Date = DateTime.Now; txtBandaArtista.SelectedIndex = -1; txtLugar.SelectedIndex = -1; } //Verify GoBack Method var cParameter = CloureManager.GetParameter(); if (cParameter != null) { if (cParameter.GetType() == typeof(CloureParam)) { CloureParam cloureParam = (CloureParam)cParameter; if (cloureParam.name == "place_id") { LoadPlaces((int)cloureParam.value); } if (cloureParam.name == "artist_id") { LoadBandArtists((int)cloureParam.value); } } else if (cParameter.GetType() == typeof(ObservableCollection <User>)) { fotografos = (ObservableCollection <User>)cParameter; show.Fotografos = fotografos; lstPhotographers.ItemsSource = null; lstPhotographers.ItemsSource = fotografos; } } }
public static async Task <List <PropertyType> > getList(string filtro = "") { List <PropertyType> response = new List <PropertyType>(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "properties_types")); cparams.Add(new CloureParam("topic", "listar")); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); JsonArray registers = api_response.GetNamedArray("Registros"); foreach (JsonValue jsonValue in registers) { JsonObject register = jsonValue.GetObject(); PropertyType item = new PropertyType(); item.Id = (int)register.GetNamedNumber("Id"); item.Nombre = register.GetNamedString("Nombre"); /* * JsonArray available_commands_arr = register.GetNamedArray("AvailableCommands"); * item.availableCommands = new List<AvailableCommand>(); * foreach (JsonValue available_cmd_obj in available_commands_arr) * { * JsonObject available_cmd_item = available_cmd_obj.GetObject(); * int available_cmd_id = (int)available_cmd_item.GetNamedNumber("Id"); * string available_cmd_name = available_cmd_item.GetNamedString("Name"); * string available_cmd_title = available_cmd_item.GetNamedString("Title"); * AvailableCommand availableCommand = new AvailableCommand(available_cmd_id, available_cmd_name, available_cmd_title); * item.availableCommands.Add(availableCommand); * } */ response.Add(item); } } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(response); }
private void StockActual_PreviewKeyUp(object sender, KeyRoutedEventArgs e) { TextBox tb = (TextBox)sender; CloureManager.NumberInput(tb); ProductStock productStock = (ProductStock)((FrameworkElement)e.OriginalSource).DataContext; double stock_actual = 0; double.TryParse(tb.Text, out stock_actual); productStock.Actual = stock_actual; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); locales = await CloureManager.getLocales("users"); lblApellido.Text = locales.GetNamedString("last_name"); lblNombre.Text = locales.GetNamedString("name"); lblEmpresa.Text = locales.GetNamedString("company"); lblBirthDate.Text = locales.GetNamedString("birthdate"); btnFechaNacDatePicker.Content = locales.GetNamedString("select"); lblGender.Text = locales.GetNamedString("gender"); lblUserGroup.Text = locales.GetNamedString("user_group"); lblEmail.Text = locales.GetNamedString("email"); if (e.Parameter != null) { if (e.Parameter.GetType() == typeof(int)) { int id = (int)e.Parameter; get_user(id); } } else { user = new User(); user.id = 0; } if (CloureManager.getAccountType() == "free") { txtFreeAdvice.Text = ""; Run run = new Run(); run.Text = moduleInfo.locales.GetNamedString("user_free_warning_group"); Hyperlink hyperlink = new Hyperlink(); Run hyperlinkInline = new Run(); hyperlinkInline.Text = moduleInfo.locales.GetNamedString("learn_about_our_plans"); hyperlink.Inlines.Add(hyperlinkInline); //hyperlink.NavigateUri = new Uri("https://cloure.com/?app_token=" + Core.Core.appToken); hyperlink.NavigateUri = new Uri("https://cloure.com/plans"); txtFreeAdvice.Inlines.Add(run); txtFreeAdvice.Inlines.Add(hyperlink); txtFreeAdvice.Visibility = Visibility.Visible; txtGrupo.SelectedValue = "user"; txtGrupo.IsEnabled = true; btnGrupoAdd.IsEnabled = false; pivotMain.Margin = new Thickness(0, 70, 0, 0); } }
public static async Task <Show> Get(int id) { Show item = new Show(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "shows")); cparams.Add(new CloureParam("topic", "obtener")); cparams.Add(new CloureParam("id", id)); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject item_obj = api_result.GetNamedObject("Response"); item.Id = CloureManager.ParseInt(item_obj.GetNamedValue("Id")); item.ArtistaId = CloureManager.ParseInt(item_obj.GetNamedValue("ArtistaId")); item.LugarId = CloureManager.ParseInt(item_obj.GetNamedValue("LugarId")); item.Fecha = CloureManager.ParseDate(item_obj.GetNamedValue("Fecha")); JsonArray fotografosArr = item_obj.GetNamedArray("Fotografos"); item.Fotografos = new ObservableCollection <User>(); foreach (JsonValue fotografoItem in fotografosArr) { JsonObject fotografo = fotografoItem.GetObject(); User fotografoUser = new User(); fotografoUser.id = CloureManager.ParseInt(fotografo.GetNamedValue("Id")); fotografoUser.nombre = fotografo.GetNamedString("Nombre"); fotografoUser.apellido = fotografo.GetNamedString("Apellido"); fotografoUser.razonsocial = fotografoUser.apellido + ", " + fotografoUser.nombre; fotografoUser.email = fotografo.GetNamedString("Mail"); fotografoUser.grupo = fotografo.GetNamedString("Grupo"); fotografoUser.ImageURL = new Uri(fotografo.GetNamedString("Imagen")); fotografoUser.Fotos = CloureManager.ParseInt(fotografo.GetNamedValue("Fotos")); item.Fotografos.Add(fotografoUser); } } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(item); }
private async void Guardar() { userGroup.Name = txtNombre.Text; userGroup.Id = txtNombre.Text; userGroup.IsStaff = tgAdminGroup.IsOn; userGroup.ModulePrivileges = modulePrivileges; if (await UsersGroups.save(userGroup)) { CloureManager.GoBack(); } }
public static async Task <Receipt> Get(int id) { Receipt receipt = new Receipt(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "receipts")); cparams.Add(new CloureParam("topic", "obtener")); cparams.Add(new CloureParam("id", id.ToString())); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); receipt.CustomerName = api_response.GetNamedString("Usuario"); receipt.CustomerAddress = api_response.GetNamedString("UsuarioDomicilio"); receipt.Total = CloureManager.ParseNumber(api_response.GetNamedValue("Total")); List <CartItem> items = new List <CartItem>(); JsonArray values = api_response.GetNamedArray("Items"); foreach (JsonValue jsonValue in values) { double cant = 0; JsonObject item_obj = jsonValue.GetObject(); CartItem item = new CartItem(); item.ProductoId = (int)item_obj.GetNamedNumber("ProductoId"); item.Cantidad = CloureManager.ParseNumber(item_obj.GetNamedValue("Cantidad")); item.Descripcion = item_obj.GetNamedString("Detalles"); item.Importe = CloureManager.ParseNumber(item_obj.GetNamedValue("Importe")); item.Total = CloureManager.ParseNumber(item_obj.GetNamedValue("Total")); items.Add(item); } receipt.cartItems = items; } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(receipt); }
private async void LoadSettings() { stackModulesOptions.Children.Clear(); moduleSettings = await Settings.GetList(); foreach (ModuleSettings module in moduleSettings) { TextBlock txtModuleTitle = new TextBlock(); txtModuleTitle.HorizontalAlignment = HorizontalAlignment.Stretch; txtModuleTitle.HorizontalTextAlignment = TextAlignment.Center; txtModuleTitle.Text = module.ModuleTitle; if (module.CloureSettings != null) { StackPanel stackPrivileges = new StackPanel(); if (module.CloureSettings.Count > 0) { foreach (CloureSetting setting in module.CloureSettings) { Grid grid = new Grid(); TextBlock txtPrivilegeTitle = new TextBlock(); ColumnDefinition colTitle = new ColumnDefinition(); ColumnDefinition colControl = new ColumnDefinition(); colTitle.Width = new GridLength(1, GridUnitType.Star); colControl.Width = new GridLength(200, GridUnitType.Pixel); grid.ColumnDefinitions.Add(colTitle); grid.ColumnDefinitions.Add(colControl); txtPrivilegeTitle.Text = setting.Title; Grid.SetColumn(txtPrivilegeTitle, 0); grid.Children.Add(txtPrivilegeTitle); if (setting.Type == "bool") { ToggleSwitch toggleSwitch = new ToggleSwitch(); toggleSwitch.Tag = setting; toggleSwitch.IsOn = CloureManager.ParseBoolObject(setting.Value); toggleSwitch.Toggled += ToggleSwitch_Toggled; Grid.SetColumn(toggleSwitch, 1); grid.Children.Add(toggleSwitch); } stackPrivileges.Children.Add(grid); } stackModulesOptions.Children.Add(txtModuleTitle); stackModulesOptions.Children.Add(stackPrivileges); } } } }
public static async Task <bool> Save(List <ModuleSettings> moduleSettings) { bool response = true; try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "settings")); cparams.Add(new CloureParam("topic", "save")); if (moduleSettings != null) { } string str_content = "["; foreach (ModuleSettings module in moduleSettings) { foreach (CloureSetting setting in module.CloureSettings) { str_content += "{"; str_content += "\"module_id\":\"" + module.ModuleId + "\","; str_content += "\"option\":\"" + setting.Id + "\","; str_content += "\"type\":\"" + setting.Type + "\","; str_content += "\"value\":\"" + setting.Value + "\""; str_content += "},"; } } str_content = str_content.TrimEnd(','); str_content += "]"; cparams.Add(new CloureParam("settings", str_content)); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { //JsonObject api_response = api_result.GetNamedObject("Response"); } else { throw new Exception(error); } } catch (Exception ex) { response = false; var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(response); }
private async void Save() { companyBranch.Name = txtNombre.Text; companyBranch.Address = txtDireccion.Text; companyBranch.Phone = txtTelefono.Text; int res = await CompanyBranches.save(companyBranch); if (res > 0) { CloureManager.GoBack(); } }
private async void check_monthly_exceed() { bool exceed = await finances.Finances.isMonthlyIncomingExceded(); if (CloureManager.getAccountType() == "free" || CloureManager.getAccountType() == "test_free") { if (exceed) { btnAceptar.IsEnabled = false; txtAdvice.Text = ""; } } }
public static async Task <bool> save(User user) { bool response = true; try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "users")); cparams.Add(new CloureParam("topic", "guardar")); cparams.Add(new CloureParam("id", user.id)); cparams.Add(new CloureParam("nombre", user.nombre)); cparams.Add(new CloureParam("apellido", user.apellido)); cparams.Add(new CloureParam("grupo_id", user.grupo_id)); cparams.Add(new CloureParam("empresa", user.empresa)); cparams.Add(new CloureParam("genero_id", user.GeneroId)); cparams.Add(new CloureParam("mail", user.email)); cparams.Add(new CloureParam("salario_bruto", user.salario)); cparams.Add(new CloureParam("comision", user.comision)); if (user.CloureImage != null) { cparams.Add(new CloureParam("uploaded_image", user.CloureImage)); } string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); if (user.id == 0) { string msg = "Usuario guardado con éxito!\nClave generada: " + api_response.GetNamedString("clave_raw"); CloureManager.ShowDialog(msg); } } else { throw new Exception(error); } } catch (Exception ex) { response = false; var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(response); }
public async static Task <bool> save(UserGroup userGroup) { bool response = true; try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "users_groups")); cparams.Add(new CloureParam("topic", "guardar")); cparams.Add(new CloureParam("id", userGroup.Id)); cparams.Add(new CloureParam("nombre", userGroup.Name)); cparams.Add(new CloureParam("pertenece_a_la_empresa", userGroup.IsStaff)); string str_content = "["; foreach (ModulePrivileges module in userGroup.ModulePrivileges) { foreach (ClourePrivilege privilege in module.ClourePrivileges) { str_content += "{"; str_content += "\"module_id\":\"" + module.ModuleId + "\","; str_content += "\"option\":\"" + privilege.Id + "\","; //str_content += "\"type\":\"" + privilege.Type + "\","; str_content += "\"value\":\"" + privilege.Value.ToString() + "\""; str_content += "},"; } } str_content = str_content.TrimEnd(','); str_content += "]"; cparams.Add(new CloureParam("privilegios", str_content)); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); } else { throw new Exception(error); } } catch (Exception ex) { response = false; var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(response); }
public FinanceAdd() { this.InitializeComponent(); moduleInfo = CloureManager.GetModuleInfo(); cboOperationPrompt.Text = moduleInfo.locales.GetNamedString("operation"); cboPaymentMethodPrompt.Text = moduleInfo.locales.GetNamedString("payment_method"); txtDescriptionPrompt.Text = moduleInfo.locales.GetNamedString("description"); txtAmountPrompt.Text = moduleInfo.locales.GetNamedString("amount"); GetOperations(); GetPaymentsMethods(); }
public ProductServiceAddPage() { this.InitializeComponent(); this.moduleInfo = CloureManager.GetModuleInfo(); if (CloureManager.getAccountType() == "free" || CloureManager.getAccountType() == "test_free") { txtImgAdvice.Text = moduleInfo.locales.GetNamedString("warning_text_image_free"); } LoadLocales(); LoadProductTypes(); LoadProductUnits(); }
public MyAccountPage() { this.InitializeComponent(); moduleInfo = CloureManager.GetModuleInfo(); txtNombrePrompt.Text = moduleInfo.locales.GetNamedString("name"); txtApellidoPrompt.Text = moduleInfo.locales.GetNamedString("last_name"); txtTelefonoPrompt.Text = moduleInfo.locales.GetNamedString("phone"); txtMailPrompt.Text = moduleInfo.locales.GetNamedString("email"); txtPaisPrompt.Text = moduleInfo.locales.GetNamedString("country"); txtPaisN1Prompt.Text = moduleInfo.locales.GetNamedString("state_province"); LoadCountries(); }
private async void Save() { if (creditCard == null) { creditCard = new DebitCard(); creditCard.Id = 0; } creditCard.Name = txtNombre.Text; if (await DebitCards.save(creditCard)) { CloureManager.GoBack("reload"); } }
public PropertiesAddPage() { this.InitializeComponent(); LoadPropertiesTypes(); LoadOperations(); LoadCountries(); LoadCurrencies(); if (CloureManager.getAccountType() == "free") { txtImgAdvice.Text = "En esta versión de cloure solo podrás cargar una imagen"; } }
public static async Task <ProductService> GetItem(int id) { ProductService item = new ProductService(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "products_services")); cparams.Add(new CloureParam("topic", "obtener")); cparams.Add(new CloureParam("id", id.ToString())); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject item_obj = api_result.GetNamedObject("Response"); item.Id = (int)item_obj.GetNamedNumber("Id"); item.ProductTypeId = (int)item_obj.GetNamedNumber("TipoProductoId"); item.MeasureUnitId = (int)item_obj.GetNamedNumber("SistemaMedidaId"); item.Title = item_obj.GetNamedString("Titulo"); item.Descripcion = item_obj.GetNamedString("Descripcion"); item.CategoriaN1Id = (int)item_obj.GetNamedNumber("CategoriaN1Id"); item.CategoriaN2Id = (int)item_obj.GetNamedNumber("CategoriaN2Id"); item.CodigoInterno = item_obj.GetNamedString("Codigo"); item.CodigoBarras = item_obj.GetNamedString("CodigoBarras"); item.IVA = CloureManager.ParseNumber(item_obj.GetNamedValue("Iva")); item.CostoPrecio = CloureManager.ParseNumber(item_obj.GetNamedValue("CostoPrecio")); item.CostoImporte = CloureManager.ParseNumber(item_obj.GetNamedValue("CostoImporte")); item.VentaPrecio = CloureManager.ParseNumber(item_obj.GetNamedValue("VentaPrecio")); item.VentaImporte = CloureManager.ParseNumber(item_obj.GetNamedValue("VentaImporte")); item.StockTotal = CloureManager.ParseNumber(item_obj.GetNamedValue("StockActual")); } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(item); }
private async void Save(Transport transport) { if (transport == null) { transport = new Transport(); transport.Id = 0; } transport.Name = txtNombre.Text; if (await Transports.save(transport)) { CloureManager.GoBack("reload"); } }
public static async Task <LinkedAccount> Obtener(string nombre = "") { LinkedAccount response = new LinkedAccount(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "linked_accounts")); cparams.Add(new CloureParam("topic", "obtener")); cparams.Add(new CloureParam("id", nombre)); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); response.Name = api_response.GetNamedString("Name"); response.Title = api_response.GetNamedString("Title"); response.ImageURL = api_response.GetNamedString("Image"); response.Status = api_response.GetNamedString("Status"); response.linkedAccountFields = new List <LinkedAccountField>(); JsonArray campos = api_response.GetNamedArray("Data"); foreach (JsonValue campo in campos) { JsonObject campo_obj = campo.GetObject(); LinkedAccountField linkedAccountField = new LinkedAccountField(); linkedAccountField.Nombre = campo_obj.GetNamedString("nombre"); linkedAccountField.Titulo = campo_obj.GetNamedString("titulo"); linkedAccountField.Valor = campo_obj.GetNamedString("valor"); linkedAccountField.Tipo = campo_obj.GetNamedString("tipo"); response.linkedAccountFields.Add(linkedAccountField); } } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(response); }
private void txtCarritoCant_PreviewKeyUp(object sender, KeyRoutedEventArgs e) { double cant = 0; TextBox txtCant = (TextBox)sender; CloureManager.NumberInput(txtCant); double.TryParse(txtCant.Text, out cant); CartItem cartItem = (CartItem)((FrameworkElement)e.OriginalSource).DataContext; double importe = cartItem.Importe * cant; cartItem.Cantidad = cant; cartItem.Total = importe; calcular_total(); }
private async void save() { Property property = new Property(); property.TipoId = (int)txtPropertyType.SelectedValue; property.OperacionId = (int)txtOperation.SelectedValue; property.Titulo = txtTitulo.Text; bool result = await Properties.save(property); if (result) { CloureManager.GoBack("load"); } }
private async void save() { FinanceMovement finance = new FinanceMovement(); finance.FechaStr = DateTime.Now.ToString("yyyy-MM-dd"); finance.FormaDePagoId = (int)cboPaymentMethod.SelectedValue; finance.TipoMovimientoId = (string)cboOperation.SelectedValue; finance.Detalles = txtDescription.Text; finance.ImporteStr = txtAmount.Text; if (await new Finances().save(finance)) { CloureManager.GoBack("reload"); } }