Esempio n. 1
0
        public void UpdateCtrl(Dictionary <string, object> dic)
        {
            var dicList = CtrlSetting.JsonToDictionaryList();
            var ctrlSet = dicList.SingleOrDefault(a => a.GetValue("FieldName") == dic.GetValue("FieldName"));

            ctrlSet.CheckNotNull("FieldName为" + dic.GetValue("FieldName") + "的控件设置不存在");
            dicList.Remove(ctrlSet);
            dicList.Add(dic);
            CtrlSetting = dicList.ToJson();
        }
Esempio n. 2
0
        /// <summary>
        /// key tableName  value FieldName
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, string> GetPopupSelectorForeignTableFieldPairList()
        {
            var popupSelectors = CtrlSetting.JsonToDictionaryList().Where(a => a.GetValue("CtrlType") == ControlType.PopupSelector.ToString());
            Dictionary <string, string> res = new Dictionary <string, string>();

            foreach (var s in popupSelectors)
            {
                string detail = s.GetValue("Detail");
                if (!string.IsNullOrEmpty(detail))
                {
                    var detailDic = detail.JsonToDictionary();
                    res.SetValue(detailDic.GetValue("textName"), detailDic.GetValue("foreignTableFieldName"));
                }
            }
            return(res);
        }
Esempio n. 3
0
        public void UpdateCtrl(List <Dictionary <string, object> > dicList)
        {
            var oldDicList = CtrlSetting.JsonToDictionaryList();

            foreach (var dic in dicList)
            {
                if (dic.GetValue("state") == "insert")
                {
                    oldDicList.Add(dic);
                }
                else if (dic.GetValue("state") == "update")
                {
                    oldDicList.RemoveAll(a => a.GetValue("FieldName") == dic.GetValue("FieldName"));
                    oldDicList.Add(dic);
                }
                else if (dic.GetValue("state") == "delete")
                {
                    oldDicList.RemoveAll(a => a.GetValue("FieldName") == dic.GetValue("FieldName"));
                }
            }
            CtrlSetting = oldDicList.ToJson();
        }
Esempio n. 4
0
        public void ReCreateCtrl()
        {
            Type type            = ReflectionHelper.GetTypeBy(this.DBName, EntityFullName);
            var  propertyDicList = GetPropertyDicList(type, true);
            var  dicList         = CtrlSetting.JsonToDictionaryList();

            List <string> toNoDelete = new List <string>();
            List <Dictionary <string, object> > toAdd = new List <Dictionary <string, object> >();

            foreach (var propertyDic in propertyDicList)
            {
                var dic = dicList.SingleOrDefault(a => a.GetValue("FieldName") == propertyDic.GetValue("FieldName"));
                if (dic == null)
                {
                    int maxOrderIndex = 0;
                    if (dicList.Count > 0)
                    {
                        maxOrderIndex = dicList.Max(a => Convert.ToInt32(
                                                        string.IsNullOrEmpty(a.GetValue("OrderIndex")) ? 0 : Convert.ToInt32(a.GetValue("OrderIndex"))));
                    }
                    //propertyDic.SetValue("CtrlType", "");
                    propertyDic.SetValue("IsVisible", "是");
                    propertyDic.SetValue("Enable", "是");
                    propertyDic.SetValue("Detail", "{ style_width: '100%'}");
                    propertyDic.SetValue("OrderIndex", maxOrderIndex + 1);
                    dicList.Add(propertyDic);
                }
                else
                {
                    dic.SetValue("FieldType", propertyDic.GetValue("FieldType"));
                }
                toNoDelete.Add(propertyDic.GetValue("FieldName"));
            }
            //dicList.AddRange(toAdd);
            dicList.RemoveAll(a => !toNoDelete.Contains(a.GetValue("FieldName")));
            CtrlSetting = dicList.ToJson();
        }
Esempio n. 5
0
 public IEnumerable <Dictionary <string, object> > GetCtrlAttrList()
 {
     return(CtrlSetting.JsonToDictionaryList().OrderBy(a => Convert.ToInt32(
                                                           string.IsNullOrEmpty(a.GetValue("OrderIndex")) ? 0 : Convert.ToInt32(a.GetValue("OrderIndex")))
                                                       ));
 }