public ActionResult FormDeleteRam()
        {
            RamDAO dao = new RamDAO();

            var model = dao.getAllRam();

            if (model == null)
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            return(View(model));
        }
        public ActionResult AddRam(string ram)
        {
            RamDAO dao  = new RamDAO();
            User   user = Session["User"] as User;
            var    rs   = "";

            if (user == null || user.LEVEL.Equals("10") == false)
            {
                rs = "user";
            }
            else if (ram == null)
            {
                rs = "null";
            }
            else if (ToolsOfAdmin.checkNull(ram) == false)
            {
                rs = "null";
            }

            else if (ToolsOfAdmin.checkNum(ram) == false)
            {
                rs = "number";
            }
            else if (dao.checkExit(Convert.ToInt32(ram)) == true)
            {
                rs = "exit";
            }
            else if (Convert.ToInt32(ram) <= 0)
            {
                rs = "lower";
            }
            else
            {
                var check = dao.addRam(Convert.ToInt32(ram));
                if (check == false)
                {
                    rs = "fail";
                }
                else
                {
                    rs = "success";
                }
            }
            return(Json(new { result = rs }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        private void cbb_LinhKien_EditValueChanged(object sender, EventArgs e)
        {
            switch (cbb_LinhKien.Text.ToString())
            {
            case "RAM":
                gridControlResult.DataSource = null;
                gridViewResult.Columns.Clear();
                gridControlResult.DataSource = RamDAO.getListRamByLapTopId(this.currentTenLaptop);
                gridControlResult.RefreshDataSource();
                gridViewResult.Columns[0].Caption = "Tên RAM";
                gridViewResult.Columns[1].Caption = "Giá (VNĐ)";
                gridViewResult.Columns[2].Caption = "Hãng sản xuất";
                gridViewResult.Columns[3].Visible = false;
                gridViewResult.Columns[4].Visible = false;
                gridViewResult.Columns[5].Caption = "Dung lượng (GB)";
                gridViewResult.Columns[6].Visible = false;
                gridViewResult.Columns[7].Visible = false;
                gridViewResult.Columns[8].Visible = false;
                break;

            case "HARD DISK":
                gridControlResult.DataSource = null;
                gridViewResult.Columns.Clear();
                gridControlResult.DataSource = RamDAO.getListHDByLapTopId(this.currentTenLaptop);
                gridControlResult.RefreshDataSource();
                gridViewResult.Columns[0].Caption  = "Tên HARD DISK";
                gridViewResult.Columns[1].Visible  = false;
                gridViewResult.Columns[2].Caption  = "Giá (VNĐ)";
                gridViewResult.Columns[3].Caption  = "Hãng sản xuất";
                gridViewResult.Columns[4].Visible  = false;
                gridViewResult.Columns[5].Caption  = "Dung lượng (GB)";
                gridViewResult.Columns[6].Visible  = false;
                gridViewResult.Columns[7].Visible  = false;
                gridViewResult.Columns[8].Visible  = false;
                gridViewResult.Columns[9].Visible  = false;
                gridViewResult.Columns[10].Visible = false;
                gridViewResult.Columns[11].Visible = false;
                break;
            }
        }
Exemple #4
0
        public bool Insert(Ram newRam)
        {
            bool result = new RamDAO().Insert(newRam);

            return(result);
        }
Exemple #5
0
        public bool Update(Ram newRam)
        {
            bool result = new RamDAO().Update(newRam);

            return(result);
        }
Exemple #6
0
        public Ram GetDetails(int code)
        {
            Ram ram = new RamDAO().GetDetails(code);

            return(ram);
        }
Exemple #7
0
        public List <Ram> NameSearch(String nameSearch)
        {
            List <Ram> rams = new RamDAO().NameSearch(nameSearch);

            return(rams);
        }
Exemple #8
0
        public bool DeleteProd(int code)
        {
            bool result = new RamDAO().DeleteProd(code);

            return(result);
        }
Exemple #9
0
        public List <Ram> getAll()
        {
            List <Ram> rams = new RamDAO().SelectAll();

            return(rams);
        }