public ResultModel Approve(string processCode, string sn, int loginId, string actionString, string memo, string jsonData, string apiKey)
        {
            Cat.GetProducer().NewTransaction("URL-WebService", "Approve");
            var         a      = Cat.GetManager().PeekTransaction;
            ResultModel result = null;

            try
            {
                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowTaskService.ApproveK2Process(processCode, sn, loginId, actionString, memo, jsonData);
                }
                else
                {
                    result = new ResultModel()
                    {
                        Code = ResultCode.Fail, Msg = "ApiKey错误"
                    };
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                throw ex;
            }
            finally
            {
                a.Complete();
            }
            return(result);
        }
        public List <K2CommentDto> GetProcessComments(List <int> procInstIds, string apiKey)
        {
            Cat.GetProducer().NewTransaction("URL-WebService", "GetProcessComments");
            var a = Cat.GetManager().PeekTransaction;
            List <K2CommentDto> result = null;

            try
            {
                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowProcessService.GetComment(procInstIds);
                }
                else
                {
                    result = new List <K2CommentDto>();
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                throw ex;
            }
            finally
            {
                a.Complete();
            }
            return(result);
        }
        public ResultModel Start(string processCode, int loginId, string objectId, string folio, string jsonData, string apiKey)
        {
            Cat.GetProducer().NewTransaction("URL-WebService", "Start");
            var         a      = Cat.GetManager().PeekTransaction;
            ResultModel result = null;

            try
            {
                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowProcessService.StartProcess(processCode, loginId, objectId, folio, jsonData);;
                }
                else
                {
                    result = new ResultModel()
                    {
                        Code = ResultCode.Fail, Msg = "ApiKey错误"
                    };
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                //Cat.GetProducer().LogEvent("Start", "Arguments", "0", string.Format);

                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                throw ex;
            }
            finally {
                a.Complete();
            }
            return(result);
        }
        public QueryListResultBase <MyTaskDto> GetTaskList(QueryCriteriaBase <MyTaskCriteria> queryPara, string apiKey)
        {
            Cat.GetProducer().NewTransaction("URL-WebService", "GetTaskList");
            var a = Cat.GetManager().PeekTransaction;
            QueryListResultBase <MyTaskDto> result = null;

            try
            {
                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowTaskService.GetMyTaskList(queryPara);
                }
                else
                {
                    result = new QueryListResultBase <MyTaskDto>();
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                throw ex;
            }
            finally
            {
                a.Complete();
            }
            return(result);
        }
        public ResultModel ReAssignTask(string sn, int assignFromLoginId, string assignFromRealName, int assignToLoginId, string assignToRealName, bool isAddLog, string apiKey)
        {
            Cat.GetProducer().NewTransaction("URL-WebService", "ReAssignTask");
            var         a      = Cat.GetManager().PeekTransaction;
            ResultModel result = null;

            try
            {
                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowTaskService.ReAssign(sn, assignFromLoginId, assignFromRealName, assignToLoginId, assignToRealName, isAddLog);
                }
                else
                {
                    result = new ResultModel()
                    {
                        Code = ResultCode.Fail, Msg = "ApiKey错误"
                    };
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                throw ex;
            }
            finally
            {
                a.Complete();
            }
            return(result);
        }
Пример #6
0
        public void ProcessRequest(HttpContext context)
        {
            Cat.GetProducer().NewTransaction("URL-http", "ReAssign");
            var a = Cat.GetManager().PeekTransaction;

            context.Response.ContentType = "text/plain";
            ResultModel result = new ResultModel();

            try
            {
                string sn = context.Request.Params["sn"];
                int    assignFromLoginId = 0;
                int.TryParse(context.Request.Params["assignFromLoginId"], out assignFromLoginId);
                string assignFromRealName = context.Request.Params["assignFromRealName"];
                int    assignToLoginId    = 0;
                int.TryParse(context.Request.Params["assignToLoginId"], out assignToLoginId);
                string assignToRealName = context.Request.Params["assignToRealName"];
                bool   isAddLog         = false;
                try
                {
                    isAddLog = Convert.ToBoolean(context.Request.Params["isAddLog"]);
                }
                catch { }

                string apiKey = context.Request.Params["apiKey"];

                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowTaskService.ReAssign(sn, assignFromLoginId, assignFromRealName, assignToLoginId, assignToRealName, isAddLog);
                }
                else
                {
                    result = new ResultModel()
                    {
                        Code = ResultCode.Fail, Msg = "ApiKey错误"
                    };
                }

                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                LogHelper.Error("ReAssign", ex.Message, ex, context.Request.Params.ToString());
                result = new ResultModel()
                {
                    Code = ResultCode.Fail, Msg = ex.Message
                };
                context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            }
            finally
            {
                a.Complete();
            }
            context.Response.Write(JsonConvert.SerializeObject(result));
        }
