public List <OAttach> GetAttachs(string CommentID) { IList <OComment> lstComment = this.Get(CommentID); string strAttachID = lstComment[0].Attachs; if ((strAttachID == "") || (strAttachID == ",") || (strAttachID == ",,")) { return(new List <OAttach>()); } else { String[] arrattachs = strAttachID.Split(','); List <OAttach> lstAttachs = new List <OAttach>(); BAttach objBAttach = new BAttach(); if (arrattachs.Count() > 1) { for (int i = 1; i < arrattachs.Count() - 1; i++) { //OAttach objAttach = objBAttach.Get(int.Parse(arrattachs[i])).First(); foreach (OAttach obj in objBAttach.Get(int.Parse(arrattachs[i]))) { lstAttachs.Add(obj); } //lstAttachs.Add(objAttach); } } return(lstAttachs); } }
/// <summary> /// Lấy danh sách file Attach của 1 công việc /// </summary> /// <param name="WorkID"></param> /// <returns></returns> public List <OAttach> GetAttachs(int WorkID) { IList <OWork> lstWork = this.GetWork(WorkID); string strAttachID = lstWork[0].Attachs; if ((strAttachID == "") || (strAttachID == ",")) { return(null); } else { String[] arrattachs = strAttachID.Split(','); List <OAttach> lstAttachs = new List <OAttach>(); BAttach objBAttach = new BAttach(); if (arrattachs.Count() > 1) { for (int i = 1; i < arrattachs.Count() - 1; i++) { OAttach objAttach = objBAttach.Get(int.Parse(arrattachs[i])).First(); lstAttachs.Add(objAttach); } } return(lstAttachs); } }