Exemple #1
0
        public bool ThemMoi(NghiepVu item)
        {
            NghiepVuDAL dal = new NghiepVuDAL(db);

            try
            {
                if (item != null)
                {
                    if (TimKiemTheoMa(item.MaNghiepVu) != item)
                    {
                        return(dal.ThemMoi(item));
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public JsonResult LoadData(string id)
        {
            var             danhSachNghiepVu = nghiepVuBll.LayTatCa().ToList();
            var             count            = danhSachNghiepVu.Count();
            List <NghiepVu> lst = new List <NghiepVu>();

            foreach (var item in danhSachNghiepVu)
            {
                NghiepVu nv = new NghiepVu
                {
                    MaNghiepVu  = item.MaNghiepVu,
                    TenNghiepVu = item.TenNghiepVu,
                    GhiChu      = item.GhiChu
                };
                lst.Add(nv);
            }
            var nhanVien = nhanVienBll.TimKiemTheoMa(id);

            return(Json(new
            {
                data = lst,
                tenNhanVien = nhanVien.TenNhanVien,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ActionResult UpdateNghiepVu()
        {
            ReflectionController rc = new ReflectionController();
            List <Type>          listControllerType = rc.GetControllers("QuanLyXe.Areas.Admin.Controllers");
            List <string>        listControllerOld  = db.NghiepVus.Select(c => c.MaNghiepVu).ToList();
            List <string>        listPermistionOld  = db.BlogPermissions.Select(p => p.PermisstionName).ToList();

            foreach (var c in listControllerType)
            {
                if (!listControllerOld.Contains(c.Name))
                {
                    NghiepVu nv = new NghiepVu()
                    {
                        MaNghiepVu = c.Name, TenNghiepVu = "Chưa có mô tả"
                    };
                    db.NghiepVus.Add(nv);
                }
                List <string> listPermisstion = rc.GetActions(c);
                foreach (var p in listPermisstion)
                {
                    if (!listPermistionOld.Contains(c.Name + "-" + p))
                    {
                        BlogPermission permission = new BlogPermission()
                        {
                            PermisstionName = c.Name + "-" + p, Description = "Chưa có mô tả", MaNghiepVu = c.Name
                        };
                        db.BlogPermissions.Add(permission);
                    }
                }
            }
            db.SaveChanges();
            TempData["err"] = "<div class='alert alert-info' role='alert'><span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span><span class='sr-only'></span>Cập Nhật</div>";
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult DeleteConfirmed(string id)
        {
            NghiepVu nghiepVu = db.NghiepVus.Find(id);

            db.NghiepVus.Remove(nghiepVu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "MaNghiepVu,TenNghiepVu")] NghiepVu nghiepVu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nghiepVu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nghiepVu));
 }
Exemple #6
0
        public ActionResult Create([Bind(Include = "MaNghiepVu,TenNghiepVu")] NghiepVu nghiepVu)
        {
            if (ModelState.IsValid)
            {
                db.NghiepVus.Add(nghiepVu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nghiepVu));
        }
Exemple #7
0
        // GET: Admin/NghiepVus/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NghiepVu nghiepVu = db.NghiepVus.Find(id);

            if (nghiepVu == null)
            {
                return(HttpNotFound());
            }
            return(View(nghiepVu));
        }
Exemple #8
0
        public static NghiepVu Find(ArrayList arrayList)
        {
            NghiepVu kq = null;

            Console.WriteLine("Nhập mã tính lương: ");
            string tk = Nhap.NhapString();

            foreach (NghiepVu ob in arrayList)
            {
                if (tk == ob.Mahd.ToString())
                {
                    kq = ob;
                }
            }
            return(kq);
        }
Exemple #9
0
        public JsonResult GetDetail(string id)
        {
            NghiepVu nghiepVu = bll.TimKiemTheoMa(id);

            NghiepVu nv = new NghiepVu()
            {
                MaNghiepVu  = nghiepVu.MaNghiepVu,
                TenNghiepVu = nghiepVu.TenNghiepVu,
                GhiChu      = nghiepVu.GhiChu
            };

            return(Json(new
            {
                data = nv,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #10
0
        public JsonResult CapNhatDanhSachNghiepVu()
        {
            ReflectionController rc = new ReflectionController();
            List <Type>          listControllerType = rc.GetControllers("ResWebsite.UI.Areas.Admin");
            List <string>        listControllerOld  = bll.LayTatCa().Select(c => c.MaNghiepVu).ToList();
            List <string>        listPermissionOld  = quyenHanBll.LayTatCa().Select(p => p.TenQuyenHan).ToList();

            foreach (var c in listControllerType)
            {
                if (!listControllerOld.Contains(c.Name))
                {
                    NghiepVu nv = new NghiepVu()
                    {
                        MaNghiepVu  = c.Name,
                        TenNghiepVu = "Chưa có mô tả",
                        GhiChu      = "Chưa có ghi chú",
                    };
                    bll.ThemMoi(nv);
                }
                List <string> listPermisson         = rc.GetActions(c);
                ScriptFunctionsDataContext function = new ScriptFunctionsDataContext();
                foreach (var p in listPermisson)
                {
                    if (!listPermissionOld.Contains(c.Name + "-" + p))
                    {
                        QuyenHan quyenHan = new QuyenHan
                        {
                            MaQuyenHan  = function.auto_maQH(),
                            TenQuyenHan = c.Name + "-" + p,
                            MoTa        = "Chưa có mô tả",
                            MaNghiepVu  = c.Name
                        };
                        quyenHanBll.ThemMoi(quyenHan);
                    }
                }
            }
            return(Json(
                       new
            {
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #11
0
        public static void Sua(ArrayList arrayList)
        {
            NghiepVu ob = Find(arrayList);

            Console.WriteLine("Nhập tên HDN");
            ob.Tenhdn = Nhap.NhapString();
            Console.WriteLine("Nhập tên nhân viên giao");
            ob.Tennvgiao = Nhap.NhapString();
            Console.WriteLine("Nhập mã HD");
            ob.Mahd = Nhap.NhapString();
            Console.WriteLine("Nhập tên xe cho thuê");
            ob.Tenxechothue = Nhap.NhapString();
            Console.WriteLine("Nhập số lượng");
            ob.Soluong = Nhap.NhapInt();
            Console.WriteLine("Nhập mã xe cho thuê");
            ob.Maxechothue = Nhap.NhapInt();
            Console.WriteLine("Nhập giá cho thuê");
            ob.Giachothue = Nhap.NhapDouble();
            ob.Tongtien   = Convert.ToInt32(Convert.ToDouble(ob.Soluong) * ob.Giachothue);
        }
Exemple #12
0
        public bool CapNhat(NghiepVu item)
        {
            NghiepVuDAL dal = new NghiepVuDAL(db);

            try
            {
                if (item != null)
                {
                    return(dal.CapNhat(item));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #13
0
        public JsonResult Search(int page, int pageSize, string information)
        {
            IQueryable <NghiepVu> danhSachNghiepVu = null;

            if (string.IsNullOrEmpty(information))
            {
                danhSachNghiepVu = bll.LayTatCa() as IQueryable <NghiepVu>;
                //lstNhanVien = db.NhanViens as IQueryable<NhanVien>;
            }
            else
            {
                danhSachNghiepVu = bll.TimKiemGanDungTheoTen(information) as IQueryable <NghiepVu>;
                //lstNhanVien = db.NhanViens.Where(x => x.TenNhanVien.Contains(information)) as IQueryable<NhanVien>;
            }


            int             totalRow = danhSachNghiepVu.Count();
            List <NghiepVu> lst      = new List <NghiepVu>();

            foreach (var item in danhSachNghiepVu)
            {
                NghiepVu nv = new NghiepVu()
                {
                    MaNghiepVu  = item.MaNghiepVu,
                    TenNghiepVu = item.TenNghiepVu,
                    GhiChu      = item.GhiChu
                };
                lst.Add(nv);
            }
            return(Json(new
            {
                data = lst.Skip((page - 1) * pageSize).Take(pageSize),
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #14
0
        public JsonResult LoadData(int page, int pageSize)
        {
            IQueryable <NghiepVu> danhSachNghiepVu = bll.LayTatCa() as IQueryable <NghiepVu>;

            int             totalRow = danhSachNghiepVu.Count();
            List <NghiepVu> lst      = new List <NghiepVu>();

            foreach (var item in danhSachNghiepVu)
            {
                NghiepVu nv = new NghiepVu()
                {
                    MaNghiepVu  = item.MaNghiepVu,
                    TenNghiepVu = item.TenNghiepVu,
                    GhiChu      = item.GhiChu
                };
                lst.Add(nv);
            }
            return(Json(new
            {
                data = lst.Skip((page - 1) * pageSize).Take(pageSize),
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #15
0
        public JsonResult CapNhat(string strNghiepVu)
        {
            JavaScriptSerializer serialiser = new JavaScriptSerializer();
            NghiepVu             nghiepVu   = serialiser.Deserialize <NghiepVu>(strNghiepVu);
            bool   status  = false;
            string message = string.Empty;
            ScriptFunctionsDataContext function = new ScriptFunctionsDataContext();
            NghiepVu nv = new NghiepVu()
            {
                MaNghiepVu  = nghiepVu.MaNghiepVu,
                TenNghiepVu = nghiepVu.TenNghiepVu,
                GhiChu      = nghiepVu.GhiChu
            };

            if (bll.CapNhat(nv) == true)
            {
                status = true;
            }

            return(Json(new
            {
                status = status
            }));
        }
Exemple #16
0
 public static void HienThi(NghiepVu ob)
 {
     Console.WriteLine("|{0,-20}|{1,-20}|{2,-20}|{3,-20}|{4,-20}|{5,-20}||{6,-20}|{7,-20}|{8,-20}|", ob.Mahd, ob.Tenhdn, ob.Tennvgiao, ob.Mahd, ob.Tenxechothue, ob.Soluong, ob.Maxechothue, ob.Tongtien, ob.Giachothue);
 }