public ushort Pop() { ushort result = MemController.ReadUshort(SP); SP += 2; return(result); }
private void dataMem_CellEndEdit_1(object sender, DataGridViewCellEventArgs e) { Member mem = new Member(); try { mem.memcode = this.dataMem.CurrentRow.Cells[0].Value.ToString(); } catch { MessageBox.Show("Phải nhập Memcode"); dataMem.CurrentRow.Cells[0].Value = ""; dataMem.Rows.RemoveAt(dataMem.Rows.Count - 2); return; } if (mem.memcode.Length <= 0) { return; } if (this.dataMem.CurrentRow.Cells[1].Value is null) { this.dataMem.CurrentRow.Cells[1].Value = ""; } mem.memname = this.dataMem.CurrentRow.Cells[1].Value.ToString(); if (this.dataMem.CurrentRow.Cells[2].Value is null) { this.dataMem.CurrentRow.Cells[2].Value = ""; } mem.gender = this.dataMem.CurrentRow.Cells[2].Value.ToString(); if (this.dataMem.CurrentRow.Cells[3].Value is null) { this.dataMem.CurrentRow.Cells[3].Value = "1/1/1989"; } mem.birthday = DateTime.Parse(this.dataMem.CurrentRow.Cells[3].Value.ToString()).Date; if (this.dataMem.CurrentRow.Cells[4].Value is null) { this.dataMem.CurrentRow.Cells[4].Value = ""; } mem.address = this.dataMem.CurrentRow.Cells[4].Value.ToString(); if (this.dataMem.CurrentRow.Cells[5].Value is null) { this.dataMem.CurrentRow.Cells[5].Value = ""; } mem.phonenum = this.dataMem.CurrentRow.Cells[5].Value.ToString(); if (this.dataMem.CurrentRow.Cells[6].Value is null) { this.dataMem.CurrentRow.Cells[6].Value = ""; } mem.email = this.dataMem.CurrentRow.Cells[6].Value.ToString(); //update to database MemController.UpdateMem(mem); BindingSource source = new BindingSource(); source.DataSource = MemController.getlistMems(); //dataUsers.DataSource = source; }
private void btnDeleteMem_Click(object sender, EventArgs e) { Member mem = MemController.getMem(this.dataMem.SelectedRows[0].Cells[0].Value.ToString()); MemController.DeleteMem(mem); BindingSource source = new BindingSource(); source.DataSource = MemController.getlistMems(); dataMem.DataSource = source; }
private void FetchInstruction() { byte code = MemController.Read(PC++); Console.WriteLine("Trying to read code: {0:x2}", code); OpCode opcode = code == OpCodes.ExtendedTableOpCode ? OpCodes.PrefixedOpCodes[PC++] : OpCodes.SingleByteOpCodes[code]; _nextInstruction.Set(opcode); }
private void btnAddMem_Click(object sender, EventArgs e) { Member mem = new Member(); mem.memcode = this.txtMemCode.Text.Trim(); mem.memname = this.txtMemName.Text.Trim(); try { mem.gender = cbbGender.SelectedItem.ToString(); } catch { mem.gender = ""; } mem.birthday = this.dtpBirthday.Value; mem.address = this.txtAddress.Text.Trim(); mem.phonenum = this.txtPhoneNum.Text.Trim(); mem.email = this.txtEmail.Text.Trim(); if (listMem.Where(x => x.memcode == mem.memcode).Count() > 0) { MessageBox.Show("MemCode đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } listMem.Add(mem); MemController.AddMem(mem); BindingSource source = new BindingSource(); source.DataSource = MemController.getlistMems(); this.dataMem.DataSource = source; this.txtMemCode.Clear(); this.txtMemName.Clear(); this.txtPhoneNum.Clear(); this.txtEmail.Clear(); this.txtAddress.Clear(); this.cbbGender.SelectedIndex = -1; this.dtpBirthday.Value = DateTime.Now; //add users to database /*if (MemController.AddMem(mem) == false) * { * MessageBox.Show("Lỗi thêm member"); * return; * }*/ }
public FrmMember(ref List <Member> members) { InitializeComponent(); this.listMem = members; this.cMemCode.DataPropertyName = nameof(Member.memcode); this.cMemName.DataPropertyName = nameof(Member.memname); this.cGender.DataPropertyName = nameof(Member.gender); this.cBirthday.DataPropertyName = nameof(Member.birthday); this.cPhoneNum.DataPropertyName = nameof(Member.phonenum); this.cEmail.DataPropertyName = nameof(Member.email); this.cAddress.DataPropertyName = nameof(Member.address); this.cWorks.DataPropertyName = nameof(Member.Works); BindingSource source = new BindingSource(); source.DataSource = MemController.getlistMems(); this.dataMem.DataSource = source; }
private void txtSearchMem_TextChanged(object sender, EventArgs e) { this.lstSearchMem.Items.Clear(); List <Member> searchMems = MemController.getListMems(this.txtSearchMem.Text.Trim()); if (searchMems.Count > 0) { this.lstSearchMem.Visible = true; } else { this.lstSearchMem.Visible = false; } for (int i = 0; i < searchMems.Count; i++) { this.lstSearchMem.Items.Add(searchMems[i]); } }
public ushort ReadOperand16() { operandBuffer[0] = MemController.Read(PC++); operandBuffer[1] = MemController.Read(PC++); return(BitConverter.ToUInt16(operandBuffer, 0)); }
public byte ReadOperand8() { operandBuffer[0] = MemController.Read(PC++); return(operandBuffer[0]); }
public void Push(ushort value) { SP -= 2; MemController.Write(SP, value); }