Ejemplo n.º 1
0
        /// <summary>
        /// 得到相关的附件列表
        /// </summary>
        /// <param name="Guidid"></param>
        /// <returns></returns>
        public static String GetAttachmengList(String Guidid, String projectStatus)
        {
            //判断用户对数据能否进行维护
            bool IsCanManager = false;

            if (projectStatus == "1")
            {
                IsCanManager = IsCanEdit(Guidid);
            }

            String             result    = String.Empty;
            List <SearchField> condition = new List <SearchField>();
            JAttachmentDA      da1       = new JAttachmentDA();

            condition.Clear();
            condition.Add(new SearchField("parentGuid", Guidid));
            DataTable dt1   = da1.GetListData(condition, -1, -1, "UploadTime", "*");
            bool      first = true;
            String    temp1 = "<a title='打开附件' href='#' onclick='javascript:openFile(\"{0}\",\"{1}\")'>{1}</a> ";

            if (IsCanManager)
            {
                // temp1 = temp1 + "<a title='删除附件' onclick='javascript:deleteFile(\"{2}\")' href='#'><img src='/images/Frame/del.gif' width='16' height='16' border='0' /></a>";
            }


            foreach (DataRow dr1 in dt1.Rows)
            {
                if (first)
                {
                    result = String.Format(temp1, dr1["EncryptFileName"].ToString(), dr1["FileName"].ToString(), dr1["Guidid"].ToString());
                    first  = false;
                }
                else
                {
                    result = result + "<br/>";
                    result = result + String.Format(temp1, dr1["EncryptFileName"].ToString(), dr1["FileName"].ToString(), dr1["Guidid"].ToString());
                }
            }

            if (IsCanManager)
            {
                if (String.IsNullOrEmpty(result))
                {
                    result = String.Format("<a href='#' onclick='UploadAttachmentFile(\"{0}\")'>上传附件</a>", Guidid);
                }
                else
                {
                    result = result + "<br/>" + String.Format("<a href='#' onclick='UploadAttachmentFile(\"{0}\")'>上传附件</a>", Guidid);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据工单的ID,得到其附件列表
        /// </summary>
        /// <param name="Guidid"></param>
        /// <returns></returns>
        public static String GetAttachmengList(String Guidid)
        {
            //判断用户对数据能否进行维护
            bool IsCanEdit = false;
            List <SearchField> condition = new List <SearchField>();

            //得到工单的数据
            condition.Add(new SearchField("Guidid", Guidid));
            Dictionary <String, object> dic1 = (new Tb_TaskDA()).GetFirstDictionary(condition, "*");

            if (dic1 != null && dic1.Count > 0)
            {
                String Status1      = dic1["Status"].ToString();
                String ExecuteManID = dic1["ExecuteManID"].ToString();
                String parentGuid   = dic1["parentGuid"].ToString();

                //未派单,进行中,审核中 (已完成、未完成和已作废)
                if (Status1 == "0" || Status1 == "1" || Status1 == "2")
                {
                    if (ExecuteManID == WebFrame.FrameLib.UserID)
                    {
                        IsCanEdit = true;
                    }
                    else
                    {
                        IsCanEdit = (new Tb_ProjectBU()).IsCanEditProjectByProjectNum(parentGuid, WebFrame.FrameLib.UserID);
                    }
                }
            }

            //得到附件列表
            String        result = String.Empty;
            JAttachmentDA da1    = new JAttachmentDA();

            condition.Clear();
            condition.Add(new SearchField("parentGuid", Guidid));
            DataTable dt1   = da1.GetListData(condition, -1, -1, "UploadTime", "*");
            bool      first = true;
            String    temp1 = "<a title='上传时间{2},点击打开' href='#' onclick='javascript:openFile(\"{0}\",\"{1}\")'>{1}</a> ";

            if (IsCanEdit)
            {
                // temp1 = temp1 + "<a title='删除附件' onclick='javascript:deleteFile(\"{2}\")' href='#'><img src='/images/Frame/del.gif' width='16' height='16' border='0' /></a>";
            }


            foreach (DataRow dr1 in dt1.Rows)
            {
                if (first)
                {
                    result = String.Format(temp1, dr1["EncryptFileName"].ToString(), dr1["FileName"].ToString(), dr1["UploadTime"]);
                    first  = false;
                }
                else
                {
                    result = result + "<br/>";
                    result = result + String.Format(temp1, dr1["EncryptFileName"].ToString(), dr1["FileName"].ToString(), dr1["UploadTime"]);
                }
            }

            if (IsCanEdit)
            {
                if (String.IsNullOrEmpty(result))
                {
                    result = String.Format("<a href='#' onclick='UploadAttachmentFile(\"{0}\")'>上传附件</a>", Guidid);
                }
                else
                {
                    result = result + "<br/>" + String.Format("<a href='#' onclick='UploadAttachmentFile(\"{0}\")'>上传附件</a>", Guidid);
                }
            }

            return(result);
        }