コード例 #1
0
ファイル: RouteStep.cs プロジェクト: mountain-pier/framework
        private void SetRouteConnection(RouteStepConfig config, WorkflowContent content)
        {
            string nextStep = null;

            try
            {
                foreach (ConnectionConfig connection in config.Connections)
                {
                    bool isMatch = false;
                    var  plugIn  = AtawIocContext.Current.FetchInstance <IConnection>(connection.PlugName);
                    isMatch = plugIn.Match(WorkflowRow, content, Source);
                    if (isMatch)
                    {
                        nextStep = connection.NextStepName;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new NoRouteException(config, config.Error);
            }

            AtawDebug.AssertNotNull(nextStep, string.Format(ObjectUtil.SysCulture,
                                                            "路由步骤{0} 的下一个步骤不能为空", config.Name), this);
            //if (string.IsNullOrEmpty(nextStep))
            //{
            //    throw new NoRouteException(config, config.Error);
            //}
            //下一个步骤名
            WorkflowRow.WI_CUSTOM_DATA = nextStep;
        }
コード例 #2
0
        public void UpdateStep(Step step)
        {
            AtawDebug.AssertArgumentNull(step, "step", this);

            //if (CurrentStep != null)
            //    CurrentStep.Dispose();
            CurrentStep = step;
        }
コード例 #3
0
 public void OnReadXml()
 {
     AtawDebug.AssertNotNullOrEmpty(TableName, "表名不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(RegNameField, "注册名字段不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(TextField, "文本显示字段不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(ValueField, "值字段不能为空", this);
     //throw new System.NotImplementedException();
 }
コード例 #4
0
        public string GetDataValue(string regName, string key)
        {
            AtawDebug.AssertArgumentNullOrEmpty(regName, "亲,请求选择器数据源的注册名不可以为空哦", this);
            AtawDebug.AssertArgumentNullOrEmpty(regName, "亲,请求的值不可以为空哦", this);
            var    dt   = GetCodeTableInstance(regName);
            string _res = dt[key].CODE_TEXT;

            return(ReturnJson(_res));
        }
コード例 #5
0
        public string FillData(string regName)
        {
            AtawDebug.AssertArgumentNullOrEmpty(regName, "亲,请求选择器数据源的注册名不可以为空哦", this);
            // regName = regName ?? "";
            var dt  = GetCodeTableInstance(regName);
            var res = dt.FillData(null);

            return(ReturnJson(res == null ? new List <CodeDataModel>() : res.ToList()));
        }
コード例 #6
0
ファイル: State.cs プロジェクト: mountain-pier/framework
        protected T GetStep <T>(Step step) where T : Step
        {
            AtawDebug.AssertArgumentNull(step, "step", this);

            T result = step as T;

            AtawDebug.AssertNotNull(result, string.Format(ObjectUtil.SysCulture,
                                                          "当前的Step类型必须{0},而现在却是{1}", typeof(T), step.GetType()), this);
            return(result);
        }
コード例 #7
0
        public static WorkflowContent CreateContent(WF_WORKFLOW_INST row)
        {
            string contentXml = row.WI_CONTENT_XML;

            AtawDebug.AssertNotNullOrEmpty(contentXml, string.Format(ObjectUtil.SysCulture,
                                                                     "ID为{0},模式为{1}的工作流没有设置ContentXml", row.WI_ID, row.WI_WD_NAME), null);

            WorkflowContent content = XmlUtil.ReadFromString <WorkflowContent>(contentXml);

            return(content);
        }
コード例 #8
0
        public string MethodList(string resolvers, string data)
        {
            string[] list = resolvers.Split(',');
            Dictionary <string, IMethod> methods = new Dictionary <string, IMethod>();
            NameValueCollection          nvl     = getNameValueCollection();

            AtawDebug.AssertArgument(list.Length > 0, "resolvers", "请求插件名集合不可以为空", this);
            for (int i = 0; i < list.Length; i++)
            {
                var _method = list[i].PlugGet <IMethod>();
                _method.Params = nvl;
                methods.Add(list[i], _method);
            }
            //--------
            var _list = methods.OrderBy(a => a.Value.Order).ToList();

            _list.ForEach((a) => {
                a.Value.Before();
            });

            Dictionary <string, object> olist = new Dictionary <string, object>();

            _list.ForEach((a) =>
            {
                a.Value.Exe();
                olist.Add(a.Key, a.Value.ResultObj);
            });

            int resInt = 0;
            var _db    = AtawAppContext.Current.PageFlyweight.Get <IUnitOfData>("MethodList_IUnitOfData");

            if (_db != null)
            {
                resInt = _db.Submit();
            }


            for (int i = 0; i < _list.Count; i++)
            {
                // var _obj = _list[i].Value.ResultObj;
                _list[i].Value.After(resInt, olist);
            }

            return(ReturnJson(olist));
        }
コード例 #9
0
        public string RowNumForm(string ds, string xml, string form)
        {
            xml = Xml(xml);
            AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
            ModuleConfig mc   = xml.SingletonByPage <ModuleConfig>();
            var          tool = GetPageViewTool(mc);

            tool.BeginSearchFormInterceptor(ref ds, ref xml, ref form, ref mc);
            mc = xml.SingletonByPage <ModuleConfig>();
            AtawBasePageViewCreator pageCreator = ("ModulePageView").SingletonByPage <AtawBasePageViewCreator>();

            pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), "", form, false);
            var apcv = pageCreator.Create();

            apcv.RegName = xml;

            return(tool.EndSearchFormInterceptor(apcv));
            //return "";
        }
コード例 #10
0
        public string GetDataValueList(string regName, string key)
        {
            AtawDebug.AssertArgumentNullOrEmpty(regName, "亲,请求选择器数据源的注册名不可以为空哦", this);
            AtawDebug.AssertArgumentNullOrEmpty(regName, "亲,请求的值不可以为空哦", this);
            var dt = GetCodeTableInstance(regName);
            Dictionary <string, string> dict = new Dictionary <string, string>();

            string[] keys = key.Split(',');

            keys.ToList().ForEach((a) => {
                var _bean = dt[a];
                if (_bean != null)
                {
                    dict.Add(_bean.CODE_VALUE, _bean.CODE_TEXT);
                }
                // dict.Add();
            });

            return(ReturnJson(dict));
        }
コード例 #11
0
        public string ModulePage(string ds, string xml, string keyValue)
        {
            xml = Xml(xml);
            AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
            ModuleConfig mc = xml.SingletonByPage <ModuleConfig>();

            mc.Mode = ModuleMode.None;
            var tool = GetPageViewTool(mc);

            tool.BeginModulePageInterceptor(ref ds, ref xml, ref keyValue, ref mc);

            AtawBasePageViewCreator pageCreator = ("Module" + "PageView").SingletonByPage <AtawBasePageViewCreator>();

            pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), keyValue, "", false);
            var apcv = pageCreator.Create();

            apcv.RegName = xml;

            return(tool.EndModulePageInterceptor(apcv));
        }
