public async Task ProcessAsync_InvalidheadingLevelThrowsInvalidOperationException(int level)
        {
            // Arrange
            var panelContext = new PanelContext();

            var context = new TagHelperContext(
                tagName: "govuk-panel-title",
                allAttributes: new TagHelperAttributeList(),
                items: new Dictionary <object, object>()
            {
                { typeof(PanelContext), panelContext }
            },
                uniqueId: "test");

            var output = new TagHelperOutput(
                "govuk-panel-title",
                attributes: new TagHelperAttributeList(),
                getChildContentAsync: (useCachedResult, encoder) =>
            {
                var tagHelperContent = new DefaultTagHelperContent();
                tagHelperContent.SetHtmlContent("Title");
                return(Task.FromResult <TagHelperContent>(tagHelperContent));
            });

            var tagHelper = new PanelTitleTagHelper()
            {
                HeadingLevel = level
            };

            // Act & Assert
            var ex = await Assert.ThrowsAsync <InvalidOperationException>(() => tagHelper.ProcessAsync(context, output));

            Assert.Equal("The 'heading-level' attribute must be between 1 and 6.", ex.Message);
        }
            public AppearanceOptions GetAppearanceOptions([NotNull] ContentEditor contentEditor)
            {
                Assert.ArgumentNotNull(contentEditor, nameof(contentEditor));

                var options = AppHost.Settings.Options;

                var skinName = SkinName;

                if (string.IsNullOrEmpty(skinName))
                {
                    skinName = options.Skin ?? string.Empty;
                }

                var result = new AppearanceOptions
                {
                    ContentEditor      = contentEditor,
                    SkinName           = skinName,
                    StandardFields     = options.ShowStandardFields,
                    RawValues          = options.ShowRawValues,
                    FieldInformation   = options.ShowFieldInformation,
                    FieldDisplayTitles = options.ShowFieldDisplayTitles
                };

                var panelContext = new PanelContext(result.Skin, contentEditor.ContentModel);

                result.Panels = Panels.Select(d => d.Panel).Where(p => p.CanRender(panelContext));

                return(result);
            }
        public async Task ProcessAsync_ItemAlreadyHasTitleThrowsInvalidOperationException()
        {
            // Arrange
            var panelContext = new PanelContext();

            panelContext.TrySetHeading(headingLevel: null, content: new HtmlString("Existing title"));

            var context = new TagHelperContext(
                tagName: "govuk-panel-title",
                allAttributes: new TagHelperAttributeList(),
                items: new Dictionary <object, object>()
            {
                { typeof(PanelContext), panelContext }
            },
                uniqueId: "test");

            var output = new TagHelperOutput(
                "govuk-panel-title",
                attributes: new TagHelperAttributeList(),
                getChildContentAsync: (useCachedResult, encoder) =>
            {
                var tagHelperContent = new DefaultTagHelperContent();
                tagHelperContent.SetHtmlContent("Title");
                return(Task.FromResult <TagHelperContent>(tagHelperContent));
            });

            var tagHelper = new PanelTitleTagHelper();

            // Act & Assert
            var ex = await Assert.ThrowsAsync <InvalidOperationException>(() => tagHelper.ProcessAsync(context, output));

            Assert.Equal("Cannot render <govuk-panel-title> here.", ex.Message);
        }
示例#4
0
        public override object Do(PanelContext data)
        {
            string         tag      = data.Objects["tag"] as string;
            List <DataKey> dataKeys = data.State as List <DataKey>;

            if (!String.IsNullOrEmpty(tag) && dataKeys != null)
            {
                foreach (DataKey key in dataKeys)
                {
                    string  id = key["ID"] as string;
                    Article a  = ArticleHelper.GetArticle(id, null);
                    if (a != null)
                    {
                        a.Tags += String.Format("'{0}'", tag);
                        if (!String.IsNullOrEmpty(a.ModelXml))
                        {
                            DataSet ds = BaseDataProvider.CreateDataSet(data.Model);
                            BaseDataProvider.ReadXml(ds, a.ModelXml);

                            if (ds.Tables[data.Table.Name].Rows.Count > 0 && ds.Tables[data.Table.Name].Columns.Contains("Tags"))
                            {
                                ds.Tables[data.Table.Name].Rows[0]["Tags"] = a.Tags;
                                a.ModelXml = BaseDataProvider.GetXml(ds);
                            }
                        }

                        AddTagToSingleTable(data, id, a.Tags);
                        ArticleHelper.UpdateArticle(a, new string[] { "Tags", "ModelXml" });
                    }
                }
            }
            UIHelper.SendMessage("添加标签成功");
            CacheRecord.Create(data.ModelName).Release();
            return(false);
        }
