Example #1
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 "";
        }
Example #2
0
        public static AtawPageConfigView Module(string data, string ds, string xml, string pageStyle, string keyValue)
        {
            //AtawDebug.AssertNotNullOrEmpty(xml, "亲 ,modulexml 注册名不可以为空的", controller);
            ModuleConfig mc = xml.SingletonByPage <ModuleConfig>();

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

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

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

            apcv.RegName = xml;

            return(apcv);
        }
Example #3
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));
        }
Example #4
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);
        }
        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));
        }
Example #6
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));
        }
Example #7
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 + "列表";
        }
Example #8
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);
        }