コード例 #12
0
        public AtawPageConfigView getPageView(string xml, string pageStyle)
        {
            string ds       = "";
            string keyValue = "";

            xml = Xml(xml);
            AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
            ModuleConfig mc = xml.PlugGet <ModuleConfig>();

            if (mc.Mode == ModuleMode.None)
            {
                throw new AtawException("ModuleXml的Mode节点不能为空", this);
            }

            var tool = GetPageViewTool(mc);

            tool.BeginModuleInterceptor(ref ds, ref xml, ref pageStyle, ref keyValue, ref mc);


            mc = xml.SingletonByPage <ModuleConfig>();
            if (!AtawBasePageViewCreator.IsSupportPage(mc.SupportPage, pageStyle.Value <PageStyle>()))
            {
                JsResponseResult <object> ree = new JsResponseResult <object>()
                {
                    ActionType = JsActionType.Alert,
                    Content    = "无权访问该页面"
                };
                // return null;
            }


            AtawBasePageViewCreator pageCreator = (pageStyle + "PageView").PlugGet <AtawBasePageViewCreator>();

            // AtawAppContext.Current.FastJson.ToJSON(ds ?? "");

            pageCreator.Initialize(mc, ds.SafeJsonObject <DataSet>(), keyValue, "", false);
            var apcv = pageCreator.Create();

            apcv.RegName = xml;
            return(apcv);
        }
