Esempio n. 1
0
        public void TestLayChiTietCongNgheRam()
        {
            List <myChiTietCongNgheRamDTO> listChiTietCongNgheRAMDTO = MyChiTietCongNgheRamBUS.LayChiTietCongNgheRam();

            Assert.IsNotNull(listChiTietCongNgheRAMDTO);
            Assert.LessOrEqual(1, listChiTietCongNgheRAMDTO.Count);
        }
Esempio n. 2
0
        private void btn_Tech_Click(object sender, EventArgs e)
        {
            if (txt_CongNgheRAMNew.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Bạn phải thêm vào công nghệ RAM mới muốn thêm !", "Thông báo");
                txt_CongNgheRAMNew.Focus();
                return;
            }

            try
            {
                if (this.danhsachCongNgheRAM.Exists(cn => cn.STenCongNgheRam == txt_CongNgheRAMNew.Text.Trim()))
                {
                    MessageBox.Show("Công nghệ RAM muốn thêm đã tồn tại", "Thông báo");
                    return;
                }

                if (MessageBox.Show("Bạn có chắc chắn muốn thêm công nghệ RAM mới : " + txt_CongNgheRAMNew.Text.Trim() + " hay không ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    myChiTietCongNgheRamDTO congngheRAM = new myChiTietCongNgheRamDTO();
                    congngheRAM.STenCongNgheRam = txt_CongNgheRAMNew.Text.Trim();
                    congngheRAM.FHeSo           = (float)2.0;

                    if (MyChiTietCongNgheRamBUS.ThemCongNgheRAM(congngheRAM) == true)
                    {
                        MessageBox.Show("Thêm mới công nghệ RAM: " + txt_CongNgheRAMNew.Text.Trim() + " thành công !", "Thông báo");
                        this.LoadCNRAM();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thông báo");
            }
        }
Esempio n. 3
0
 void LoadCNRAM()
 {
     this.danhsachCongNgheRAM = MyChiTietCongNgheRamBUS.LayChiTietCongNgheRam();
     if (this.danhsachCongNgheRAM.Count > 0)
     {
         txt_CongNgheHienCo.Text = string.Empty;
         foreach (myChiTietCongNgheRamDTO cn in this.danhsachCongNgheRAM)
         {
             txt_CongNgheHienCo.Text += cn.STenCongNgheRam + ";  ";
         }
     }
 }
Esempio n. 4
0
        public void TestThemCongNgheRAM()
        {
            myChiTietCongNgheRamDTO chiTietCongNgheRAM = new myChiTietCongNgheRamDTO();

            chiTietCongNgheRAM.FHeSo           = (float)1.0;
            chiTietCongNgheRAM.STenCongNgheRam = "DDR8";

            Assert.AreEqual(true, MyChiTietCongNgheRamBUS.ThemCongNgheRAM(chiTietCongNgheRAM));

            DataClasses1DataContext m_eStoreDataContext = new DataClasses1DataContext();
            int maMax = m_eStoreDataContext.CHITIETCONGNGHERAMs.Max(it => it.MaChiTietCongNgheRAM);

            m_eStoreDataContext.CHITIETCONGNGHERAMs.DeleteOnSubmit(m_eStoreDataContext.CHITIETCONGNGHERAMs.Single(it => it.MaChiTietCongNgheRAM == maMax));
            m_eStoreDataContext.SubmitChanges();
        }