예제 #1
0
        private static void AddCount(We7Control contrl, ModelInfo subModel)
        {
            if (contrl.Params["count"] != "true")
            {
                return;
            }
            ModelInfo modelInfo = ModelHelper.GetModelInfoByName(contrl.Params["model"]);

            We7DataColumn column = new We7DataColumn();

            column.DataType = TypeCode.Int32;
            column.Label    = subModel.Label + "统计";
            column.Name     = subModel.Name + "_Count";
            ParameterDirection direction = ParameterDirection.Input;

            column.Direction = direction;
            column.Mapping   = string.Format("{0}|{1}", contrl.Name, contrl.Params["valuefield"]);
            if (modelInfo.DataSet.Tables == null)
            {
                We7.Model.Core.We7DataTable table = new We7DataTable();
                modelInfo.DataSet.Tables.Add(table);
            }
            modelInfo.DataSet.Tables[0].Columns.AddOrUpdate(column);
            bool success = ModelHelper.SaveModelInfo(modelInfo, contrl.Params["model"]);
        }
예제 #2
0
        /// <summary>
        /// 创建行控件
        /// </summary>
        /// <param name="field">字段信息</param>
        /// <returns>行控件</returns>
        protected Control CreateItem(We7Control control)
        {
            HtmlTableRow  row = new HtmlTableRow();
            HtmlTableCell c   = new HtmlTableCell();

            c.InnerHtml           = control.Label + ":";
            c.Attributes["class"] = "formTitle";
            row.Cells.Add(c);

            c = new HtmlTableCell();
            c.Attributes["class"] = "formValue";
            FieldControl fc = UIHelper.GetControl(control);

            fc.IsEdit = IsEdit;
            c.Controls.Add(fc);

            Literal ltlMsg = new Literal();

            ltlMsg.Text = control.Desc;
            c.Controls.Add(ltlMsg);

            row.Cells.Add(c);

            row.Style.Add("display", control.Visible ? "" : "none");

            return(row);
        }
예제 #3
0
        /// <summary>
        /// 创建行控件
        /// </summary>
        /// <param name="field">字段信息</param>
        /// <returns>行控件</returns>
        protected Control CreateItem(We7Control control)
        {
            HtmlTableRow       row   = new HtmlTableRow();
            HtmlTableCell      c     = new HtmlTableCell("TH");
            HtmlGenericControl lable = new HtmlGenericControl("strong");

            lable.InnerHtml = control.Label + ":";
            c.Controls.Add(lable);
            row.Cells.Add(c);

            c = new HtmlTableCell();
            We7Control ctr = control.Clone() as We7Control;

            if (!EnableControls.Contains(ctr.Type))
            {
                ctr.Type = "Text";
            }
            FieldControl fc = UIHelper.GetControl(ctr);

            fc.IsEdit = IsEdit;
            c.Controls.Add(fc);
            row.Cells.Add(c);

            row.Style.Add("display", control.Visible ? "" : "none");

            return(row);
        }
예제 #4
0
 protected void rpEditor_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
     {
         We7Control ctr = e.Item.DataItem as We7Control;
         e.Item.Controls.Add(CreateItem(ctr));
     }
 }
예제 #5
0
 protected string GetLabel(We7Control control)
 {
     if (String.IsNullOrEmpty(control.Label) && Info.DataSet.Tables.Count > 0 && Info.DataSet.Tables[0].Columns.Contains(control.Name))
     {
         control.Label = Info.DataSet.Tables[0].Columns[control.Name].Label;
     }
     return(control.Label);
 }
예제 #6
0
        protected void rptEditorHeader_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            We7Control ctr = e.Item.DataItem as We7Control;

            if (ctr != null)
            {
                HtmlTableCell cell = new HtmlTableCell();
                cell.InnerText = ctr.Label;
                cell.Visible   = ctr.Visible;
                e.Item.Controls.Add(cell);
                //cell = new HtmlTableCell();
                //FieldControl c = UIHelper.GetControl(ctr);
                //cell.Controls.Clear();
                //cell.Controls.Add(c);
                //cell.Visible = ctr.Visible;
                //e.Item.Controls.Add(cell);
            }
        }
예제 #7
0
 protected void gvList_DataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowIndex > -1)
     {
         int j = 0, width;
         for (int i = 0; i < EditorContext.Panel.EditInfo.Controls.Count; i++)
         {
             We7Control ctrl = EditorContext.Panel.EditInfo.Controls[i] as We7Control;
             if (ctrl.Visible)
             {
                 if (int.TryParse(ctrl.Width, out width))
                 {
                     e.Row.Cells[j].Width = width;
                 }
                 j++;
             }
         }
     }
 }