コード例 #13
0
        private ActionResult ReDirectAction(string name, object[] parameters)
        {
            Type       p = this.GetType();
            MethodInfo m = p.GetMethod(name);

            AtawDebug.AssertNotNull(m, string.Format(ObjectUtil.SysCulture, "不能找到名为{0}的Action", name), this);
            var result = m.Invoke(this, null);

            if (result is string)
            {
                return new ContentResult()
                       {
                           Content = result.ToString()
                       }
            }
            ;
            else
            {
                return(result as ActionResult);
            }
        }
コード例 #14
0
ファイル: MergeStep.cs プロジェクト: mountain-pier/framework
        public override State GetState(StepState state)
        {
            switch (state)
            {
            case StepState.NotReceive:
                return(MergeNRState.Instance);

            case StepState.ReceiveNotOpen:
                return(MergeRNOState.Instance);

            case StepState.OpenNotProcess:
                return(MergeONPState.Instance);

            case StepState.ProcessNotSend:
                return(MergePNSState.Instance);

            default:
                AtawDebug.ThrowImpossibleCode(this);
                return(null);
            }
        }
コード例 #15
0
 private Workflow(string workflowId, IUnitOfData workflowSource)
     : this(workflowSource)
 {
     //Source = workflowSource;
     WorkflowDbContext dbContext = workflowSource as WorkflowDbContext;
     WF_WORKFLOW_INST  row       = dbContext.WF_WORKFLOW_INST.FirstOrDefault(a => a.WI_ID == workflowId);
     AtawDebug.AssertNotNull(row, "该流程已处理或异常,请进历史页面查看", this);
     WorkflowId  = row.WI_ID;
     WorkflowRow = row;
     Config      = WorkflowConfig.GetByName(row.WI_WD_NAME, workflowSource);
     //WorkflowConfig.ConnString =
     StepConfig stepConfig = Config.Steps[row.WI_CURRENT_STEP];
     if (stepConfig != null)
     {
         CurrentStep  = stepConfig.CreateStep(this);
         CurrentState = CurrentStep.GetState(row.WI_STATUS.Value <StepState>());
     }
     else
     {
         throw new AtawException("不存在的步骤" + row.WI_CURRENT_STEP, this);
     }
 }
コード例 #16
0
ファイル: MyWork.cs プロジェクト: mountain-pier/framework
        public string WorkflowProcess(string wid, DataSet PostDataSet)
        {
            Workflow.Core.Workflow wf = Workflow.Core.Workflow.CreateWorkflow(context, wid);
            WorkflowConfig.ConnString = PlugAreaRegistration.CONN;
            ManualStepConfig config = wf.CurrentStep.Config as ManualStepConfig;

            AtawDebug.AssertNotNull(config, "调用时机有误,当前的步骤必须是人工步骤,现在不是", this);

            WorkflowContent content = WorkflowInstUtil.CreateContent(wf.WorkflowRow);

            if (!string.IsNullOrEmpty(config.Process.UIOperation.RegName))
            {
                UIProcessor processor = AtawIocContext.Current.FetchInstance <UIProcessor>(
                    config.Process.UIOperation.PlugIn);
                processor.Config  = config;
                processor.Source  = context;
                processor.Content = content;

                processor.UIData = PostDataSet;
                processor.Execute(wf.WorkflowRow);
                WorkflowInstUtil.ManualSendWorkflow(wf.WorkflowRow, GlobalVariable.UserId, processor);
            }
            else
            {
                wf.WorkflowRow.WI_PROCESS_ID   = GlobalVariable.UserId.ToString();
                wf.WorkflowRow.WI_PROCESS_DATE = context.Now;
                wf.WorkflowRow.WI_STATUS       = (int)StepState.ProcessNotSend;
            }
            //context.Submit();
            wf.UpdateState(ManualPNSState.Instance);
            string url = wf.GetWorkflowUrl();
            JsResponseResult <string> res = new JsResponseResult <string>()
            {
                ActionType = JsActionType.Url,
                Content    = url
            };

            return(res.ToJSON());
        }
