Beispiel #1
0
 public Dictionary<string, string> GetDealMethods(string businessType)
 {
     try
     {
         return WfTemplateDataBusiness.GetDealMethods(businessType);
     }
     catch (Exception exception)
     {
         var info = new ErrorInfo { Message = "加载处理方法数据出现异常:" + exception.Message };
         LogWritter.WriteSystemExceptionLog(exception);
         throw new FaultException<ErrorInfo>(info, info.Message);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 取角色数据
 /// </summary>
 /// <param name="templateId">流程模板ID</param>
 /// <param name="wfObjectId">流程对象Id </param>
 /// <returns></returns>
 public List<RoleInfo> GetRoleData(string templateId, string wfObjectId)
 {
     try
     {
         var result = Interfaces.GetRoleData(templateId, wfObjectId);
         return Interfaces.GetRoleDataForSl(result);
     }
     catch (Exception exception)
     {
         var info = new ErrorInfo { Message = "加载角色信息数据出现异常:" + exception.Message };
         LogWritter.WriteSystemExceptionLog(exception);
         throw new FaultException<ErrorInfo>(info, info.Message);
     }
 }
Beispiel #3
0
 public string GetXmlTemplatebyTemplateId(string templateId)
 {
     try
     {
         return WfTemplateDataBusiness.GetXmlTemplatebyTemplateId(templateId);
     }
     catch (Exception exception)
     {
         var info = new ErrorInfo { Message = "加载模板出现异常:" + exception.Message };
         LogWritter.WriteSystemExceptionLog(exception);
         throw new FaultException<ErrorInfo>(info, info.Message);
     }
 }
Beispiel #4
0
 public bool GetWfTemplateExist(string templateName, string version, string businessType)
 {
     try
     {
         return WfTemplateDataBusiness.IsExist(templateName, version, businessType);
     }
     catch (Exception exception)
     {
         var info = new ErrorInfo { Message = "查询模板版本出现异常:" + exception.Message };
         LogWritter.WriteSystemExceptionLog(exception);
         throw new FaultException<ErrorInfo>(info, info.Message);
     }
 }
Beispiel #5
0
        public SaveResult SaveWfTemplateXml(string xmlBase64)
        {
            try
            {
                var result = new SaveResult();
                if (string.IsNullOrEmpty(xmlBase64))
                {
                    result.Result = false;
                    result.Message = "输入字符串为空!";
                    return result;
                }
                var template = new WfTemplateDataEntity();
                template.Creater = Guid.Empty;
                template.CreateTime = DateTime.Now;
                template.TemplateData = xmlBase64;
                var xElement = WorkFlowFromXml.GetXElementFromXml(Convert.FromBase64String(xmlBase64));

                using (TransactionScope scope = new TransactionScope())
                {
                    var wf =
                        WfTemplateDataBusiness.GetWfTemplateDataByTemplateID(
                            new Guid(WorkFlowFromXml.GetXElementAttribute(xElement, "UniqueID")));
                    if (wf != null) //对已有模板的修改
                    {
                        if (wf.IsEnable) //启用中的模板不允许修改
                        {
                            result.Result = false;
                            result.Message = "该模板正在启用中,不允许修改!";
                            return result;
                        }
                        else
                        {
                            WfTemplateDataBusiness.DeleteByPrimaryKey(wf.TemplateID);
                        }
                    }

                    template.TemplateID = Guid.NewGuid();
                    template.TemplateName = WorkFlowFromXml.GetXElementAttribute(xElement, "Name");
                    template.TemplateVersion = WorkFlowFromXml.GetXElementAttribute(xElement, "Version");
                    template.BusinessType = WorkFlowFromXml.GetXElementAttribute(xElement, "BusinessType");
                    template.TemplateType = "xmlTemplate";

                    var wftemplate = new WfTemplateDataEntity(template.TemplateID, template.TemplateName,
                                                              template.TemplateVersion, template.TemplateData,
                                                              template.CreateTime,
                                                              template.Creater, template.IsEnable, template.TemplateType,
                                                              template.IsDeleted, template.ModifyTime,
                                                              template.ModifyPerson, template.BusinessType,
                                                              template.StartDeptLevel, template.DepartmentId);
                    var workflow = WorkFlowFromXml.GetWfXamlFromXml(xElement, wftemplate);
                    template.StartDeptLevel = wftemplate.StartDeptLevel;
                    workflow.TemplateType = "xamlTemplate";
                    WfTemplateDataBusiness.Add(template);
                    WfTemplateDataBusiness.Add(workflow);

                    scope.Complete();
                    result.Result = true;
                    result.Message = "成功!";
                    return result;
                }
            }
            catch (Exception exception)
            {
                var info = new ErrorInfo { Message = "保存模板出现错误:" + exception.Message };
                LogWritter.WriteSystemExceptionLog(exception);
                throw new FaultException<ErrorInfo>(info, info.Message);
            }
        }