예제 #8
0
        /// <summary>
        /// 创建行控件
        /// </summary>
        /// <param name="field">字段信息</param>
        /// <returns>行控件</returns>
        protected Control CreateItem(We7Control control)
        {
            HtmlTableRow       row   = new HtmlTableRow();
            HtmlTableCell      c     = new HtmlTableCell("TH");
            HtmlGenericControl lable = new HtmlGenericControl("strong");

            lable.InnerHtml = control.Label + ":";
            c.Controls.Add(lable);
            row.Cells.Add(c);

            c = new HtmlTableCell();
            FieldControl fc = UIHelper.GetControl(control);

            fc.IsEdit = IsEdit;
            c.Controls.Add(fc);
            row.Cells.Add(c);

            row.Style.Add("display", control.Visible ? "" : "none");

            return(row);
        }
예제 #9
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindList()
        {
            //TODO::在这儿用 EditorContext.Panel.EditInfo.Controls;中的值来初始化那些列要显示,以及按什么样的方式进行显示
            //TODO::把整个控件的样式调整一下,让它更美观一些

            gvList.DataSource = Data;

            gvList.Columns.Clear();

            gvList.AutoGenerateColumns = false;
            gvList.DataKeyNames        = new string[] { "ID" };

            for (int i = 0; i < EditorContext.Panel.EditInfo.Controls.Count; i++)
            {
                We7Control ctrl = EditorContext.Panel.EditInfo.Controls[i] as We7Control;
                if (ctrl.Visible)
                {
                    BoundField bf = new BoundField();
                    bf.HeaderText = ctrl.Label;
                    bf.DataField  = ctrl.Name;
                    gvList.Columns.Add(bf);
                }
            }

            CommandField cfModify = new CommandField();  //绑定命令列

            cfModify.HeaderText       = "操作";
            cfModify.ButtonType       = ButtonType.Link;
            cfModify.EditText         = "修改";
            cfModify.DeleteText       = "删除";
            cfModify.ShowEditButton   = true;
            cfModify.ShowDeleteButton = true;

            gvList.Columns.Add(cfModify);

            gvList.DataBind();
        }
예제 #10
0
        protected void rptEditor_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            We7Control ctr = e.Item.DataItem as We7Control;

            if (ctr != null)
            {
                HtmlTableRow row = new HtmlTableRow();
                row.Visible = ctr.Visible;

                HtmlTableCell cell = new HtmlTableCell();
                cell.Attributes["css"] = "cth";
                cell.InnerText         = ctr.Label;
                row.Cells.Add(cell);

                cell = new HtmlTableCell();
                FieldControl c = UIHelper.GetControl(ctr);
                cell.Controls.Clear();
                cell.Controls.Add(c);
                cell.Visible = ctr.Visible;
                row.Cells.Add(cell);

                e.Item.Controls.Add(row);
            }
        }
예제 #11
0
        public void InitLayout(PanelContext ctx)
        {
            PanelContext = ctx;
            if (!IsInitialized)
            {
                if (IsViewer)
                {
                    if (!String.IsNullOrEmpty(PanelContext.Panel.EditInfo.ViewerCss))
                    {
                        HtmlLink link = new HtmlLink();
                        link.Href = PanelContext.Panel.EditInfo.ViewerCss;
                        link.Attributes["type"] = "text/css";
                        link.Attributes["rel"]  = "stylesheet";
                        Page.Header.Controls.Add(link);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(PanelContext.Panel.EditInfo.EditCss))
                    {
                        HtmlLink link = new HtmlLink();
                        link.Href = PanelContext.Panel.EditInfo.EditCss;;
                        link.Attributes["type"] = "text/css";
                        link.Attributes["rel"]  = "stylesheet";
                        Page.Header.Controls.Add(link);
                    }
                }
                IsInitialized = true;
            }

            foreach (We7Control ctr in Panel.EditInfo.Controls)
            {
                if (IsViewer && String.Compare("ID", ctr.Name) == 0)
                {
                    continue;
                }
                We7Control control = new We7Control();
                foreach (PropertyInfo prop in ctr.GetType().GetProperties())
                {
                    prop.SetValue(control, prop.GetValue(ctr, null), null);
                }
                if (IsViewer && !EnableControls.Contains(control.Type))
                {
                    control.Type = "Text";
                }
                PlaceHolder c = UIHelper.GetControl <PlaceHolder>("_" + control.ID, this);
                if (c != null)
                {
                    c.Controls.Clear();
                    c.Controls.Add(UIHelper.GetControl(control));
                }
                else
                {
                    FieldControl fc = UIHelper.GetControl <FieldControl>(control.ID, this);
                    if (UIHelper.GetControl <FieldControl>(control.ID, this) != null)
                    {
                        Controls.Remove(fc);
                    }
                    Controls.Add(UIHelper.GetControl(control));
                }
            }
        }
예제 #12
0
 internal void InitControl(PanelContext ctx, We7Control ctr)
 {
     Control      = ctr;
     panelContext = ctx;
     InitControl();
 }