コード例 #17
0
ファイル: ManualStep.cs プロジェクト: mountain-pier/framework
        public bool Back(string backStepName)
        {
            ManualStepConfig manualConfig = Config as ManualStepConfig;

            // var backStepName = string.Empty;
            if (manualConfig.HaveBack)
            {
                if (backStepName.IsAkEmpty())
                {
                    // 否则退到上一人工步骤,如果没有则报错
                    backStepName = WorkflowRow.WI_LAST_MANUAL;
                }
                AtawDebug.AssertNotNullOrEmpty(backStepName, string.Format(ObjectUtil.SysCulture,
                                                                           "人工步骤{0}没有可以回退的上一个人工步骤", manualConfig.Name), this);
            }

            StepConfig backStep = Config.Parent.Steps[backStepName];

            AtawDebug.AssertArgumentNull(backStep, string.Format(ObjectUtil.SysCulture,
                                                                 "指定的人工步骤{0} 不存在", backStepName), this);
            return(StepUtil.BackStep(Workflow, backStep));
        }
コード例 #18
0
        public string LoadPage(string regName, string pageStyle, string xml, string ds)
        {
            SetPostDataSet(ds);
            string moduleXml = xml;

            if (xml.IsEmpty())
            {
                var singleCodeTable = AtawIocContext.Current.FetchInstance <CodeTable <CodeDataModel> >(regName) as SingleCodeTable <CodeDataModel>;
                if (singleCodeTable != null)
                {
                    moduleXml = singleCodeTable.ModuleXml;
                }
                AtawDebug.AssertNotNull(moduleXml, string.Format("插件名为{0}的CodeTable需要配置ModuleXml", regName), this);
            }
            moduleXml = Xml(moduleXml);
            ModuleConfig mc = moduleXml.SingletonByPage <ModuleConfig>();

            var tool = GetPageViewTool(mc);
            // string ds = "";
            string keyValue = "";

            tool.BeginModuleInterceptor(ref ds, ref moduleXml, ref pageStyle, ref keyValue, ref mc);

            AtawBasePageViewCreator pageCreator = (pageStyle + "PageView").SingletonByPage <AtawBasePageViewCreator>();

            pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), "", "", false);
            var apcv = pageCreator.Create();

            apcv.RegName = moduleXml;
            //(apcv as AtawListPageConfigView).PageSelector = new PageSelector()
            //{

            //    ValueField = singleCodeTable.ValueField,
            //    TextField = singleCodeTable.TextField
            //};
            // return ReturnJson(apcv);
            return(tool.EndModuleInterceptor(apcv));
        }
コード例 #19
0
        public string Right(string ds, string xml, string keyValue)
        {
            AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
            ModuleConfig mc = xml.SingletonByPage <ModuleConfig>();

            mc.Mode = ModuleMode.None;
            IDeskMergeBuilder deskBuilder = AtawIocContext.Current.FetchInstance <IDeskMergeBuilder>("Core");
            var deskForms = deskBuilder.GetUserDeskFormList();
            List <BaseFormConfig> mForms = new List <BaseFormConfig>();

            foreach (var form in mc.Forms)
            {
                var dForm = deskForms.FirstOrDefault(a => a.FormName == form.Name);
                if (dForm != null)
                {
                    form.Order = dForm.Order.ToString();
                    //form.Width = dForm.
                    mForms.Add(form);
                }
                else
                {
                    mForms.Add(form);
                }
            }
            mc.Forms = mForms.OrderBy(a => a.Order.Value <int>()).ToList();

            AtawBasePageViewCreator pageCreator = ("Module" + "PageView").SingletonByPage <AtawBasePageViewCreator>();

            pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), keyValue, "", false);
            var apcv = pageCreator.Create();

            apcv.RegName = xml;

            apcv.ExtData = GetDeskData(deskBuilder);
            return(ReturnJson(apcv));
        }
