private async void NewSupplierBT_Click(object sender, RoutedEventArgs e) { if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); await Task.Delay(100); } //From grid animation if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); SuppSocialNameTX.Focus(); SaveBT.IsEnabled = true; } else if (SuppSocialNameTX.Text.Length == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } //Clear supplier values if (SuppSocialNameTX.Text.Length > 0) { ResetForm(); } }
//Open client form for edit private void Edit_Click(object sender, RoutedEventArgs e) { //Hide filter if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; var Client = NovaAPI.APIClient.clients.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set supplier information to controls ClientNameTX.Text = Client.name; ClientIDTX.Text = Client.documentid; ClientTypeCB.SelectedIndex = Convert.ToInt32(Client.type); ClientPhoneTX.Text = Client.phone; ClientCelphoneTX.Text = Client.celphone; ClientAddressTX.Text = Client.address; ClientMailTX.Text = Client.mail; ClientCreditCB.IsChecked = Client.cancredit == "0" ? false : true; //Set selected supplier id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol ClientNameTX.Focus(); SaveBT.IsEnabled = true; }
//Edit product button toggle private void Edit_Click(object sender, RoutedEventArgs e) { //Get button control Button Control = (Button)sender; if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } var ProductData = NovaAPI.APIProdructs.products.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set popup name PopUpProductName.Content = ProductData.name; PopUpProductValue.Content = string.Format("Precio venta general: {0:C0}", Convert.ToInt32(ProductData.sellprice)); //Set product information to controls ProductCodeTX.Text = ProductData.code; ProductNameTX.Text = ProductData.name; ProductCatCB.SelectedItem = NovaAPI.APICategory.category.Find(x => x.id == ProductData.category); ProductCostTX.Number = Convert.ToInt32(ProductData.costprice); ProductPriceTX.Number = Convert.ToInt32(ProductData.sellprice); ProductTypeCB.SelectedIndex = Convert.ToInt32(ProductData.unity_type); MinStockTX.Text = ProductData.minstock; MaxStockTX.Text = ProductData.maxstock; //Set taxes if (ProductData.iva == "0" && ProductData.iac == "0" && ProductData.iva5 == "0") { TaxNoneRB.IsChecked = true; } else { TaxIvaRB.IsChecked = ProductData.iva == "1" ? true : false; TaxIva5RB.IsChecked = ProductData.iva5 == "1" ? true : false; TaxIacRB.IsChecked = ProductData.iac == "1" ? true : false; } //Set selected product id index for edition save ProductSelectIndex = Control.Tag.ToString(); //Focus editable product ProductCodeTX.Focus(); SaveProductBT.IsEnabled = true; PricesBT.IsEnabled = true; }
//Refresh products data private void RefreshProducts_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity == 1) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } if (FilterGrid.Opacity == 1) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } TotalPages = 0; Pagination = 1; ResetForm(); LoadProducts(); NewProductBT.Focus(); }
private async void FilterBT_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity != 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); await Task.Delay(100); } FilterTX.Clear(); if (FilterGrid.Opacity == 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); FilterTX.Focus(); } else { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } }
//Clear all form data and selections private void ClearFormData() { if (FormGrid.Opacity != 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } FilterTX.Clear(); ClientNameTX.Clear(); ClientIDTX.Clear(); ClientPhoneTX.Clear(); ClientAddressTX.Clear(); ClientMailTX.Clear(); ClientCelphoneTX.Clear(); ClientTypeCB.SelectedIndex = 0; ClientCreditCB.IsChecked = true; SaveBT.IsEnabled = false; }
private void Edit_Click(object sender, RoutedEventArgs e) { //Hide filter if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; var Supplier = NovaAPI.APISupplier.suppliers.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set supplier information to controls SuppSocialNameTX.Text = Supplier.socialname; SuppComercialNameTX.Text = Supplier.comercialname; SuppidTypeCB.SelectedIndex = Convert.ToInt32(Supplier.idtype); SuppIDTX.Text = Supplier.documentid; SuppAddressTX.Text = Supplier.address; SuppPhoneTX.Text = Supplier.phone; SuppCelphoneTX.Text = Supplier.celphone; SuppEmailTX.Text = Supplier.mail; SuppContactTX.Text = Supplier.contact; SuppObvsTX.Text = Supplier.observation; StatusCB.IsChecked = Supplier.status == "1" ? true : false; //Set selected supplier id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol SuppSocialNameTX.Focus(); SaveBT.IsEnabled = true; }