private void GridMooving_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { try { TextBox tb = e.EditingElement as TextBox; TextHandler.DotReplace(tb); float temp = float.Parse(tb.Text); int index = gridMooving.SelectedIndex; switch (e.Column.SortMemberPath) { case "GoodsQuantity": { MoovingGoodsToSale gridRow = gridMooving.SelectedItem as MoovingGoodsToSale; string goodsName = gridRow.GoodsName; string warehouseName = gridRow.WarehouseSourse; string command = "SELECT [GoodsInWarehouses].[GoodsBalance] FROM [GoodsInWarehouses] " + "INNER JOIN [Warehouses] " + "ON [GoodsInWarehouses].[WarehouseName] = [Warehouses].[WarehouseID] " + "INNER JOIN [Goods] " + "ON [GoodsInWarehouses].[GoodsName] = [Goods].[GoodsID] " + "WHERE [Goods].[GoodsName] = '" + goodsName + "' " + "AND [Warehouses].[WarehouseName] = '" + warehouseName + "'"; float goodsQuantity = float.Parse(new DataBaseReader(this.sqlConnect).GetString(command)); moovingList[index].GoodsQuantity = goodsQuantity >= temp?temp.ToString() : goodsQuantity.ToString(); } break; case "GoodsPrice": moovingList[index].GoodsPrice = StringTransformer.TransformDecimal(temp.ToString()); break; } } catch { ErrorMessages.UncorrectData(); } finally { UpdateGridMooving(ListAction.EditList); } }
private void TbGoodsPrice_TextChanged(object sender, TextChangedEventArgs e) { TextHandler.DotReplace(tbGoodsPrice); }