Пример #7
0
        public void ProcessRequest(HttpContext context)
        {
            Cat.GetProducer().NewTransaction("URL-http", "Approve");
            var a = Cat.GetManager().PeekTransaction;

            context.Response.ContentType = "text/plain";
            ResultModel result = new ResultModel();

            try
            {
                string processCode = context.Request.Params["processCode"];
                int    loginId     = 0;
                int.TryParse(context.Request.Params["loginId"], out loginId);
                string sn           = context.Request.Params["sn"];
                string actionString = context.Request.Params["actionString"];
                string memo         = context.Request.Params["memo"];
                string jsonData     = context.Request.Params["jsonData"];
                string apiKey       = context.Request.Params["apiKey"];

                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowTaskService.ApproveK2Process(processCode, sn, loginId, actionString, memo, jsonData);
                }
                else
                {
                    result = new ResultModel()
                    {
                        Code = ResultCode.Fail, Msg = "ApiKey错误"
                    };
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                LogHelper.Error("Approve", ex.Message, ex, context.Request.Params.ToString());

                result = new ResultModel()
                {
                    Code = ResultCode.Fail, Msg = ex.Message
                };
            }
            finally
            {
                a.Complete();
            }
            context.Response.Write(JsonConvert.SerializeObject(result));
        }
