Ejemplo n.º 1
0
        //xóa khách hàng
        public void xoaPhieuBaoHanh(string mabh)
        {
            BAOHANH bh = qlch.BAOHANHs.Where(d => d.MABAOHANH == mabh).FirstOrDefault();

            qlch.BAOHANHs.DeleteOnSubmit(bh);
            qlch.SubmitChanges();
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(short id)
        {
            BAOHANH bAOHANH = db.BAOHANHs.Find(id);

            db.BAOHANHs.Remove(bAOHANH);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "BH_ID,BH_TEN,BH_MOTA")] BAOHANH bAOHANH)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bAOHANH).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bAOHANH));
 }
Ejemplo n.º 4
0
        public void SuaPhieuBaoHanh(string mabh, string yeucau, DateTime ngaytra, string tinhtrang)
        {
            BAOHANH bh = qlch.BAOHANHs.Where(d => d.MABAOHANH == mabh).FirstOrDefault();

            bh.MABAOHANH     = mabh;
            bh.YEUCAUBAOHANH = yeucau;
            bh.NGAYTRA       = ngaytra;
            bh.TINHTRANG     = tinhtrang;
            qlch.SubmitChanges();
        }
Ejemplo n.º 5
0
        // GET: BAOHANHs/Edit/5
        public ActionResult Edit(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BAOHANH bAOHANH = db.BAOHANHs.Find(id);

            if (bAOHANH == null)
            {
                return(HttpNotFound());
            }
            return(View(bAOHANH));
        }
Ejemplo n.º 6
0
        public void TaoPhieuBaoHanh(string mabh, string makh, string maps, string manv, string yeucau,
                                    DateTime ngaynhan, DateTime ngaytra, string tinhtrang)
        {
            BAOHANH bh = new BAOHANH();

            bh.MABAOHANH     = mabh;
            bh.MAKHACHHANG   = makh;
            bh.MASP          = maps;
            bh.MANV          = manv;
            bh.YEUCAUBAOHANH = yeucau;
            bh.NGAYNHAN      = ngaynhan;
            bh.NGAYTRA       = ngaytra;
            bh.TINHTRANG     = tinhtrang;

            qlch.BAOHANHs.InsertOnSubmit(bh);
            qlch.SubmitChanges();
        }
Ejemplo n.º 7
0
 private void MatHang1_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'qLCHDienThoaiDDDataSet17.KHUYENMAI' table. You can move, or remove it, as needed.
     //this.kHUYENMAITableAdapter.Fill(this.qLCHDienThoaiDDDataSet17.KHUYENMAI);
     txtMamh.Text      = MAMH;
     txttenmh.Text     = TENMH;
     txthangsx.Text    = HANGSX;
     txtgiaban.Text    = GIABAN;
     txtgiamua.Text    = GIAMUA;
     txtbaohanh.Text   = BAOHANH.ToString();
     luekhuyenmai.Text = KHUYENMAI;
     cbbDVT.Text       = DONVITINH;
     txtSoluong.Text   = SOLUONG;
     txtDacDiem.Text   = DACDIEM;
     txtGhiChu.Text    = GHICHU;
     picHINH.Image     = HINH;
     cbbLoaiMH.Text    = LOAIMH;
 }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "BH_ID,BH_TEN,BH_MOTA")] BAOHANH bAOHANH)
        {
            string id = Request["BH_ID"];

            if (ModelState.IsValid)
            {
                bAOHANH.BH_ID = Convert.ToInt16(db.autottang("BaoHanh", "BH_ID", db.BAOHANHs.Count()));
                db.BAOHANHs.Add(bAOHANH);
                db.SaveChanges();
                ModelState.AddModelError("", "Đã thêm " + id);
            }
            else
            {
                ModelState.AddModelError("", "ID bị trùng " + id);
            }

            return(View(bAOHANH));
        }
Ejemplo n.º 9
0
        private void Save(string link = "")
        {
            int id = getIdnews();
            if (_idbaohanh != 0)
            {
                var list = db.BAOHANHs.Where(n => n.ID == _idbaohanh).ToList();
                if (list.Count > 0)
                {
                    
                    list[0].NEWS_ID = id;
                    list[0].USER_ID = Utils.CIntDef(Session["USER_ID"]);
                    //list[0].BH_DATENHAN = pickdatereciever.returnDate;
                    list[0].BH_DATETRA = pickdelivery.returnDate;
                    list[0].BH_SOPHIEU=txtsophieu.Value;
                    list[0].BH_NAMEKH = txtnamekhachhang.Value;
                    list[0].BH_ADDRESS = txtadd.Value;
                    list[0].BH_PHONE = txtphone.Value;
                    list[0].BH_EMAIL = txtemail.Value;
                    list[0].BH_SOHOADON = txtsohoadon.Value;
                    list[0].BH_SERI = txtseri.Value;
                    list[0].BH_TINHTRANGNHAN = txttinhtrang.Value;
                    list[0].BH_NOTENHANVIEN = txtnotenhanvien.Value;
                    list[0].BH_NOTE = txtnote.Value;
                    list[0].BH_STATUS = Utils.CIntDef(Rdstatus.SelectedValue);
                    db.SubmitChanges();

                }

            }
            else
            {
                if (id != 0)
                {
                    BAOHANH bh = new BAOHANH();
                    bh.NEWS_ID = id;
                    bh.USER_ID = Utils.CIntDef(Session["USER_ID"]);
                    bh.BH_DATENHAN = DateTime.Now;
                    bh.BH_DATETRA = pickdelivery.returnDate;
                    bh.BH_SOPHIEU = txtsophieu.Value;
                    bh.BH_NAMEKH = txtnamekhachhang.Value;
                    bh.BH_ADDRESS = txtadd.Value;
                    bh.BH_PHONE = txtphone.Value;
                    bh.BH_EMAIL = txtemail.Value;
                    bh.BH_SOHOADON = txtsohoadon.Value;
                    bh.BH_SERI = txtseri.Value;
                    bh.BH_TINHTRANGNHAN = txttinhtrang.Value;
                    bh.BH_NOTENHANVIEN = txtnotenhanvien.Value;
                    bh.BH_NOTE = txtnote.Value;
                    bh.BH_STATUS = Utils.CIntDef(Rdstatus.SelectedValue);
                    db.BAOHANHs.InsertOnSubmit(bh);
                    db.SubmitChanges();
                    var list = db.BAOHANHs.OrderByDescending(n => n.ID).ToList();
                    if (list.Count > 0)
                        _idbaohanh = list[0].ID;
                   
                }

            }

            if (String.IsNullOrEmpty(link)) link = "bao-hanh.aspx?id=" + _idbaohanh;
            if (!String.IsNullOrEmpty(link))
                Response.Redirect(link);
        }