Beispiel #1
0
        /// <summary>
        /// 提交资源请求
        /// </summary>
        /// <param name="Title"></param>
        /// <param name="Description"></param>
        /// <param name="EndDate"></param>
        /// <param name="UserID"></param>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public string ResourceRequest(string Title, string Description, DateTime EndDate, int UserID, string UserName, int UserType, int NextUserID, string NextUser)
        {
            string data = "{\"result\":\"success\",\"message\":\"请求已成功提交\"}";

            try
            {
                var pk = SqlMapDAL.CreateNameQuery("SaveResourceRequest")
                         .SetParameter("Title", Title)
                         .SetParameter("Description", Description)
                         .SetParameter("EndDate", EndDate)
                         .SetParameter("UserID", UserID)
                         .SetParameter("UserName", UserName)
                         .SetParameter("UserType", UserType)
                         .ExecuteScalar();
                int RequestID = int.Parse(pk.ToString());
                ResourceRequestWF workflow = new ResourceRequestWF();
                // 初始化流程
                string ProcessID = workflow.Create(RequestID, Title, "资源申请业务流程");
                workflow.Approve(RequestID, 0, UserID, UserName, NextUserID, NextUser, "提交资源请求", 1);
            }
            catch (Exception ex)
            {
                var obj = new { result = "fail", message = ex.Message };
                data = JsonConvert.SerializeObject(obj);
            }
            return(data);
        }
Beispiel #2
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="RequestID"></param>
        /// <param name="Conclusion"></param>
        /// <param name="Content"></param>
        /// <returns></returns>
        public string ResourceRequestApprove(int RequestID, int Status, int Conclusion, string Content, int UserID, string UserName, int NextUserID, string NextUserName)
        {
            try
            {
                ResourceRequestWF workflow = new ResourceRequestWF();
                workflow.Approve(RequestID, Status, UserID, UserName, NextUserID, NextUserName, Content, Conclusion);
                ResourceRequestInfo resource = SqlMapDAL.CreateNameQuery("GetMyResourceInfo").SetParameter("RequestID", RequestID).Entity <ResourceRequestInfo>();

                var obj = new { result = "success", message = "操作成功", Title = resource.Title };
                return(JsonConvert.SerializeObject(obj));
            }
            catch (Exception ex)
            {
                var obj = new { result = "fail", message = ex.Message };
                return(JsonConvert.SerializeObject(obj));
            }
        }