Ejemplo n.º 1
0
        protected void lbDeleteSelected_Click(object sender, EventArgs e)
        {
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                var currency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);

                if (!_inverseSelection)
                {
                    foreach (var id in _selectionFilter.Values)
                    {
                        if (currency != null && currency.CurrencyID != SQLDataHelper.GetInt(id))
                        {
                            CurrencyService.DeleteCurrency(SQLDataHelper.GetInt(id));
                        }
                    }
                }
                else
                {
                    var itemsIds = _paging.ItemsIds <int>("CurrencyID as ID");
                    foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
                    {
                        if (currency != null && currency.CurrencyID != id)
                        {
                            CurrencyService.DeleteCurrency(id);
                        }
                    }
                }
                CurrencyService.RefreshCurrency();
            }
        }
Ejemplo n.º 2
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCurrency")
     {
         var currency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);
         if (currency.CurrencyID != SQLDataHelper.GetInt(e.CommandArgument))
         {
             CurrencyService.DeleteCurrency(SQLDataHelper.GetInt(e.CommandArgument));
             CurrencyService.RefreshCurrency();
         }
     }
     if (e.CommandName == "AddCurrency")
     {
         GridViewRow footer = grid.FooterRow;
         float       temp;
         float.TryParse(((TextBox)footer.FindControl("txtNewCurrencyValue")).Text, out temp);
         if (
             temp == 0 || string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewName")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewCode")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewCurrencyISO3")).Text) ||
             string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewPriceFormat")).Text)
             )
         {
             grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc");
             return;
         }
         var cur = new Currency
         {
             Name         = ((TextBox)footer.FindControl("txtNewName")).Text,
             Symbol       = ((TextBox)footer.FindControl("txtNewCode")).Text,
             Value        = temp,
             Iso3         = ((TextBox)footer.FindControl("txtNewCurrencyISO3")).Text,
             IsCodeBefore = ((CheckBox)footer.FindControl("checkNewIsCodeBefore")).Checked,
             PriceFormat  = ((TextBox)footer.FindControl("txtNewPriceFormat")).Text
         };
         CurrencyService.InsertCurrency(cur);
         CurrencyService.RefreshCurrency();
         grid.ShowFooter = false;
     }
     if (e.CommandName == "CancelAdd")
     {
         grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc");
         grid.ShowFooter            = false;
     }
 }
Ejemplo n.º 3
0
        protected async Task Delete_Click(int InputId)
        {
            await CurrencyService.DeleteCurrency(InputId);

            NavigationManager.NavigateTo("/ins/Currency", true);
        }