public void SuaTienTe(CTyGia tien) { Provider dao = new Provider(); try { dao.Connect(); string sql = "CURRENCY_Update"; CommandType type = CommandType.StoredProcedure; dao.ExeCuteNonQuery(type, sql, new SqlParameter { ParameterName = "@Currency_ID", Value = tien.MaTienTe }, new SqlParameter { ParameterName = "@CurrencyName", Value = tien.TenTienTe }, new SqlParameter { ParameterName = "@Exchange", Value = tien.TyGia }, new SqlParameter { ParameterName = "@Active", Value = tien.ConQL }); } catch (SqlException ex) { throw ex; } finally { dao.DisConnect(); } }
public static void SuaTienTe(CTyGia tg) { try { TienTe dao = new TienTe(); dao.SuaTienTe(tg); } catch (SqlException ex) { throw ex; } }
private void xlThem() { CTyGia tg = new CTyGia(txtMa.Text, txtTen.Text, float.Parse(calcTyGia.Value.ToString()), ceConQL.Checked); BUS_TienTe.ThemTienTe(tg); sendTG(); Action.Module = "Tỷ Giá"; Action.ActionName = "Thêm"; Action.Reference = txtMa.Text; Action.LuuThongTin(); this.Close(); }
private void BtnSua_ItemClick(object sender, ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; CTyGia tg = new CTyGia { MaTienTe = gvMain.GetRowCellValue(rowIndex, "Currency_ID").ToString(), TenTienTe = gvMain.GetRowCellValue(rowIndex, "CurrencyName").ToString(), TyGia = float.Parse(gvMain.GetRowCellValue(rowIndex, "Exchange").ToString()), ConQL = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString()) }; fThemTyGia sua = new fThemTyGia(false, tg, LoadData); sua.ShowDialog(); }
public fThemTyGia(bool isAdd = true, CTyGia tien = null, fTiGia.sendMessage send = null) { InitializeComponent(); if (isAdd == false && tien == null) { XtraMessageBox.Show("ERROR : Dữ liệu không được cung cấp để thực hiện hành động !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } if (isAdd == true) { Text = "Thêm tiền tệ"; } else { editTyGia = tien; Text = "Sửa thông tin tiền tệ"; } add = isAdd; sendTG = send; Init(); }