コード例 #20
0
        public ActionResult Page(string pagestyle, string path)
        {
            path = path.Replace("$", "/");
            bool isPageStyle = false;

            foreach (var en in Enum.GetValues(typeof(PageStyle)))
            {
                if (en.ToString().ToUpper() == pagestyle.ToUpper())
                {
                    pagestyle   = en.ToString();
                    isPageStyle = true;
                    break;
                }
            }
            AtawDebug.Assert(isPageStyle, string.Format(ObjectUtil.SysCulture, PAGESTYLE_ASSERT, pagestyle), this);
            var flyw = AtawAppContext.Current.PageFlyweight.PageItems;

            flyw["pagestyle"] = pagestyle;
            flyw["path"]      = path;

            //flyw["data"] = Module("", "", path, pagestyle, "").Encode();
            // return View("~/Areas/ProjectProgress/Views/Module.cshtml");
            return(View("~/Views/Module.cshtml"));
        }
コード例 #21
0
        public void UpdateState(State state)
        {
            AtawDebug.AssertArgumentNull(state, "state", this);

            CurrentState = state;
        }
コード例 #22
0
ファイル: ManualStep.cs プロジェクト: mountain-pier/framework
        public bool ProcessManualWorkflow(WF_WORKFLOW_INST workflowRow, string userId)
        {
            WorkflowDbContext dbContext = Source as WorkflowDbContext;
            StepState         state     = (StepState)workflowRow.WI_STATUS;

            switch (state)
            {
            case StepState.NotReceive:
                // NR:
                // 检查userId是否在接受人列表中,是接收并打开,返回true,否则返回false
                //如果接受人有多个,你只是其中的一个,并且你是上个流程的处理者,不能接收 这一点可以根据配置来.....
                string      receiveIds = workflowRow.WI_RECEIVE_LIST;
                QuoteIdList ulReceive  = QuoteIdList.LoadFromString(receiveIds);
                if (ulReceive.Contains(userId))
                {
                    bool   _isAppAutoStep = "WrokflowAutoStep".AppKv <bool>(false);
                    string _ManualAskUser = AtawAppContext.Current.GetItem("ManualAskUser").Value <string>();
                    if (ulReceive.Count > 0 && (_ManualAskUser == userId) && !_isAppAutoStep)
                    {
                        //.............
                        return(false);
                    }
                    else
                    {
                        workflowRow.WI_RECEIVE_ID   = userId;
                        workflowRow.WI_STATUS       = (int)StepState.OpenNotProcess;
                        workflowRow.WI_RECEIVE_DATE = dbContext.Now;
                        Source.Submit();
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }

            case StepState.ReceiveNotOpen:
                // RNO:
                // 检查接收人是否是userId,是打开,返回true,否则返回false
                if (userId == workflowRow.WI_RECEIVE_ID)
                {
                    workflowRow.WI_STATUS = (int)StepState.OpenNotProcess;
                    Source.Submit();
                    return(true);
                }
                else
                {
                    return(false);
                }

            case StepState.OpenNotProcess:
                // ONP:
                // 检查接收人是否是userId,是返回true,否则返回false
                return(userId == workflowRow.WI_RECEIVE_ID);

            default:
                AtawDebug.ThrowImpossibleCode(this);
                break;
            }

            return(false);
        }
コード例 #23
0
        public override BaseOptions Create()
        {
            //BaseOptions.DataObject = "";
            BaseOptions.IsKey           = this.Config.IsKey;
            BaseOptions.IsParentColumn  = this.Config.IsParentColumn;
            BaseOptions.IsReadOnly      = this.Config.IsReadOnly;
            BaseOptions.RegName         = this.Config.RegName;
            BaseOptions.DetialFormatFun = this.Config.DetialFormatFun;
            BaseOptions.DisplayName     = this.Config.DisplayName;
            BaseOptions.Prompt          = this.Config.Prompt;
            BaseOptions.ValPrompt       = this.Config.ValPrompt;

            string tableName       = this.FormView.TableName;
            string colName         = this.Config.Name;
            string insertTableName = tableName + "_INSERT";

            if (PageStyle == PageStyle.Insert) //新增的时候如果存在默认值,将构造一张新表存放默认值,新表名为原表名加上"_INSERT"后缀
            {
                if (!this.Config.DefaultValueStr.IsEmpty())
                {
                    if (!this.PageView.Data.Tables.Contains(insertTableName))
                    {
                        this.PageView.Data.Tables.Add(insertTableName);
                    }
                    var dt = this.PageView.Data.Tables[insertTableName];
                    if (!dt.Columns.Contains(colName))
                    {
                        dt.Columns.Add(colName);
                    }
                    if (dt.Rows.Count == 0)
                    {
                        var row = dt.NewRow();
                        row[colName] = this.Config.DefaultValueStr.Replace("\n        ", "");
                        dt.Rows.Add(row);
                    }
                    else
                    {
                        dt.Rows[0][colName] = this.Config.DefaultValueStr.Replace("\n        ", "");
                    }
                    BaseOptions.DataValue          = new JsDataValue(insertTableName, colName);
                    BaseOptions.DataValue.IsChange = true;
                }
            }
            else
            {
                BaseOptions.DataValue = new JsDataValue(tableName, colName);
            }
            if (PageStyle != PageStyle.List && PageStyle != PageStyle.Detail)
            {
                PostSetting ps = new PostSetting()
                {
                    TableName = tableName, ColumnName = colName
                };
                BaseOptions.PostSetting = ps;
            }
            if (PageStyle == PageStyle.Insert || PageStyle == PageStyle.Update)
            {
                if (Config.ControlLegal != null)
                {
                    var    kind     = Config.ControlLegal.Kind;
                    string legalFun = Config.ControlLegal.CustomLegalFun;
                    string reg      = Config.ControlLegal.Reg;
                    string errMsg   = Config.ControlLegal.ErrMsg;
                    if (kind == LegalKind.custom && legalFun.IsEmpty())
                    {
                        AtawDebug.AssertNotNullOrEmpty(legalFun, "自定义验证控件时,需要在CustomLegalFun节点指定一个自定义函数", this);
                    }
                    else if (kind == LegalKind.customReg && reg.IsEmpty())
                    {
                        AtawDebug.AssertNotNullOrEmpty(reg, "正则表达式验证控件时,需要在Reg节点指定一个正则表达式", this);
                    }
                    else if (!legalFun.IsEmpty())
                    {
                        kind = LegalKind.custom;
                    }
                    else if (!reg.IsEmpty())
                    {
                        kind = LegalKind.customReg;
                    }
                    AtawDebug.Assert(legalFun.IsEmpty() || reg.IsEmpty(), "只需指定一种控件验证方式,现在既配置了自定义验证,又配置了正则表达式验证", this);
                    ControlLegal cl = new ControlLegal()
                    {
                        Kind            = kind,
                        CustomLegalFun  = legalFun,
                        Reg             = reg,
                        ErrMsg          = errMsg,
                        LegalExpression = this.Config.ControlLegal.LegalExpression
                    };
                    BaseOptions.Legal = cl;
                }
            }
            return(BaseOptions);
        }
コード例 #24
0
        public string Module(string ds, string xml, string pageStyle, string keyValue)
        {
            try
            {
                xml = Xml(xml);
                AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
                ModuleConfig mc = xml.SingletonByPage <ModuleConfig>();
                if (mc.Mode == ModuleMode.None)
                {
                    throw new AtawException("ModuleXml的Mode节点不能为空", this);
                }

                var tool = GetPageViewTool(mc);
                tool.BeginModuleInterceptor(ref ds, ref xml, ref pageStyle, ref keyValue, ref mc);

                //if (!AtawAppContext.Current.IsAuthenticated)
                //{
                //    JsResponseResult<object> ree = new JsResponseResult<object>()
                //    {
                //        ActionType = JsActionType.Alert,
                //        Content = "请登录,匿名暂不开放...."
                //    };
                //    return FastJson(ree);
                //}
                mc = xml.SingletonByPage <ModuleConfig>();
                if (!AtawBasePageViewCreator.IsSupportPage(mc.SupportPage, pageStyle.Value <PageStyle>()))
                {
                    JsResponseResult <object> ree = new JsResponseResult <object>()
                    {
                        ActionType = JsActionType.Alert,
                        Content    = "无权访问该页面"
                    };
                    return(FastJson(ree));
                }
                bool isXml2Db = AtawAppContext.Current.ApplicationXml.IsMigration && !mc.IsNoDb;
                if (isXml2Db && mc.DataBase == null)
                {
                    mc.Forms.Cast <FormConfig>().ToList().ForEach(a =>
                    {
                        var dataForm = a.File.XmlConfig <DataFormConfig>();
                        AtawAppContext.Current.Xml2Db.Migrations(dataForm);
                    }
                                                                  );
                }

                if (isXml2Db)
                {
                    AtawTrace.WriteFile(LogType.DatabaseStructure, AtawAppContext.Current.Xml2Db.GetLogMessage());
                    var dbContext = AtawAppContext.Current.UnitOfData;
                    if (dbContext != null)
                    {
                        AtawAppContext.Current.UnitOfData.Submit();
                        AtawAppContext.Current.UnitOfData = null;
                    }
                }

                AtawBasePageViewCreator pageCreator = (pageStyle + "PageView").SingletonByPage <AtawBasePageViewCreator>();
                pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), keyValue, "", false);
                var apcv = pageCreator.Create();
                apcv.RegName = xml;


                return(tool.EndModuleInterceptor(apcv));
            }
            catch (Exception ex)
            {
                RecoredException(ex);
                AtawPageConfigView apcv = new AtawPageConfigView();
                apcv.Header         = new PageHeader();
                apcv.Header.IsValid = false;
                apcv.Header.Message = "<h2>系统出现异常,请跟管理员联系!</h2><p>异常信息是:{0}</p>".AkFormat(ex.Message);
                return(ReturnJson(apcv));
            }
            //return ReturnJson(apcv);
        }
