SigTrade.Models.DocumentsRepository.getDocumentsByID C# (CSharp) Method

getDocumentsByID() public method

public getDocumentsByID ( int SourceID, int SourceType, string RoleAccess ) : IList
SourceID int
SourceType int
RoleAccess string
return IList
        public IList<ParagraphDocument> getDocumentsByID(int SourceID, int SourceType, string RoleAccess)
        {
            int i = SPs.SpGetDocumentsByID(SourceID, SourceType, RoleAccess).ExecuteTypedList<ParagraphDocument>().Count;

            if (i > 0)
                return SPs.SpGetDocumentsByID(SourceID, SourceType, RoleAccess).ExecuteTypedList<ParagraphDocument>();
            else
            {
                return null;
            }
        }

Usage Example

        public ActionResult AddDocument(FormCollection collection)
        {
            try
            {
                IDocumentsRepository docs = new DocumentsRepository();

                string _SourceID = collection["SourceID"];
                string _SourceType = collection["SourceType"];
                string _ReviewID = collection["ReviewID"];
                string _PALibID = collection["PALibID"];
                string _contributor = collection["CONTRIBUTOR"];
                collection["UserID"] = 1.ToString();
                collection["docfiletype"] = collection["docfileadd"];

                if (collection["docfileadd"].ToString().Equals("upload"))
                {
                    foreach (string filename in Request.Files)
                    {
                        HttpPostedFileBase file = Request.Files[filename];
                        var document_dir = ConfigurationManager.AppSettings["@BaseDir"];

                        var file_path = Request.PhysicalApplicationPath + document_dir;

                        if (file.ContentLength > 0)
                        {
                            string filePath = Path.Combine(file_path, Path.GetFileName(file.FileName));
                            file.SaveAs(filePath);

                            collection["DocName"] = file.FileName;
                            collection["DocPath"] = file_path;
                            collection["DocAccess"] = collection["ddDocumentTypeEdit"];
                            int documentID = UpdateUtils.InsertDocuments(collection, int.Parse(_SourceID),
                                                                         int.Parse(_SourceType));
                            UpdateUtils.SendDocumentUploadNotification(Membership.GetUser().UserName, documentID);
                        }
                    }
                }
                else if (collection["docfileadd"].ToString().Equals("hyperlink"))
                {
                    collection["DocName"] = collection["txtHyperlinkAdd"];
                    collection["DocPath"] = null;
                    collection["DocAccess"] = collection["ddDocumentTypeEdit"];
                    int documentID = UpdateUtils.InsertDocuments(collection, int.Parse(_SourceID),
                                                                         int.Parse(_SourceType));
                    //NEED TO COME BACK TO THIS
                    UpdateUtils.SendDocumentUploadNotification(System.Web.HttpContext.Current.User.Identity.Name, documentID);
                }

                //return View();
                ViewData["Documents"] = docs.getDocumentsByID(int.Parse(_SourceID),
                                                              int.Parse(_SourceType),UpdateUtils.ROLE_ALL);

                ViewData["ReviewID"] = _ReviewID;
                ViewData["PALibID"] = _PALibID;
                ViewData["PActionID"] = _SourceID;
                ViewData["contributor"] = _contributor;

                return PartialView("display_documents");
                //return RedirectToAction("ParagraphDetails", new { ReviewID = int.Parse(_ReviewID), PALibID = int.Parse(_PALibID) });
                //return RedirectToAction("Details");
            }
            catch
            {
                return null;
            }
        }
All Usage Examples Of SigTrade.Models.DocumentsRepository::getDocumentsByID