Beispiel #1
0
        //
        /// <summary>
        /// ApprovedDate【0】,LastApprover【1】,Comment【2】,ApproverIds【3】
        /// </summary>
        /// <param name="processInstanceID"></param>
        /// <returns>ApprovedDate【0】,LastApprover【1】,Comment【2】,ApproverIds【3】</returns>
        public string[] GetProcessApproveUser(string processInstanceID)
        {
            DateTime ApprovedDate = DateTime.MinValue;
            string   LastApprover = "";
            string   Comment      = "";
            string   ApproverIds  = "";

            string[] ApproveInfo = new string[4];
            APWorkFlowTableAdapters.StuffUserInfoTableAdapter TAStuffUserinfo = new APWorkFlowTableAdapters.StuffUserInfoTableAdapter();
            if (String.IsNullOrEmpty(processInstanceID))
            {
                throw new Exception("GetProcessApproveUser - processInstanceID is empty");
            }
            string sql = "select CLIENT_DATA FROM WF_MANUAL_WORKITEMS where CLIENT_DATA like '%</APPROVED_BY>%' and PROC_INST_ID='" + processInstanceID + "' order by ASSIGNED_DATE asc";

            String[]  sqlRet     = api.QueryDatabaseEx(sql);
            DataTable l_dtclient = getDataTableFromXML(sqlRet[0], sqlRet[1]);

            APWorkFlow.NodeStatusDataTable l_dtapprove = new APWorkFlow.NodeStatusDataTable();
            int i = 0;

            foreach (DataRow l_dr in l_dtclient.Rows)
            {
                StringReader sr = new StringReader(l_dr["CLIENT_DATA"].ToString());
                l_dtapprove.ReadXml(sr);
                if (Convert.ToDateTime(l_dtapprove[0].COMPLETED_DATE) > ApprovedDate)
                {
                    ApprovedDate = Convert.ToDateTime(l_dtapprove[0].COMPLETED_DATE);
                    LastApprover = TAStuffUserinfo.GetDataByStuffName(l_dtapprove[0].APPROVED_BY)[0].StuffUserId.ToString();
                    Comment      = l_dtapprove[0].COMMENTS;
                }
                if (!string.IsNullOrEmpty(l_dtapprove[i].APPROVED_BY))
                {
                    ApproverIds += ("P" + TAStuffUserinfo.GetDataByStuffName(l_dtapprove[i].APPROVED_BY)[0].StuffUserId + "P");
                }
                i++;
            }
            ApproveInfo[0] = ApprovedDate.ToString();
            ApproveInfo[1] = LastApprover;
            ApproveInfo[2] = Comment;
            ApproveInfo[3] = ApproverIds;
            return(ApproveInfo);
        }
Beispiel #2
0
 //
 /// <summary>
 /// ApprovedDate【0】,LastApprover【1】,Comment【2】,ApproverIds【3】
 /// </summary>
 /// <param name="processInstanceID"></param>
 /// <returns>ApprovedDate【0】,LastApprover【1】,Comment【2】,ApproverIds【3】</returns>
 public string[] GetProcessApproveUser(string processInstanceID)
 {
     DateTime ApprovedDate = DateTime.MinValue;
     string LastApprover = "";
     string Comment = "";
     string ApproverIds = "";
     string[] ApproveInfo = new string[4];
     APWorkFlowTableAdapters.StuffUserInfoTableAdapter TAStuffUserinfo = new APWorkFlowTableAdapters.StuffUserInfoTableAdapter();
     if (String.IsNullOrEmpty(processInstanceID))
         throw new Exception("GetProcessApproveUser - processInstanceID is empty");
     string sql = "select CLIENT_DATA FROM WF_MANUAL_WORKITEMS where CLIENT_DATA like '%</APPROVED_BY>%' and PROC_INST_ID='" + processInstanceID + "' order by ASSIGNED_DATE asc";
     String[] sqlRet = api.QueryDatabaseEx(sql);
     DataTable l_dtclient = getDataTableFromXML(sqlRet[0], sqlRet[1]);
     APWorkFlow.NodeStatusDataTable l_dtapprove = new APWorkFlow.NodeStatusDataTable();
     int i = 0;
     foreach (DataRow l_dr in l_dtclient.Rows) {
         StringReader sr = new StringReader(l_dr["CLIENT_DATA"].ToString());
         l_dtapprove.ReadXml(sr);
         if (Convert.ToDateTime(l_dtapprove[0].COMPLETED_DATE) > ApprovedDate) {
             ApprovedDate = Convert.ToDateTime(l_dtapprove[0].COMPLETED_DATE);
             LastApprover = TAStuffUserinfo.GetDataByStuffName(l_dtapprove[0].APPROVED_BY)[0].StuffUserId.ToString();
             Comment = l_dtapprove[0].COMMENTS;
         }
         if (!string.IsNullOrEmpty(l_dtapprove[i].APPROVED_BY))
             ApproverIds += ("P" + TAStuffUserinfo.GetDataByStuffName(l_dtapprove[i].APPROVED_BY)[0].StuffUserId + "P");
         i++;
     }
     ApproveInfo[0] = ApprovedDate.ToString();
     ApproveInfo[1] = LastApprover;
     ApproveInfo[2] = Comment;
     ApproveInfo[3] = ApproverIds;
     return ApproveInfo;
 }