Ejemplo n.º 1
0
        public void setHoanHanh(ChiTietKH ct, bool value)
        {
            KeHoachDB db = new KeHoachDB();

            db.setHoanThanh(ct, value);
            db.setSoLuongCongViecHoanThanh(ct.MaKH);
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(string id)
        {
            ChiTietKH chiTietKH = db.ChiTietKH.Find(id);

            db.ChiTietKH.Remove(chiTietKH);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void Delete(int maKH, int maLoai)
 {
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         ChiTietKH ct = db.ChiTietKH.Where(c => c.MaKH == maKH && c.MaLoai == maLoai).SingleOrDefault();
         db.ChiTietKH.Remove(ct);
         db.SaveChanges();
     }
 }
Ejemplo n.º 4
0
        public void setHoanThanh(ChiTietKH ct, bool value)
        {
            using (QLNTEntities1 db = new QLNTEntities1())
            {
                int ma = ct.MaKH;

                ChiTietKH temp = db.ChiTietKH.Where(c => c.MaLoai == ct.MaLoai && c.MaKH == ct.MaKH).SingleOrDefault();
                temp.HoanThanh = value;
                db.SaveChanges();
            }
        }
 public void Add(int maKH, int maLoai)
 {
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         ChiTietKH c = new ChiTietKH();
         c.MaKH      = maKH;
         c.MaLoai    = maLoai;
         c.HoanThanh = false;
         db.ChiTietKH.Add(c);
         db.SaveChanges();
     }
 }
Ejemplo n.º 6
0
        // GET: ChiTietKHs/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChiTietKH chiTietKH = db.ChiTietKH.Find(id);

            if (chiTietKH == null)
            {
                return(HttpNotFound());
            }
            return(View(chiTietKH));
        }
Ejemplo n.º 7
0
        // GET: ChiTietKHs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChiTietKH chiTietKH = db.ChiTietKH.Find(id);

            if (chiTietKH == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MaKH = new SelectList(db.KhachHang, "MaKH", "TenKH", chiTietKH.MaKH);
            return(View(chiTietKH));
        }
        public void Add(List <int> loai, int idKH)
        {
            QLNTEntities1    db = new QLNTEntities1();
            List <ChiTietKH> l  = new List <ChiTietKH>();

            foreach (int i in loai)
            {
                ChiTietKH temp = new ChiTietKH();
                temp.MaKH      = idKH;
                temp.MaLoai    = i;
                temp.HoanThanh = false;
                db.ChiTietKH.Add(temp);
            }
            db.SaveChanges();


            //l.Add(temp);
        }
Ejemplo n.º 9
0
 public ActionResult Edit([Bind(Include = "MaKHCT,MaKH,SoHangDaMua,TongTien,DiaChiThuongDung")] ChiTietKH chiTietKH)
 {
     if (ModelState.IsValid)
     {
         if (Common.MaNV != "")
         {
         }
         else
         {
             Common.Alert = "Đăng nhập trước khi chỉnh sữa !";
             return(RedirectToAction("Index", "Logins"));
         }
         db.Entry(chiTietKH).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaKH = new SelectList(db.KhachHang, "MaKH", "TenKH", chiTietKH.MaKH);
     return(View(chiTietKH));
 }
Ejemplo n.º 10
0
        private void dataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string maLoai;

            if (dataGrid.Columns[e.ColumnIndex].Name == "HoanThanh")
            {
                maLoai = dataGrid.Rows[e.RowIndex].Cells["MaLoai"].Value.ToString();
                bool v = Convert.ToBoolean(dataGrid.Rows[e.RowIndex].Cells["HoanThanh"].Value.ToString());

                ChiTietKH c = new ChiTietKH();
                c.MaKH   = k.MaKeHoach;
                c.MaLoai = Convert.ToInt32(maLoai);
                if (v == true)
                {
                    bus.setHoanHanh(c, false);
                }
                else
                {
                    bus.setHoanHanh(c, true);
                }
                View(k.MaKeHoach.ToString());
            }
            if (dataGrid.Columns[e.ColumnIndex].Name == "Xoa")
            {
                ///không cho xóa
                if (dataGrid.RowCount == 1)
                {
                    MessageBox.Show("Ít nhất phải có 1 công việc", "Không được xóa");
                }
                else
                {
                    maLoai = dataGrid.Rows[e.RowIndex].Cells["MaLoai"].Value.ToString();
                    bus.DeleteCtKH(k.MaKeHoach, Convert.ToInt32(maLoai));
                    View(k.MaKeHoach.ToString());
                }
            }
        }