示例#5
0
        private void Search(IQueryCondition condition, TableInfo ti, MoldPanel mp)
        {
            #region 木有启用单表存储(适用于旧版本) 处理逻辑
            //xml解析字段
            PanelContext data = mp.GetPanelContext(condition.ModelName, "list");
            data.PageIndex = condition.Page;
            data.c         = new Criteria(CriteriaType.Equals, "ModelName", condition.ModelName); //设置条件
            if (condition.Condition != null)
            {
                data.c.Criterias.Add(condition.Condition);
            }

            ListResult result = new QueryCommand().Do(data) as ListResult;
            if (result != null)
            {
                DataTable dt = result.DataTable.Clone();
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    string name    = dt.Columns[i].ColumnName.Clone().ToString();
                    bool   isExist = FiledExists(condition.Fields, name);
                    if (!isExist)
                    {
                        result.DataTable.Columns.Remove(name);
                    }
                }
                //todo:XML数据源过滤信息?
                ti.Table = result.DataTable;
                string json = ti.ToJson();
                condition.total = result.RecoredCount;
                condition.Page  = result.PageIndex;
                condition.JsonMessage.Add(Enum_operType.Seach.ToString(), json.Replace("{0}", condition.total.ToString()).Replace("{1}", "200").Replace("{2}", "数据成功返回").Replace("{3}", condition.Page.ToString()).Replace("{4}", condition.totalPage.ToString()));  //查询结果特殊处理
            }
            #endregion
        }
示例#6
0
        public System.Data.DataRow Get(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);
            DataTable     dt     = helper.Query(CreatePKCriteria(data.DataKey), CreateOrders(data.Orders), 0, 0);

            return(dt.Rows.Count > 0 ? dt.Rows[0] : dt.NewRow());
        }
示例#7
0
 void AddTagToSingleTable(PanelContext data, string id, string tag)
 {
     if (DbHelper.CheckColumnsExits(data.Table.Name, "Tags"))
     {
         DbHelper.ExecuteSql(String.Format("UPDATE [{0}] SET [Tags]='{1}' WHERE [ID]='{2}'", data.Table.Name, tag.Replace("'", "''"), id));
     }
 }
示例#8
0
        /// <summary>
        /// 检测模型数据是否正确
        /// </summary>
        /// <param name="data"></param>
        void CheckModelData(PanelContext data)
        {
            if (data == null)
            {
                throw new SystemException("参数data::PanelContext不能为空");
            }

            DataField fid = data.Row.IndexOf("ID");
            string    id  = fid != null && fid.Value != null?fid.Value.ToString() : "";

            if (String.IsNullOrEmpty(id))
            {
                throw new Exception("ID不能为空");
            }

            //DataField ftitle =
            //string title = GetValue<string>(data, "Title");// ftitle != null && ftitle.Value != null ? ftitle.Value.ToString() : "";
            //if (String.IsNullOrEmpty(title))
            //    throw new Exception("Title不能为空");

            //DataField foid = data.Row.IndexOf("OwnerID");
            //string oid = foid != null && foid.Value != null ? foid.Value.ToString() : "";
            //if (String.IsNullOrEmpty(oid))
            //    throw new Exception("栏目ID不能为空");
        }
        public async Task ProcessAsync_SetsTitleOnContext()
        {
            // Arrange
            var panelContext = new PanelContext();

            var context = new TagHelperContext(
                tagName: "govuk-panel-title",
                allAttributes: new TagHelperAttributeList(),
                items: new Dictionary <object, object>()
            {
                { typeof(PanelContext), panelContext }
            },
                uniqueId: "test");

            var output = new TagHelperOutput(
                "govuk-panel-title",
                attributes: new TagHelperAttributeList(),
                getChildContentAsync: (useCachedResult, encoder) =>
            {
                var tagHelperContent = new DefaultTagHelperContent();
                tagHelperContent.SetContent("The title");
                return(Task.FromResult <TagHelperContent>(tagHelperContent));
            });

            var tagHelper = new PanelTitleTagHelper();

            // Act
            await tagHelper.ProcessAsync(context, output);

            // Assert
            Assert.Equal("The title", panelContext.Title?.RenderToString());
        }
