Example #1
0
 public ActionResult Delete(string id, UploadsModel uploads)
 {
     try
     {
         uploadsCollection.DeleteOne(Builders <UploadsModel> .Filter.Eq("_id", ObjectId.Parse(id)));
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #2
0
        public IHttpActionResult GetUploadedFiles(string userName, DateTime?fromDate, DateTime?toDate, int?doctorId, string jobNumber, string status, int page, int count, string sortCol, string sortDir)
        {
            try
            {
                using (MaxMasterDbEntities dbMaster = new MaxMasterDbEntities())
                {
                    var user     = dbMaster.AspNetUsers.Where(x => x.Email == userName).FirstOrDefault();
                    var userId   = user.Id;
                    var clientId = dbMaster.ClientEmployees.Where(x => x.Email == userName).Select(x => x.Client_Id).FirstOrDefault();
                    var doctors  = dbMaster.Doctors.Where(x => x.Client_Id == clientId).Select(x => new { value = x.Id, label = x.FirstName + " " + x.LastName }).OrderBy(x => x.label).ToList();

                    using (MaxMRSEntities db = new MaxMRSEntities())
                    {
                        int totalcount      = 0;
                        var EmployeeUploads = db.GetClientUploadedJobs(userName, fromDate, toDate, doctorId, jobNumber, status, page, count, sortCol, sortDir).ToList();

                        if (EmployeeUploads.Count > 0)
                        {
                            totalcount = (int)EmployeeUploads.FirstOrDefault().TotalCount;
                        }

                        UploadsModel uploads = new UploadsModel();

                        List <UploadsModel> clientUploadsList = new List <UploadsModel>();

                        foreach (var uplds in EmployeeUploads)
                        {
                            string[] filesplit = uplds.ClientFilePath.Split('/');
                            string   fName     = filesplit.Last();

                            clientUploadsList.Add(new UploadsModel()
                            {
                                DoctorName     = uplds.DoctorName,
                                ClientFilePath = uplds.ClientFilePath,
                                Status         = uplds.Status,
                                FileName       = fName,
                                JobNumber      = uplds.JobNumber,
                                UploadedDate   = uplds.Arrival_Time,
                                TotalPages     = uplds.TotalPages
                            });
                        }

                        return(Content(HttpStatusCode.OK, new { doctors, totalcount, clientUploadsList }));
                    }
                }
            }
            catch (Exception ex)
            {
                new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace);
                return(Content(HttpStatusCode.OK, "An error occured, please try agin later"));
            }
        }
Example #3
0
        public ActionResult Create(UploadsModel uploads)
        {
            try
            {
                uploadsCollection.InsertOne(uploads);
                OracleConnection Con = new OracleConnection(TNS);
                Con.Open();
                var           username = Session["UserID"].ToString();
                OracleCommand cmd      = new OracleCommand("INSERT INTO UPLOAD(USER_ID, SUBJECT_CODE,CONTENT_DESCRIP, HASHTAGS, PRIVATE, FILE_DIR)" +
                                                           "VALUES(" + username + ", '" + uploads.Subject_Code + "', '" + uploads.Description + "', '" +
                                                           uploads.Hashtags + "','Y', '...')", Con);

                cmd.ExecuteNonQuery();
                Con.Close();
                Con.Dispose();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #4
0
        public ActionResult Edit(string id, UploadsModel uploads)
        {
            try
            {
                var filter = Builders <UploadsModel> .Filter.Eq("_id", ObjectId.Parse(id));

                //var filter = Builders<UploadsModel>.Filter.Eq("_id", uploads.Id);
                var update = Builders <UploadsModel> .Update
                             .Set("UserId", uploads.UserId)
                             .Set("Subject_Code", uploads.Subject_Code)
                             .Set("Subject_Name", uploads.Subject_Name)
                             .Set("Study_Year", uploads.Study_Year)
                             .Set("Description", uploads.Description)
                             .Set("Hashtags", uploads.Hashtags)
                             .Set("File_Upload", uploads.File_Upload);

                var result = uploadsCollection.UpdateOne(filter, update);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }