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 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);
        }
        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);
        }
Esempio n. 4
0
        public void ProcessRequest(HttpContext context)
        {
            string oType   = context.Request.Params["oType"];
            string content = context.Request.Params["content"];

            //string oType = "start";
            //string content = "{\"businessType\":\"crm\",\"apiKey\":\"test\",\"folio\":\"folio\",\"jsonData\":\"{}\",\"loginId\":\"-14683\",\"ObjectId\":\"1234\",\"processCode\":\"TGContractV2\"}";

            HttpRequest       request  = context.Request;
            HttpResponse      response = context.Response;
            HttpServerUtility server   = context.Server;

            //指定输出头和编码
            response.ContentType = "text/html";
            response.Charset     = "utf-8";

            JsonHelper jsonHelper = new JsonHelper(content);

            ResultModel result = null;

            try
            {
                if (oType.ToLower() == "start")
                {
                    string apiKey      = jsonHelper.Read("apiKey");
                    string folio       = jsonHelper.Read("folio");
                    string jsonData    = jsonHelper.Read("jsonData");
                    string objectId    = jsonHelper.Read("ObjectId");;
                    string processCode = jsonHelper.Read("processCode");
                    int    loginId     = string.IsNullOrEmpty(jsonHelper.Read("loginId")) ? 0 : int.Parse(jsonHelper.Read("loginId"));

                    result = WorkFlowProcessService.StartProcess(processCode, loginId, objectId, folio, jsonData);
                }
                else if (oType.ToLower() == "approval")
                {
                    string apiKey       = jsonHelper.Read("apiKey");
                    string actionString = jsonHelper.Read("actionString");
                    string jsonData     = jsonHelper.Read("jsonData");
                    string memo         = jsonHelper.Read("memo");
                    string processCode  = jsonHelper.Read("processCode");
                    string sn           = jsonHelper.Read("sn");
                    int    loginId      = string.IsNullOrEmpty(jsonHelper.Read("loginId")) ? 0 : int.Parse(jsonHelper.Read("loginId"));
                    result = WorkFlowTaskService.ApproveK2Process(processCode, sn, loginId, actionString, memo, jsonData);
                }

                response.StatusCode = (int)HttpStatusCode.OK;

                if (result != null)
                {
                    if (result.Code == Common.Enum.ResultCode.Sucess)
                    {
                        response.Write("{\"result\":\"success\"} ");
                    }
                    else
                    {
                        response.Write("{\"result\":\"fail\", \"message\":" + result.Msg + "}");
                    }
                }
            }
            catch (Exception ex)
            {
                response.StatusCode = (int)HttpStatusCode.InternalServerError;
                response.Write("{\"result\":\"fail\", \"message\":" + ex.Message + "}");
            }
        }
Esempio n. 5
0
 public void WorkFlowTaskServiceConstructorTest()
 {
     WorkFlowTaskService target = new WorkFlowTaskService();
 }