示例#10
0
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="data">模型数据</param>
        /// <param name="recordcount">返回总的数据记录</param>
        /// <param name="pageindex">当前的页数</param>
        /// <returns>数据集</returns>
        public DataTable Query(PanelContext data, out int recordcount, ref int pageindex)
        {
            int itemscount, startindex = data.PageIndex;

            if (!GeneralConfigs.GetConfig().ShowAllInfo&& Security.CurrentAccountID != We7Helper.EmptyGUID)
            {
                data.QueryFields.Add(new QueryField(data.Table.Columns["AccountID"], Security.CurrentAccountID));
            }
            recordcount = GetCount(data);

            Utils.BuidlPagerParam(recordcount, data.PageSize, ref pageindex, out startindex, out itemscount);

            using (IDbConnection conn = SqlBuilder.GetConnection())
            {
                conn.ConnectionString = connstr;
                conn.Open();
                IDbDataAdapter adapter = SqlBuilder.GetDataAdapter();
                using (IDbCommand comm = SqlBuilder.GetCommand())
                {
                    comm.Connection       = conn;
                    comm.CommandType      = CommandType.Text;
                    comm.CommandText      = SqlBuilder.BuildListSQL(data, comm.Parameters, startindex, itemscount);
                    adapter.SelectCommand = comm;
                    DataSet ds = new DataSet();
                    adapter.Fill(ds);
                    return(ds.Tables[0]);
                }
            }
        }
示例#11
0
        protected T GetValue <T>(PanelContext data, string field)
        {
            T         o  = default(T);
            DataField fd = data.Row.IndexByMapping(field);

            if (fd != null)
            {
                if (fd.Value != null)
                {
                    try
                    {
                        o = (T)fd.Value;
                    }
                    catch { o = default(T); }
                }
                else if (!String.IsNullOrEmpty(fd.Column.DefaultValue))
                {
                    o = (T)TypeConverter.StrToObjectByTypeCode(fd.Column.DefaultValue, fd.Column.DataType);
                }
            }
            else
            {
                We7DataColumn column = data.Table.Columns[field];
                if (column != null && !String.IsNullOrEmpty(column.DefaultValue) && (column.Direction == ParameterDirection.Output || column.Direction == ParameterDirection.InputOutput))
                {
                    o = (T)(T)TypeConverter.StrToObjectByTypeCode(column.DefaultValue, column.DataType);
                }
            }
            return(o);
        }
示例#12
0
        public string BuildListSQL(PanelContext data, System.Data.IDataParameterCollection parameters, int startindex, int itemcount)
        {
            StringBuilder sqlwehre = BuildWhereSql(data, parameters);

            string sql = "";

            if (startindex > 0)
            {
                string revorders = regex.Replace(data.Orders, delegate(Match m)
                {
                    if (String.Compare(m.Value, "desc", true) == 0)
                    {
                        return("ASC");
                    }
                    else
                    {
                        return("DESC");
                    }
                });
                int firstcount = itemcount + startindex;
                sql = String.Format(SQLPAGELIST, firstcount, data.Table.Name, sqlwehre, data.Orders, itemcount, revorders, data.Orders);
            }
            else if (itemcount > 0)
            {
                sql = String.Format(SQLTOPLIST, itemcount, data.Table.Name, sqlwehre, data.Orders);
            }
            else
            {
                sql = String.Format(SQLLIST, data.Table.Name, sqlwehre, data.Orders);
            }
            return(sql);
        }
