Beispiel #1
0
        public ActionResult ViewJobByPX()
        {
            int    start          = Convert.ToInt32(Request["start"]);
            int    length         = Convert.ToInt32(Request["length"]);
            string searchValue    = Request["search[value]"];
            string sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"];
            string sortDirection  = Request["order[0][dir]"];

            using (QUANGHANHABCEntities db = new QUANGHANHABCEntities())
            {
                var temp = (from a in db.Departments select new { TenPhanXuong = a.department_name }).ToList();

                IEnumerable <Department> arrPhanXuong = temp.Distinct().ToList().Select(p => new Department {
                    department_name = p.TenPhanXuong
                });
                ViewBag.nameDepartment = "vld-antoan";
                ViewBag.PhanXuongs     = arrPhanXuong;
                List <string> arrNhanvienNhiemVu = new List <string>();

                IOrderedEnumerable <NhiemVu> arrNhiemVu = db.NhiemVus.ToList().OrderBy(n => n.Loai);
                foreach (NhiemVu n in arrNhiemVu)
                {
                    arrNhanvienNhiemVu.Add(n.MaNhiemVu.ToString());
                }
                List <MyModal> model = new List <MyModal>();


                MyModal tempModel = new MyModal();

                foreach (NhiemVu v in arrNhiemVu)
                {
                    if (!v.Loai.Equals(tempModel.loai))
                    {
                        tempModel = new MyModal
                        {
                            loai = v.Loai
                        };
                        tempModel.arrNV.Add(v);
                        model.Add(tempModel);
                    }
                    else
                    {
                        tempModel.arrNV.Add(v);
                    }
                }



                ViewBag.arrNhanVien_NhiemVu = arrNhanvienNhiemVu;
                ViewBag.arrNhiemVu          = model;
                return(View("/Views/TCLD/Task/ViewJobByPX.cshtml"));
            }
        }
     public ActionResult UploadFile(MyModal Modal)
     {
             string DocumentName = string.Empty;
             string Description = string.Empty;
 
             if (!String.IsNullOrEmpty(Request.Form["DocumentName"].ToString()))
                 DocumentName = Request.Form["DocumentName"].ToString();
             if (!String.IsNullOrEmpty(Request.Form["Description"].ToString()))
                 Description = Request.Form["Description"].ToString();
             
             if (!String.IsNullOrEmpty(Request.Form["FileName"].ToString()))
                 UploadedDocument = Request.Form["FileName"].ToString();
 
             HttpFileCollectionBase files = Request.Files;
 
             string filePath = Server.MapPath("~/Root/Documents/");
             if (!(Directory.Exists(filePath)))
                 Directory.CreateDirectory(filePath);
             for (int i = 0; i < files.Count; i++)
             {
                 HttpPostedFileBase file = files[i];
                 // Checking for Internet Explorer  
                 if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                 {
                     string[] testfiles = file.FileName.Split(new char[] { '\\' });
                     fname = testfiles[testfiles.Length - 1];
                     UploadedDocument = fname;
                 }
                 else
                 {
                     fname = file.FileName;
                     UploadedDocument = file.FileName;
                 }
                 file.SaveAs(fname);
                 return RedirectToAction("List", "Home");
 }