Пример #1
0
 public ActionResult Uploads(UploadHRDocumentsViewModel vm)
 {
     Session["SearchEmpID"]       = null; // to hide employee search
     Session["SearchEmpFullName"] = null;
     Session["SearchEmpCode"]     = null;
     return(View(vm));
 }
Пример #2
0
        public ActionResult UploadRMGDocument(HttpPostedFileBase doc, UploadHRDocumentsViewModel model)
        {
            UploadsDAL uploads      = new UploadsDAL();
            bool       uploadStatus = false;

            if (doc.ContentLength > 0)
            {
                string uploadsPath = (UploadFileLocationRMG);
                uploadsPath = Path.Combine(uploadsPath, GetUploadTypeSelectedText(1));
                string fileName = Path.GetFileName(doc.FileName);
                try
                {
                    IDocuments document = null;

                    if (!uploads.IsRMGDocumentExists(Path.GetFileName(doc.FileName), model.UploadTypeId))
                    {
                        // Insert new record to parent
                        document          = new Tbl_RMG_Documents();
                        document.FileName = Path.GetFileName(doc.FileName);
                        ((Tbl_RMG_Documents)document).FileDescription = model.FileDescription;
                        ((Tbl_RMG_Documents)document).UploadTypeId    = 1;
                    }
                    else
                    {
                        // Insert new record to child

                        document = new Tbl_RMG_DocumentDetail();
                        int    documentID         = 0;
                        string newNameForDocument = uploads.GetNewNameForRMGDocument(Path.GetFileName(doc.FileName), 1, out documentID);
                        fileName            = newNameForDocument;
                        document.DocumentId = documentID;
                        document.FileName   = newNameForDocument;
                    }

                    document.FilePath        = uploadsPath;
                    document.Comments        = model.Comments;
                    document.FileDescription = model.FileDescription;
                    document.UploadedBy      = int.Parse(HttpContext.User.Identity.Name);
                    document.UploadedDate    = DateTime.Now;
                    uploads.UploadRMGDocument(document);

                    string filePath = Path.Combine(uploadsPath, fileName);
                    if (!Directory.Exists(uploadsPath))
                    {
                        Directory.CreateDirectory(uploadsPath);
                    }

                    doc.SaveAs(filePath);
                    uploadStatus = true;
                }
                catch (Exception)
                {
                    //throw;
                }
            }
            return(Json(new { status = uploadStatus }, "text/html", JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult OrbitStart()
        {
            UploadHRDocumentsViewModel vm = new UploadHRDocumentsViewModel();

            vm.SearchedUserDetails = new SearchedUserDetails();
            string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);
            //added
            string user = Commondal.GetMaxRoleForUser(role);

            vm.SearchedUserDetails.UserRole = user;

            return(View("Demo", vm));
        }
Пример #4
0
        public ActionResult ShowHistoryRMGDocUploads(int documentId, string uploadType)
        {
            HRMSDBEntities dbContext = new HRMSDBEntities();
            UploadsDAL     uploads   = new UploadsDAL();
            List <Tbl_RMG_DocumentDetail>     objHRDocDetails = new List <Tbl_RMG_DocumentDetail>();
            Tbl_RMG_Documents                 objhRDoc        = new Tbl_RMG_Documents();
            List <UploadHRDocumentsViewModel> objDocList      = new List <UploadHRDocumentsViewModel>();
            int uploadTypeId = dbContext.Tbl_HR_UploadType.Where(x => x.UploadType == uploadType).FirstOrDefault().UploadTypeId;

            try
            {
                objhRDoc        = uploads.GetRMGDocument(documentId);
                objHRDocDetails = uploads.GetRMGDocumentHistoryForDisplay(documentId);

                foreach (Tbl_RMG_DocumentDetail eachDocDetail in objHRDocDetails)
                {
                    UploadHRDocumentsViewModel dd = new UploadHRDocumentsViewModel()
                    {
                        DocumentID      = eachDocDetail.DocumentId,
                        Comments        = eachDocDetail.Comments,
                        FileDescription = eachDocDetail.FileDescription,
                        FileName        = eachDocDetail.FileName,
                        UploadedBy      = uploads.GetUploadNameFromUploadById(HttpContext.User.Identity.Name),
                        UploadedDate    = (eachDocDetail.UploadedDate).Value,
                        FilePath        = eachDocDetail.FilePath,
                        UploadTypeId    = uploadTypeId
                    };
                    objDocList.Add(dd);
                }

                UploadHRDocumentsViewModel dd1 = new UploadHRDocumentsViewModel()
                {
                    DocumentID      = objhRDoc.DocumentId,
                    Comments        = objhRDoc.Comments,
                    FileDescription = objhRDoc.FileDescription,
                    FileName        = objhRDoc.FileName,
                    UploadedBy      = uploads.GetUploadNameFromUploadById(HttpContext.User.Identity.Name),
                    UploadedDate    = (objhRDoc.UploadedDate).Value,
                    FilePath        = objhRDoc.FilePath,
                    UploadTypeId    = uploadTypeId
                };

                objDocList.Add(dd1);
                return(PartialView("_ShowHRDocHistory", objDocList));
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Пример #5
0
        public ActionResult Uploads(int?documentID)
        {
            Session["SearchEmpID"]       = null; // hide emp search
            Session["SearchEmpFullName"] = null;
            Session["SearchEmpCode"]     = null;

            UploadHRDocumentsViewModel vm = new UploadHRDocumentsViewModel();
            string employeeCode           = Membership.GetUser().UserName;
            int    employeeID             = dal.GetEmployeeID(employeeCode);

            vm.UploadTypeValues               = this.GetUploadTypes();
            ViewBag.DocumentID                = documentID;
            vm.SearchedUserDetails            = new SearchedUserDetails();
            vm.SearchedUserDetails.EmployeeId = employeeID;
            string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);
            string   user = Commondal.GetMaxRoleForUser(role);

            vm.SearchedUserDetails.UserRole = user;
            return(View(vm));
        }