示例#13
0
        public override object Do(PanelContext data)
        {
            List <DataKey> dataKeys = data.State as List <DataKey>;

            if (dataKeys != null)
            {
                foreach (DataKey key in dataKeys)
                {
                    string id = key["ID"] as string;
                    if (ChannelProcess(id))
                    {
                        Article    a  = ArticleHelper.GetArticle(id);
                        Processing ap = ArticleProcessHelper.GetArticleProcess(a);
                        if (ap.ArticleState != ArticleStates.Checking)
                        {
                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(a, ap);
                        }
                    }
                }
            }
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
示例#14
0
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="cmd">命令名称</param>
        /// <param name="model">模型信息</param>
        /// <param name="state">附加数据</param>
        protected void DoCommand(object sender, string cmd, PanelContext data, object args)
        {
            //初始化模型数据
            InitModelData();

            //构建模型参数
            ModelEventArgs modelArgs = new ModelEventArgs(cmd, args, data);

            //处理预处理命令
            if (OnPreCommand != null)
            {
                OnPreCommand(sender, modelArgs);
            }
            if (!modelArgs.Disable)
            {
                //处理命令
                if (OnCommand != null)
                {
                    OnCommand(sender, modelArgs);
                }
                else
                {
                    OnInteralCommand(sender, modelArgs);
                }
            }
            //处理命令完成后事件
            if (!modelArgs.Disable && OnCommandComplete != null)
            {
                OnCommandComplete(sender, modelArgs);
            }
        }
示例#15
0
        object ICommand.Do(PanelContext data)
        {
            string oid = data.Objects["oid"] as string;

            if (We7Helper.IsEmptyID(oid))
            {
                throw new Exception("不能添加到根栏目");
            }
            Channel targetChannel = HelperFactory.Instance.GetHelper <ChannelHelper>().GetChannel(oid);

            if (targetChannel != null && !String.IsNullOrEmpty(targetChannel.ModelName))
            {
                ModelInfo    modelInfo = ModelHelper.GetModelInfo(targetChannel.ModelName);
                We7DataTable dt        = modelInfo.DataSet.Tables[0];

                List <DataKey> dataKeys = data.State as List <DataKey>;
                foreach (DataKey dk in dataKeys)
                {
                    string id = dk["ID"].ToString();
                    SingleTableLinkTo(data, dt, id);
                }
            }
            UIHelper.SendMessage("引用成功");
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
示例#16
0
        public string BuildInsertSQL(PanelContext data, System.Data.IDataParameterCollection parameters)
        {
            StringBuilder fieldlist = new StringBuilder();
            StringBuilder paramlist = new StringBuilder();

            foreach (DataField field in data.Row)
            {
                string paramname = String.Format("@{0}", field.Column.Name);
                fieldlist.AppendFormat("[{0}],", field.Column.Name);
                paramlist.Append(paramname).Append(",");
                if (field.Column.DataType == TypeCode.DateTime)
                {
                    MySqlParameter param = new MySqlParameter(field.Column.Name, MySqlDbType.Datetime);
                    param.Value = field.Value;
                    parameters.Add(param);
                }
                else
                {
                    parameters.Add(new MySqlParameter(paramname, field.Value));
                }
            }
            Utils.TrimEndStringBuilder(fieldlist, ",");
            Utils.TrimEndStringBuilder(paramlist, ",");
            return(String.Format(SQLINSERT, data.Table.Name, fieldlist, paramlist));
        }
示例#17
0
        public object Do(PanelContext data)
        {
            ModelDBHelper subHelper = ModelDBHelper.Create(data.ModelName);
            DataTable     db        = subHelper.Query(new Criteria(CriteriaType.Equals, "ID", data.DataKey.Value), new List <Order> {
                new Order("ID")
            });

            DbProvider.Instance(data.Model.Type).Delete(data);
            foreach (We7Control ctrl in ModelHelper.GetPanelContext(data.ModelName, "edit").Panel.EditInfo.Controls)
            {
                if (!string.IsNullOrEmpty(ctrl.Params["count"]))
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(string.Format("{0}_Count", data.Model.Name),
                            subHelper.Count(new Criteria(CriteriaType.Equals, ctrl.Name, db.Rows[0][ctrl.Name])));
                    ModelDBHelper helper = ModelDBHelper.Create(ctrl.Params["model"]);
                    helper.Update(dic, new Criteria(CriteriaType.Equals, ctrl.Params["valuefield"], db.Rows[0][ctrl.Name]));
                }
                string fileurl = HttpContext.Current.Server.MapPath(db.Rows[0][ctrl.Name].ToString());
                if (ctrl.Type == "MultiUploadify" && File.Exists(fileurl))
                {
                    File.Delete(fileurl);
                    File.Delete(fileurl.Insert(fileurl.LastIndexOf('.'), "_thumb"));
                }
            }
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
示例#18
0
        public int GetCount(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);
            Criteria      ct     = CreateQueryCriteria(data.QueryFields, data);

            return(helper.Count(ct));
        }
示例#19
0
        /// <summary>
        /// 取得模型的XML
        /// </summary>
        /// <param name="data">模型数据</param>
        /// <returns>Xml字符串</returns>
        protected string GetModelDataXml(PanelContext data, string xml, out string schema, out string modelconfig)
        {
            DataSet ds = CreateDataSet(data.Model);

            StringBuilder sb     = new StringBuilder();
            StringWriter  writer = new StringWriter(sb);

            ds.WriteXmlSchema(writer);
            schema = sb.ToString();

            modelconfig = File.ReadAllText(ModelHelper.GetModelPath(data.ModelName));


            if (!String.IsNullOrEmpty(xml))
            {
                ReadXml(ds, xml);
            }

            DataRow row = null;

            if (ds.Tables[data.Table.Name].Rows.Count > 0)
            {
                row = ds.Tables[data.Table.Name].Rows[0];
            }
            else
            {
                row = ds.Tables[data.Table.Name].NewRow();
                ds.Tables[data.Table.Name].Rows.Add(row);
            }
            UpdateRow(row, data.Row);
            return(GetXml(ds));
        }
示例#20
0
        public string BuildGetSQL(PanelContext data, System.Data.IDataParameterCollection parameters)
        {
            StringBuilder sqlwehre = BuilderWhereSqlByDataKey(data, parameters, "");
            string        sql      = String.Format(SQLLIST, data.Table.Name, sqlwehre, data.Panel.Context.Orders);

            return(sql);
        }
示例#21
0
        public object Do(PanelContext data)
        {
            string oid = data.Objects["oid"] as string;

            if (We7Helper.IsEmptyID(oid))
            {
                UIHelper.Message.AppendInfo(MessageType.ERROR, "不能移动到根栏目");
            }
            ChannelHelper chHelper = HelperFactory.Instance.GetHelper <ChannelHelper>();
            Channel       channel  = chHelper.GetChannel(oid, null);

            if (channel == null)
            {
                throw new Exception("当前栏目不存在");
            }
            if (channel.ModelName != data.ModelName)
            {
                throw new Exception("移动到的栏目类型与当前栏目类型不一致");
            }

            List <DataKey> dataKeys = data.State as List <DataKey>;

            foreach (DataKey key in dataKeys)
            {
                string id = key["ID"] as string;
                if (DbHelper.CheckTableExits(data.Table.Name))
                {
                    DbHelper.ExecuteSql(String.Format("UPDATE [{0}] SET [OwnerID]='{2}' WHERE [ID]='{1}'", data.Table.Name, id, oid));
                }
            }
            UIHelper.SendMessage("移动成功");
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
        public async Task ProcessAsync_ParentAlreadyHasBody_ThrowsInvalidOperationException()
        {
            // Arrange
            var panelContext = new PanelContext();

            panelContext.SetBody(new HtmlString("The body"));

            var context = new TagHelperContext(
                tagName: "govuk-panel-title",
                allAttributes: new TagHelperAttributeList(),
                items: new Dictionary <object, object>()
            {
                { typeof(PanelContext), panelContext }
            },
                uniqueId: "test");

            var output = new TagHelperOutput(
                "govuk-panel-title",
                attributes: new TagHelperAttributeList(),
                getChildContentAsync: (useCachedResult, encoder) =>
            {
                var tagHelperContent = new DefaultTagHelperContent();
                tagHelperContent.SetContent("The title");
                return(Task.FromResult <TagHelperContent>(tagHelperContent));
            });

            var tagHelper = new PanelTitleTagHelper();

            // Act
            var ex = await Record.ExceptionAsync(() => tagHelper.ProcessAsync(context, output));

            // Assert
            Assert.IsType <InvalidOperationException>(ex);
            Assert.Equal("<govuk-panel-title> must be specified before <govuk-panel-body>.", ex.Message);
        }
示例#23
0
        public bool Delete(PanelContext data)
        {
            ModelDBHelper helper = ModelDBHelper.Create(data.ModelName);

            helper.Delete(CreatePKCriteria(data.DataKey));
            return(true);
        }
示例#24
0
        /// <summary>
        /// 执行操作
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public object Do(PanelContext data)
        {
            ModelDBHelper  subHelper = ModelDBHelper.Create(data.ModelName);
            List <DataKey> dataKeys  = data.State as List <DataKey>;

            if (dataKeys.Count == 0)
            {
                return(null);
            }
            DataTable db = subHelper.Query(new Criteria(CriteriaType.Equals, "ID", dataKeys[0].Value), new List <Order> {
                new Order("ID")
            });
            ModelDBHelper temhelper     = null;
            string        columnMapping = string.Empty;

            if (dataKeys != null)
            {
                foreach (We7DataColumn column in data.DataSet.Tables[0].Columns)
                {
                    if (column.Name.Contains("_Count"))
                    {
                        temhelper     = ModelDBHelper.Create(data.Model.GroupName + "." + column.Name.Remove(column.Name.IndexOf("_Count")));
                        columnMapping = column.Mapping;
                    }
                }
                foreach (DataKey key in dataKeys)
                {
                    if (temhelper != null)
                    {
                        DataTable dt = subHelper.Query(new Criteria(CriteriaType.Equals, "ID", key.Value), new List <Order> {
                            new Order("ID")
                        });
                        temhelper.Delete(new Criteria(CriteriaType.Equals, columnMapping.Split('|')[0], dt.Rows[0][columnMapping.Split('|')[1]]));
                    }
                    data.DataKey = key;
                    DbProvider.Instance(data.Model.Type).Delete(data);
                }
                data.DataKey = null;
            }
            foreach (We7Control ctrl in ModelHelper.GetPanelContext(data.ModelName, "edit").Panel.EditInfo.Controls)
            {
                if (!string.IsNullOrEmpty(ctrl.Params["count"]))
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(string.Format("{0}_Count", data.Model.Name),
                            subHelper.Count(new Criteria(CriteriaType.Equals, ctrl.Name, db.Rows[0][ctrl.Name])));
                    ModelDBHelper helper = ModelDBHelper.Create(ctrl.Params["model"]);
                    helper.Update(dic, new Criteria(CriteriaType.Equals, ctrl.Params["valuefield"], db.Rows[0][ctrl.Name]));
                }
                string fileurl = HttpContext.Current.Server.MapPath(db.Rows[0][ctrl.Name].ToString());
                if (ctrl.Type == "MultiUploadify" && File.Exists(fileurl))
                {
                    File.Delete(fileurl);
                    File.Delete(fileurl.Insert(fileurl.LastIndexOf('.'), "_thumb"));
                }
            }
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
示例#25
0
 public override bool Delete(PanelContext data)
 {
     if (data.DataKey["ID"] != null)
     {
         ArticleHelper.DeleteArticle(data.DataKey["ID"].ToString());
     }
     return(true);
 }
示例#26
0
        /// <summary>
        /// 取得默认值
        /// </summary>
        /// <param name="key"></param>
        /// <param name="ctx"></param>
        /// <param name="dc"></param>
        /// <returns></returns>
        public static object GetDefaultValue(string key, PanelContext ctx, We7DataColumn dc)
        {
            DefaultGenerator generator = GetGenerator(key);

            generator.Ctx = ctx;
            generator.DC  = dc;
            return(generator != null?generator.Generate() : null);
        }
示例#27
0
 public bool Insert(PanelContext data)
 {
     foreach (IDbProvider provider in providers)
     {
         provider.Insert(data);
     }
     return(true);
 }
示例#28
0
 public bool Delete(PanelContext data)
 {
     foreach (IDbProvider provider in providers)
     {
         provider.Delete(data);
     }
     return(true);
 }
示例#29
0
 public System.Data.DataRow Get(PanelContext data)
 {
     if (providers.Count > 0)
     {
         return(providers[0].Get(data));
     }
     Logger.Error("内容模型::数据提供者为空");
     return(null);
 }
示例#30
0
 public int GetCount(PanelContext data)
 {
     if (providers.Count > 0)
     {
         return(providers[0].GetCount(data));
     }
     Logger.Error("内容模型::数据提供者为空");
     return(0);
 }