public void OnReadXml()
 {
     AtawDebug.AssertNotNullOrEmpty(TableName, "表名不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(RegNameField, "注册名字段不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(TextField, "文本显示字段不能为空", this);
     AtawDebug.AssertNotNullOrEmpty(ValueField, "值字段不能为空", this);
     //throw new System.NotImplementedException();
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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 "";
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
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));
        }
        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);
        }
Exemplo n.º 9
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 + "列表";
        }
Exemplo n.º 10
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);
        }