public Dog(int nweigth, typeDog ntype, DateTime ndateint, DateTime ndateout, bool nisinject, int nfood) { this.Weight = nweigth; this.TypeDog = ntype; this.DateIn = ndateint; this.DateOut = ndateout; this.IsInject = nisinject; this.FoodMoney1 = nfood; }
private void btnAdd_Click(object sender, EventArgs e) { bool isInject = false; if (rdbtnYes.Checked) { isInject = true; } int wei = (int)nmrudweigth.Value; int timeDetroy = (int)nmrudDayDetroy.Value; DateTime dateIn = dtpkIn.Value; DateTime dateOut = dtpkOut.Value; typeDog ntype = typeDog.type2; if (rdbtnType1.Checked) { ntype = typeDog.type1; } else if (rdbtnType3.Checked) { ntype = typeDog.type3; } Dog d = new Dog(wei, ntype, dateIn, dateOut, isInject, foodMoney); d.IdDog = int.Parse(_idDog); if (MessageBox.Show("Bạn có chắc muốn chỉnh sửa thông tin chó này ?", "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (DogConnection.Inst.eDitDog(d)) { MessageBox.Show("Sửa thông tin chó thành công !"); this.Close(); } else { MessageBox.Show("Sửa thông tin chó thất bại, vui lòng kiểm tra đường truyền !"); } } }
private void btnAdd_Click(object sender, EventArgs e) { bool isInject = false; if (rdbtnYes.Checked) { isInject = true; } int wei = (int)nmrudweigth.Value; int timeDetroy = (int)nmrudDayDetroy.Value; DateTime dateIn = dtpkIn.Value; DateTime dateOut = dtpkOut.Value; typeDog ntype = typeDog.type2; if (rdbtnType1.Checked) { ntype = typeDog.type1; } else if (rdbtnType3.Checked) { ntype = typeDog.type3; } Dog d = new Dog(wei, ntype, dateIn, dateOut, isInject, foodMoney); if (DogConnection.Inst.addDog(d)) { MessageBox.Show("Thêm chó thành công !"); btnClearALL_Click(sender, e); foodMoney = 0; } else { MessageBox.Show("Thêm chó thất bại !"); } }