コード例 #25
0
ファイル: EndStep.cs プロジェクト: mountain-pier/framework
 protected override void Send(StepConfig nextStep)
 {
     AtawDebug.ThrowAtawException(string.Format(ObjectUtil.SysCulture,
                                                "工作流{1}的结束步骤{0}没有Send操作", Config.Parent.Name, Config.Name), this);
 }
コード例 #26
0
        public ListPageExcelCreator()
        {
            NameValueCollection nvc = (NameValueCollection)AtawAppContext.Current.GetItem("querystring");



            string ds       = nvc["ds"] ?? "";
            string keyValue = nvc["keyvalue"] ?? "";

            ModuleXml = nvc["xml"] ?? "";
            string xml = ModuleXml;
            // xml = Xml(xml);
            string pageStyle = nvc["pageStele"] ?? "List";

            xml = Xml(xml);
            AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", this);
            ModuleConfig mc = xml.PlugGet <ModuleConfig>();

            if (mc.Mode == ModuleMode.None)
            {
                throw new AtawException("ModuleXml的Mode节点不能为空", this);
            }

            var tool = GetPageViewTool(mc);

            tool.BeginModuleInterceptor(ref ds, ref xml, ref pageStyle, ref keyValue, ref mc);


            mc = xml.SingletonByPage <ModuleConfig>();
            if (!AtawBasePageViewCreator.IsSupportPage(mc.SupportPage, pageStyle.Value <PageStyle>()))
            {
                JsResponseResult <object> ree = new JsResponseResult <object>()
                {
                    ActionType = JsActionType.Alert,
                    Content    = "无权访问该页面"
                };
                // return null;
            }


            AtawBasePageViewCreator pageCreator = (pageStyle + "PageView").PlugGet <AtawBasePageViewCreator>();

            pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), keyValue, "", false);
            var apcv = pageCreator.Create();

            apcv.RegName = xml;

            //清空数据.....
            mc.Forms.Cast <FormConfig>().ToList().ForEach(a =>
            {
                string name = a.DataPlug;
                AtawAppContext.Current.PageFlyweight.Remove <IListDataTable>(a.DataPlug, a.Name);
            });


            var    __apcv     = apcv as AtawListPageConfigView;
            string _formName  = __apcv.ListFormName;
            string _tableName = __apcv.Forms[_formName].TableName;

            this.Table = apcv.Data.Tables[_tableName];
            apcv.createFillDataSet(__apcv.ListFormName);
            this.ColumnList = new List <ColumnItem>();
            apcv.Forms[_formName].Columns.ForEach((col) =>
            {
                if (col.ControlType != ControlType.Hidden)
                {
                    this.ColumnList.Add(new ColumnItem()
                    {
                        Name  = col.Name,
                        Title = col.DisplayName
                    });
                }
            });

            this.FileName = __apcv.Title + "列表";
        }