private void xlThem() { CKho kho = new CKho (txtMa.Text, txtTen.Text, txtLienHe.Text, txtDiaChi.Text, txtEmail.Text, txtDienThoai.Text, txtFax.Text, "", leNguoiQL.EditValue.ToString(), txtDienGiai.Text, checkConQL.Checked); BUS_KhoXuat.ThemKho(kho); sendKho?.Invoke(); Action.Module = "Kho Hàng"; Action.ActionName = "Thêm"; Action.Reference = txtMa.Text; Action.LuuThongTin(); this.Close(); }
public void ThemKho(CKho kho) { Provider dao = new Provider(); try { dao.Connect(); string sql = "STOCK_Insert"; CommandType type = CommandType.StoredProcedure; dao.ExeCuteNonQuery(type, sql, new SqlParameter { ParameterName = "@Stock_ID", Value = kho.MaKho }, new SqlParameter { ParameterName = "@Stock_Name", Value = kho.TenKho }, new SqlParameter { ParameterName = "@Contact", Value = kho.LienHe }, new SqlParameter { ParameterName = "@Address", Value = kho.DiaChi }, new SqlParameter { ParameterName = "@Email", Value = kho.Email }, new SqlParameter { ParameterName = "@Telephone", Value = kho.DienThoai }, new SqlParameter { ParameterName = "@Fax", Value = kho.Fax }, new SqlParameter { ParameterName = "@Mobi", Value = kho.DiDong }, new SqlParameter { ParameterName = "@Manager", Value = kho.NguoiQuanLy }, new SqlParameter { ParameterName = "@Description", Value = kho.DienGiai }, new SqlParameter { ParameterName = "@Active", Value = kho.ConQL }); } catch (SqlException ex) { throw ex; } finally { dao.DisConnect(); } }
public static void SuaKho(CKho kho) { try { Kho dao = new Kho(); dao.SuaKho(kho); } catch (SqlException ex) { throw ex; } }
private void BtnSua_ItemClick(object sender, ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; CKho kho = new CKho { MaKho = gvMain.GetRowCellValue(rowIndex, "Stock_ID").ToString(), TenKho = gvMain.GetRowCellValue(rowIndex, "Stock_Name").ToString(), LienHe = gvMain.GetRowCellValue(rowIndex, "Contact").ToString(), DiaChi = gvMain.GetRowCellValue(rowIndex, "Address").ToString(), Email = "", DienThoai = gvMain.GetRowCellValue(rowIndex, "Telephone").ToString(), Fax = "", DiDong = "", NguoiQuanLy = gvMain.GetRowCellValue(rowIndex, "Manager").ToString(), DienGiai = gvMain.GetRowCellValue(rowIndex, "Description").ToString(), ConQL = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString()) }; fThemKho sua = new fThemKho(false, kho, LoadData); sua.ShowDialog(); }
public fThemKho(bool isAdd = true, CKho kho = null, fKhoHang.sendMessage send = null) { InitializeComponent(); if (isAdd == false && kho == 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) { table = BUS_KhoXuat.LayKho(); Text = "Thêm nhà cung cấp"; } else { editKho = kho; Text = "Sửa thông tin nhà cung cấp"; } add = isAdd; sendKho = send; Init(); }