Ejemplo n.º 1
0
 protected override void InitModelData()
 {
     PanelContext.PageIndex = PageIndex;
     PanelContext.QueryFields.Clear();
     foreach (We7Control field in PanelContext.Panel.ConditionInfo.Controls)
     {
         FieldControl fc  = UIHelper.GetControl(field.ID, this) as FieldControl;
         object       val = fc.GetValue();
         if (field.IgnoreEmpty && String.IsNullOrEmpty(val as string))
         {
             continue;
         }
         PanelContext.QueryFields[field.Name] = val;
         if (String.Compare(field.Type, "textinput", true) == 0 || String.Compare(field.Type, "textarea", true) == 0)
         {
             PanelContext.QueryFields.IndexOf(field.Name).Operator = OperationType.LIKE;
         }
         else
         {
             PanelContext.QueryFields.IndexOf(field.Name).Operator = ModelHelper.GetOperation(field.Params["operater"]);
         }
     }
     if (initQueryParam != null)
     {
         initQueryParam(PanelContext);
     }
 }
Ejemplo n.º 2
0
        protected override void InitModelData()
        {
            PanelContext.Row.Clear();

            foreach (Group group in PanelContext.Panel.EditInfo.Groups)
            {
                if (group.Index != GroupIndex)
                {
                    continue;
                }
                foreach (We7Control ctr in group.Controls)
                {
                    FieldControl fc = UIHelper.GetControl(ctr.ID, this) as FieldControl;
                    if (fc != null)
                    {
                        object o = fc.GetValue();
                        if (o is IDictionary <string, object> )
                        {
                            IDictionary <string, object> dic = o as IDictionary <string, object>;
                            foreach (string key in dic.Keys)
                            {
                                PanelContext.Row[key] = dic[key];
                            }
                        }
                        else if (o is List <Dictionary <string, object> > )
                        {
                            List <Dictionary <string, object> > dics = o as List <Dictionary <string, object> >;
                            int i = 1;
                            foreach (Dictionary <string, object> dic in dics)
                            {
                                foreach (string key in dic.Keys)
                                {
                                    PanelContext.Row[key] = dic[key];
                                }
                                if (i == dics.Count)
                                {
                                    continue;
                                }
                                ProcessAllDataColumns(PanelContext);
                                DbProvider.Instance(PanelContext.Model.Type).Insert(PanelContext);
                                i++;
                            }
                        }
                        else
                        {
                            PanelContext.Row[ctr.Name] = o;
                        }
                    }
                    else
                    {
                        PanelContext.Row[ctr.Name] = null;
                    }
                }
                ProcessAllDataColumns(PanelContext);
            }

            InitDataKeyValus();
        }
Ejemplo n.º 3
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));
                }
            }
        }