protected void lvRateExchange_ItemDeleting(object sender, ListViewDeleteEventArgs e) { String ids = ""; Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label; if (lbl != null) ids = lbl.Text; if (!String.IsNullOrEmpty(ids)) { StoreProRepository storeFacade = new StoreProRepository(); ExchangeRatesRepository facade = new ExchangeRatesRepository(); var itm = facade.GetById(Int16.Parse(ids)); if (itm != null) { storeFacade.StoreProcessor().B_ExchangeRate_history_process(itm.Currency, itm.Rate, this.UserId, 3); facade.Delete(itm); facade.Commit(); LoadDataTolvRateExchange(); } } }
protected void lvRateExchange_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ExchangeRatesRepository facade = new ExchangeRatesRepository(); StoreProRepository storeFacade = new StoreProRepository(); TextBox tbcurrency = (lvRateExchange.EditItem.FindControl("tbCurrency")) as TextBox; RadNumericTextBox rnbVNDRate = (lvRateExchange.EditItem.FindControl("rnbVNDRate")) as RadNumericTextBox; Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label; String ids = ""; if (lbl != null) ids = lbl.Text; B_ExchangeRates exchangeRate = new B_ExchangeRates(); exchangeRate.Rate = (decimal)rnbVNDRate.Value; exchangeRate.Currency = tbcurrency.Text; exchangeRate.Id = Int32.Parse(ids); B_ExchangeRates exits = facade.GetById(exchangeRate.Id); if (exits != null) { storeFacade.StoreProcessor().B_ExchangeRate_history_process(exchangeRate.Currency, exchangeRate.Rate, this.UserId, 2); facade.Update(facade.GetById(exchangeRate.Id), exchangeRate); facade.Commit(); } lvRateExchange.EditIndex = -1; LoadDataTolvRateExchange(); }