private void BtnSave_Click(object sender, EventArgs e) { // 16 5 : สิทธิ์ใช้งานหน้าสมาชิก บันทึกข้อมูลสมาชิก int AuthorizeId = 16; if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false) { SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าสมาชิก", "ไม่มีสิทธิ์บันทึกข้อมูลสมาชิก"); return; } if (stCustomerTypeId == 0) { XtraMessageBox.Show("กรุณาระบุประเภทลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning); LkCustomerTypes.ShowPopup(); return; } if (LkCustomerGroup.EditValue == null) { XtraMessageBox.Show("กรุณาระบุกลุ่มลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning); LkCustomerGroup.ShowPopup(); return; } if (TxtCustomerName.Text.Trim() == string.Empty) { XtraMessageBox.Show("กรุณาระบุชื่อลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtCustomerName.Focus(); return; } sCustomerCode = TxtCustomerCode.Text; sCustomerName = TxtCustomerName.Text; if (SaveData() == true) { LoadCustomer(); GridViewCustomer.FocusedRowHandle = GridViewCustomer.LocateByValue("CustomerName", TxtCustomerName.Text); sCustomerId = Convert.ToInt32(GridViewCustomer.GetFocusedRowCellValue("CustomerId")); if (CheckCustomerPrice(sCustomerId)) { GetData(sCustomerId); } } }
private void BtnDelete_Click(object sender, EventArgs e) { int cid = Convert.ToInt32(GridViewCustomer.GetFocusedRowCellValue("CustomerId")); // 17 5 : สิทธิ์ใช้งานหน้าสมาชิก ลบข้อมูลสมาชิก int AuthorizeId = 17; if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false) { SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าสมาชิก", "ไม่มีสิทธิ์ลบข้อมูลสมาชิก"); return; } if (CheckData(cid) == true) { if (XtraMessageBox.Show("คุณยืนยันที่จะลบข้อมูล ใช่หรือไม่?", "ยืนยัน", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (DeleteData(cid)) { LoadCustomer(); } } } }