Пример #8
0
        public void ProcessRequest(HttpContext context)
        {
            Cat.GetProducer().NewTransaction("URL-http", "GetProcessComments");
            var a = Cat.GetManager().PeekTransaction;

            context.Response.ContentType = "text/plain";
            List <K2CommentDto> result = new List <K2CommentDto>();

            try
            {
                string     procInstIds = context.Request.Params["procInstIds"];
                List <int> procInstId  = new List <int>();
                if (!string.IsNullOrEmpty(procInstIds))
                {
                    procInstId = procInstIds.Split(new char[] { ',', ';' }).Select(_ => int.Parse(_)).ToList();
                }
                string apiKey = context.Request.Params["apiKey"];

                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowProcessService.GetComment(procInstId);
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                LogHelper.Error("GetProcessComments", ex.Message, ex, context.Request.Params.ToString());

                result = new List <K2CommentDto>();
                context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            }
            finally
            {
                a.Complete();
            }
            context.Response.Write(JsonConvert.SerializeObject(result, new IsoDateTimeConverter()
            {
                DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fff"
            }));
        }
        public void ProcessRequest(HttpContext context)
        {
            Cat.GetProducer().NewTransaction("URL-http", "GetProcessStatus");
            var a = Cat.GetManager().PeekTransaction;

            context.Response.ContentType = "text/plain";
            List <K2StatusDto> result = new List <K2StatusDto>();

            try
            {
                int procInstId = 0;
                int.TryParse(context.Request.Params["procInstId"], out procInstId);
                string folio  = context.Request.Params["folio"];
                string apiKey = context.Request.Params["apiKey"];

                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    result = WorkFlowProcessService.GetProcessStatus(procInstId, folio);
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                LogHelper.Error("GetProcessStatus", ex.Message, ex, context.Request.Params.ToString());

                result = new List <K2StatusDto>();
                context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            }
            finally
            {
                a.Complete();
            }
            context.Response.Write(JsonConvert.SerializeObject(result, new IsoDateTimeConverter()
            {
                DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fff"
            }));
        }
        public void ProcessRequest(HttpContext context)
        {
            Cat.GetProducer().NewTransaction("URL-http", "GetTaskList");
            var a = Cat.GetManager().PeekTransaction;

            context.Response.ContentType = "text/plain";
            QueryListResultBase <MyTaskDto> result = new QueryListResultBase <MyTaskDto>();

            try
            {
                int loginId = 0;
                int.TryParse(context.Request.Params["loginId"], out loginId);
                string     originatorLoginIds = context.Request.Params["originatorLoginIds"];
                List <int> originatorLoginId  = new List <int>();
                if (!string.IsNullOrEmpty(originatorLoginIds))
                {
                    originatorLoginId = originatorLoginIds.Split(new char[] { ',', ';' }).Select(_ => int.Parse(_)).ToList();
                }
                string     procInstIds = context.Request.Params["procInstIds"];
                List <int> procInstId  = new List <int>();
                if (!string.IsNullOrEmpty(procInstIds))
                {
                    procInstId = procInstIds.Split(new char[] { ',', ';' }).Select(_ => int.Parse(_)).ToList();
                }
                string        processCodes = context.Request.Params["processCodes"];
                List <string> processCode  = new List <string>();
                if (!string.IsNullOrEmpty(processCodes))
                {
                    processCode = processCodes.Split(new char[] { ',', ';' }).ToList();
                }
                string folio       = context.Request.Params["folio"];
                string taskFrom    = context.Request.Params["taskFrom"];
                string taskTo      = context.Request.Params["taskTo"];
                string processFrom = context.Request.Params["processFrom"];
                string processTo   = context.Request.Params["processTo"];
                int    pageIndex   = 0;
                int.TryParse(context.Request.Params["pageIndex"], out pageIndex);
                int pageSize = 0;
                int.TryParse(context.Request.Params["pageSize"], out pageSize);
                string sortField = context.Request.Params["sortField"];
                string sortOrder = context.Request.Params["sortOrder"];

                string apiKey = context.Request.Params["apiKey"];

                if (APIKeyUtility.IsRightAPIKey(apiKey))
                {
                    PaginationModel PagingInfo = new PaginationModel()
                    {
                        PageIndex = pageIndex,
                        PageSize  = pageSize
                    };
                    if (!string.IsNullOrEmpty(sortField))
                    {
                        PagingInfo.SortField = sortField;
                    }
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        switch (sortOrder.ToUpper())
                        {
                        case "ASC":
                            PagingInfo.SortOrder = SortOrder.Ascending;
                            break;

                        case "DESC":
                            PagingInfo.SortOrder = SortOrder.Descending;
                            break;

                        default:
                            PagingInfo.SortOrder = SortOrder.Unspecified;
                            break;
                        }
                    }

                    DatePeriodModel processDate = new DatePeriodModel();
                    if (!string.IsNullOrEmpty(processFrom))
                    {
                        processDate.DateFrom = Convert.ToDateTime(processFrom);
                    }
                    if (!string.IsNullOrEmpty(processTo))
                    {
                        processDate.DateTo = Convert.ToDateTime(processTo);
                    }

                    DatePeriodModel taskDate = new DatePeriodModel();
                    if (!string.IsNullOrEmpty(taskFrom))
                    {
                        taskDate.DateFrom = Convert.ToDateTime(taskFrom);
                    }
                    if (!string.IsNullOrEmpty(taskTo))
                    {
                        taskDate.DateTo = Convert.ToDateTime(taskTo);
                    }

                    QueryCriteriaBase <MyTaskCriteria> query = new QueryCriteriaBase <MyTaskCriteria>()
                    {
                        PagingInfo    = PagingInfo,
                        QueryCriteria = new MyTaskCriteria()
                        {
                            Folio             = folio,
                            LoginId           = loginId,
                            OriginatorLoginId = originatorLoginId,
                            ProcInstId        = procInstId,
                            ProcessCode       = processCode,
                            ProcessStartDate  = processDate,
                            TaskStartDate     = taskDate
                        }
                    };

                    result = WorkFlowTaskService.GetMyTaskList(query);
                }
                a.Status = "0";
            }
            catch (Exception ex)
            {
                Cat.GetProducer().LogError(ex);
                a.SetStatus(ex);
                LogHelper.Error("GetTaskList", ex.Message, ex, context.Request.Params.ToString());
                result = new QueryListResultBase <MyTaskDto>();
                context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            }
            finally
            {
                a.Complete();
            }
            context.Response.Write(JsonConvert.SerializeObject(result, new IsoDateTimeConverter()
            {
                DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fff"
            }));
        }