예제 #1
0
        public string ff()
        {
            string g = " [{" +
                       "RegName: \"Selector\"," +
                       "BassClassName: \"AtawOptionCreator\"," +
                       "InstanceClassName: \"AtawSelectorOptionCreator\"," +
                       "DllPath: \"Ataw.Framework.Core.dll\"," +
                       //"Desc: \"选择器控件参数创建插件\"," +
                       //"Author: \"zhengyk\"," +
                       "CreateDate: \"2012-11-15 00:00:00\"" +
                       "}]";
            var table = JsonConvert.DeserializeObject <DataTable>(g);

            List <PlugModel> list = DataSetUtil.FillModel <PlugModel>(table).ToList();


            string ss = JsonConvert.SerializeObject(list);

            return(ss);
        }
예제 #2
0
        //SubmitData ListDataTable_SubmitFilterEvent(ResponseResult arg)
        //{
        //    throw new NotImplementedException();
        //}

        public virtual void Merge(bool isBat)
        {
            DataTable dt             = this.PostDataSet.Tables[RegName];
            var       _editorColumns = DataFormConfig.Columns.FindAll(a => a.ControlType == ControlType.Editor);

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _editorColumns.ForEach(
                        a =>
                    {
                        if (dt.Columns.Contains(a.Name))
                        {
                            dt.Rows[i][a.Name] = StringUtil.HexToString(dt.Rows[i][a.Name].ToString());
                        }
                    }
                        );
                }
            }
            var sysDt = this.PostDataSet.Tables[PAGE_SYS]; //该表存放主从表的主表主键值

            if (sysDt != null)
            {
                ForeignKeyValue = sysDt.Rows[0][KEYVALUE].ToString();
            }



            List <ObjectDataView> InsertDataViewList = new List <ObjectDataView>();
            List <ObjectDataView> UpdateDataViewList = new List <ObjectDataView>();
            List <string>         DeleteStringList   = new List <string>();

            if (dt != null)
            {
                this.ObjectType = this.ObjectType ?? typeof(ObjectData);
                List <ObjectData> list = DataSetUtil.FillModel(dt, this.ObjectType, XmlColumns);
                foreach (ObjectData objectData in list)
                {
                    DataRow row = objectData.Row;
                    // DataFormConfig.Columns.Find(a=>a.Name ==
                    row.BeginEdit();

                    bool isInsert = !row.Table.Columns.Contains(PrimaryKey) || (row.Table.Columns.Contains(PrimaryKey) && row[PrimaryKey].Value <string>().IsEmpty());
                    MergeTable(isBat, isInsert);
                    if (isInsert)
                    {
                        string _insertKey = GetInsertKey(objectData);
                        //if (string.IsNullOrEmpty(ForeignKey))
                        //{
                        //    var insertKeys = AppContext.Current.PageFlyweight.PageItems["InsertKeys"] as List<string>;
                        //    if (insertKeys == null)
                        //    {
                        //        AppContext.Current.PageFlyweight.PageItems.Add("InsertKeys", new List<string> { _insertKey });
                        //    }
                        //    else
                        //    {
                        //        insertKeys.Add(_insertKey);
                        //    }
                        //}
                        SetPostDataRow(objectData, DataAction.Insert, _insertKey);
                        InsertForeach(objectData, row, _insertKey);
                        InsertDataViewList.Add(new ObjectDataView()
                        {
                            KeyId      = _insertKey,
                            objectData = objectData
                        });
                    }
                    else
                    {
                        string key = row[PrimaryKey].Value <string>();
                        SetPostDataRow(objectData, DataAction.Update, key);
                        UpdateForeach(objectData, row, key);

                        UpdateDataViewList.Add(
                            new ObjectDataView()
                        {
                            KeyId      = key,
                            objectData = objectData
                        }
                            );
                    }
                    row.EndEdit();
                }
            }
            DataTable opdt = this.PostDataSet.Tables[RegName + "_OPERATION"];

            if (opdt != null && opdt.Rows.Count > 0)
            {
                foreach (DataRow row in opdt.Rows)
                {
                    string _key = row["KeyValue"].ToString();
                    if (row["OperationName"].ToString() == "Delete")
                    {
                        DeleteForeach(_key, "");
                        DeleteStringList.Add(_key);
                    }
                }
            }
            bool isCheck = CheckPostData(InsertDataViewList, UpdateDataViewList, DeleteStringList);
            //Debug.Assert(isCheck, "数据源插件{0},的提交数据验证不通过".AkFormat(RegName), this);
        }