Beispiel #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);
     }
 }
Beispiel #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();
        }