public static void SuaNCC(CNhaCC ncc) { try { NhaCungCap dao = new NhaCungCap(); dao.SuaNCC(ncc); } catch (SqlException ex) { throw ex; } }
private void xlThem() { CNhaCC ncc = new CNhaCC(txtMa.Text, txtTen.Text, leKhuVuc.EditValue.ToString(), txtDiaChi.Text, txtMaSoThue.Text, txtDienThoai.Text, txtFax.Text, txtEmail.Text, txtMobile.Text, txtWebsite.Text, txtNguoiLienHe.Text, txtNickSkype.Text, txtTaiKhoan.Text, txtNganHang.Text, (calcGioiHanNo.Text == "" ? 0 : float.Parse(calcGioiHanNo.Value.ToString())), (calcChietKhau.Text == "" ? 0 : float.Parse(calcChietKhau.Value.ToString())), checkConQL.Checked); BUS_NhaCungCap.ThemNCC(ncc); sendNCC?.Invoke(); Action.Module = "Nhà Cung Cấp"; Action.ActionName = "Thêm"; Action.Reference = txtMa.Text; Action.LuuThongTin(); this.Close(); }
private void BtnSua_ItemClick(object sender, ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; CNhaCC ncc = new CNhaCC { MaNCC = gvMain.GetRowCellValue(rowIndex, "Customer_ID").ToString(), TenNCC = gvMain.GetRowCellValue(rowIndex, "CustomerName").ToString(), KhuVuc = gvMain.GetRowCellValue(rowIndex, "Customer_Group_ID").ToString(), LienHe = gvMain.GetRowCellValue(rowIndex, "Contact").ToString(), ChucVu = gvMain.GetRowCellValue(rowIndex, "Position").ToString(), DiaChi = gvMain.GetRowCellValue(rowIndex, "CustomerAddress").ToString(), DienThoai = gvMain.GetRowCellValue(rowIndex, "Tel").ToString(), DiDong = gvMain.GetRowCellValue(rowIndex, "Mobile").ToString(), Fax = gvMain.GetRowCellValue(rowIndex, "Fax").ToString(), ConQL = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString()) }; fThemNCC sua = new fThemNCC(false, ncc, LoadData); sua.ShowDialog(); }
public fThemNCC(bool isAdd = true, CNhaCC ncc = null, fNhaCC.sendMessage send = null) { InitializeComponent(); if (isAdd == false && ncc == 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_NhaCungCap.LayNhaCC(); Text = "Thêm nhà cung cấp"; } else { editNCC = ncc; Text = "Sửa thông tin nhà cung cấp"; } add = isAdd; sendNCC = send; Init(); }
public void ThemNCC(CNhaCC ncc) { Provider dao = new Provider(); try { dao.Connect(); string sql = "PROVIDER_Insert"; CommandType type = CommandType.StoredProcedure; dao.ExeCuteNonQuery(type, sql, new SqlParameter { ParameterName = "@Customer_ID", Value = ncc.MaNCC }, new SqlParameter { ParameterName = "@CustomerName", Value = ncc.TenNCC }, new SqlParameter { ParameterName = "@Customer_Type_ID", Value = 0 }, new SqlParameter { ParameterName = "@CustomerAddress", Value = ncc.DiaChi }, new SqlParameter { ParameterName = "@Tax", Value = ncc.MaSoThue }, new SqlParameter { ParameterName = "@Tel", Value = ncc.DienThoai }, new SqlParameter { ParameterName = "@Fax", Value = ncc.Fax }, new SqlParameter { ParameterName = "@Email", Value = ncc.Email }, new SqlParameter { ParameterName = "@Mobile", Value = ncc.DiDong }, new SqlParameter { ParameterName = "@Website", Value = ncc.Website }, new SqlParameter { ParameterName = "@Contact", Value = ncc.LienHe }, new SqlParameter { ParameterName = "@NickYM", Value = "" }, new SqlParameter { ParameterName = "@NickSky", Value = "" }, new SqlParameter { ParameterName = "@BankAccount", Value = ncc.TaiKhoan }, new SqlParameter { ParameterName = "@BankName", Value = ncc.NganHang }, new SqlParameter { ParameterName = "@CreditLimit", Value = ncc.GioiHanNo }, new SqlParameter { ParameterName = "@Discount", Value = ncc.ChietKhau }, new SqlParameter { ParameterName = "@Customer_Group_ID", Value = ncc.KhuVuc }, new SqlParameter { ParameterName = "@Active", Value = ncc.ConQL }, new SqlParameter { ParameterName = "@OrderID", Value = 0 }, new SqlParameter { ParameterName = "@Birthday", Value = "" }, new SqlParameter { ParameterName = "@Barcode", Value = ncc.MaNCC }, new SqlParameter { ParameterName = "@Position", Value = "" }, new SqlParameter { ParameterName = "@Area", Value = "" }, new SqlParameter { ParameterName = "@District", Value = "" }, new SqlParameter { ParameterName = "@Contry", Value = "" }, new SqlParameter { ParameterName = "@City", Value = "" }, new SqlParameter { ParameterName = "@Description", Value = "" }); } catch (SqlException ex) { throw ex; } finally { dao.DisConnect(); } }