Exemple #1
0
        private void butsua_Click(object sender, EventArgs e)
        {
            if (cbxma.Text == "" || cbxten.Text == "")
            {
                MessageBox.Show("Chưa nhập đủ thông tin!");
                return;
            }
            phancong c = new phancong();

            c.magv    = cbxma.Text;
            c.tengv   = cbxten.Text;
            c.tungay  = datetn.Value;
            c.denngay = datedn.Value;
            c.congtac = txtct.Text;
            c.ghichu  = txtghichu.Text;
            if (MessageBox.Show(string.Format("Bạn có muốn sửa lịch công tác  mmới không?"),
                                "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (Bus.UpdateProfile(c) > 0)
                {
                    MessageBox.Show("sửa thành công!");
                    phanconggiangday_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("bị Lỗi");
                }
            }
        }
Exemple #2
0
 internal static int DeleteProfile(phancong c)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", c.magv),
     };
     return(DataProvider.ExecuteNonQuery("xoaphancong", para));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            phancong phancong = db.phancongs.Find(id);

            db.phancongs.Remove(phancong);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "id,idnhanvien,idnhiemvu,iddoandulich")] phancong phancong)
 {
     if (ModelState.IsValid)
     {
         pcbus.db.Update(phancong);
         return(RedirectToAction("Index"));
     }
     ViewBag.iddoandulich = new SelectList(pcbus.db3.GetAll(), "id", "tendoan");
     ViewBag.idnhanvien   = new SelectList(pcbus.db2.GetAll(), "id", "tennhanvien");
     ViewBag.idnhiemvu    = new SelectList(pcbus.db1.GetAll(), "id", "tennhiemvu");
     return(View(phancong));
 }
Exemple #5
0
 public static int UpdateProfile(phancong c)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", c.magv),
         new SqlParameter("@ten", c.tengv),
         new SqlParameter("@tn", c.tungay),
         new SqlParameter("@dn", c.denngay),
         new SqlParameter("@ct", c.congtac)
     };
     return(DataProvider.ExecuteNonQuery("suaphancong", para));
 }
Exemple #6
0
 public static int InsertProfile(phancong c)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@ma", c.magv),
         new SqlParameter("@ten", c.tengv),
         new SqlParameter("@tn", c.tungay),
         new SqlParameter("@dn", c.denngay),
         new SqlParameter("@ct", c.congtac),
         new SqlParameter("@ghichu", c.ghichu)
     };
     return(DataProvider.ExecuteNonQuery("themphancong", para));
 }
 public ActionResult Edit([Bind(Include = "id,idnhanvien,idnhiemvu,iddoandulich")] phancong phancong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(phancong).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.iddoandulich = new SelectList(db.doanduliches, "id", "tendoan", phancong.iddoandulich);
     ViewBag.idnhanvien   = new SelectList(db.nhanviens, "id", "tennhanvien", phancong.idnhanvien);
     ViewBag.idnhiemvu    = new SelectList(db.nhiemvus, "id", "tennhiemvu", phancong.idnhiemvu);
     return(View(phancong));
 }
Exemple #8
0
        // GET: phancongs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            phancong phancong = pcbus.db.First(c => c.id == id);

            if (phancong == null)
            {
                return(HttpNotFound());
            }
            return(View(phancong));
        }
        // GET: phancongs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            phancong phancong = db.phancongs.Find(id);

            if (phancong == null)
            {
                return(HttpNotFound());
            }
            return(View(phancong));
        }
Exemple #10
0
        // GET: phancongs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            phancong phancong = pcbus.db.First(c => c.id == id);

            if (phancong == null)
            {
                return(HttpNotFound());
            }
            ViewBag.iddoandulich = new SelectList(pcbus.db3.GetAll(), "id", "tendoan");
            ViewBag.idnhanvien   = new SelectList(pcbus.db2.GetAll(), "id", "tennhanvien");
            ViewBag.idnhiemvu    = new SelectList(pcbus.db1.GetAll(), "id", "tennhiemvu");
            return(View(phancong));
        }
        // GET: phancongs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            phancong phancong = db.phancongs.Find(id);

            if (phancong == null)
            {
                return(HttpNotFound());
            }
            ViewBag.iddoandulich = new SelectList(db.doanduliches, "id", "tendoan", phancong.iddoandulich);
            ViewBag.idnhanvien   = new SelectList(db.nhanviens, "id", "tennhanvien", phancong.idnhanvien);
            ViewBag.idnhiemvu    = new SelectList(db.nhiemvus, "id", "tennhiemvu", phancong.idnhiemvu);
            return(View(phancong));
        }
Exemple #12
0
 public static int DeleteProfile(phancong c)
 {
     return(Dao.DeleteProfile(c));
 }
Exemple #13
0
 public static int UpdateProfile(phancong c)
 {
     return(Dao.UpdateProfile(c));
 }
Exemple #14
0
 public static int InsertProfile(phancong c)
 {
     return(Dao.InsertProfile(c));
 }