Beispiel #1
0
        /// <summary>
        /// 导入到代码库
        /// </summary>
        private void GenCodeLibrary()
        {
            string table = ((dynamic)ActionParama.Arg).tb;
            string field = ((dynamic)ActionParama.Arg).fd;

            if (!IsNotEmptyString(table) || !IsNotEmptyString(field))
            {
                Outmsg("参数无效");
                return;
            }

            var tablecode = BufHelp.ProtoBufDeserialize <List <KeyValue> >(KeyCenter.CodeFile)
                            ?? new List <KeyValue>();

            var query = tablecode.FirstOrDefault(x => x.key == table);  //是否存

            if (query != null)
            {
                tablecode.Remove(query);                                //存在就删除
            }

            tablecode.Add(new KeyValue {
                key = table, value = field
            });
            var result = BufHelp.ProtoBufSerialize <List <KeyValue> >(tablecode, KeyCenter.CodeFile);

            Outmsg(result, outmsg: "导入到代码库失败");
        }
Beispiel #2
0
        /// <summary>
        /// 从代码库中删除
        /// </summary>
        private void DelCodeLibrary()
        {
            string table = ((dynamic)ActionParama.Arg).tb;

            if (!IsNotEmptyString(table))
            {
                Outmsg("参数无效");
                return;
            }

            var tablecode = BufHelp.ProtoBufDeserialize <List <KeyValue> >(KeyCenter.CodeFile)
                            ?? new List <KeyValue>();

            var query = tablecode.FirstOrDefault(x => x.key == table);  //是否存

            if (query == null)
            {
                Outmsg("非法删除");
                return;
            }

            tablecode.Remove(query);
            var result = BufHelp.ProtoBufSerialize <List <KeyValue> >(tablecode, KeyCenter.CodeFile);

            Outmsg(result, outmsg: "删除失败");
        }
Beispiel #3
0
        /// <summary>
        /// 表的业务说明备注
        /// </summary>
        private void TableMark()
        {
            string table = ((dynamic)ActionParama.Arg).tb;
            string mark  = ((dynamic)ActionParama.Arg).mk;

            if (!IsNotEmptyString(table) || !IsNotEmptyString(mark))
            {
                Outmsg("参数无效");
                return;
            }

            var tbBizInfo = BufHelp.ProtoBufDeserialize <List <TableInfoTiny> >(KeyCenter.TableBusinessFile)
                            ?? new List <TableInfoTiny>();
            var currentbiz = tbBizInfo.FirstOrDefault(x => x.tablename == table);       //当前表的业务说明信息

            if (currentbiz == null)
            {
                tbBizInfo.RemoveAll(x => x.tablename == table);
                tbBizInfo.Add(new TableInfoTiny
                {
                    tablename = table,
                    tablemark = mark
                });
            }
            else
            {
                currentbiz.tablemark = mark;                                            //修改业务描述内容
            }

            var result = BufHelp.ProtoBufSerialize <List <TableInfoTiny> >(tbBizInfo, KeyCenter.TableBusinessFile);

            Outmsg(result, outmsg: string.Format("修改表{0}的业务说明出错", table));
        }
Beispiel #4
0
        /// <summary>
        /// 更新数据库链接
        /// </summary>
        private void UpdateConstr()
        {
            string constr = ((dynamic)ActionParama.Arg).cs;

            if (!IsNotEmptyString(constr))
            {
                Outmsg("参数无效");
                return;
            }

            var model = new KeyValue {
                key = KeyCenter.DBKey, value = constr
            };
            var result = BufHelp.ProtoBufSerialize <KeyValue>(model, KeyCenter.DBConfigFile);

            if (result)
            {
                CacheUtil.Clear();                                                              //清空所有缓存
            }
            Outmsg(result, outmsg: "修改链接字符串出错");
        }
Beispiel #5
0
        /// <summary>
        /// 修改字段的业务场景说明
        /// </summary>
        private void Sence()
        {
            #region check
            var argdata = GetActionParamData <MofifyArg>(true);
            if (argdata == null)
            {
                Outmsg("参数解析错误");
                return;
            }

            if (!IsNotEmptyString(argdata.table) ||
                !IsNotEmptyString(argdata.name) ||
                !IsNotEmptyString(argdata.biz))
            {
                Outmsg("参数无效");
                return;
            }

            var query = GetTableDetail(argdata.table);                                //表信息
            if (query == null || query.Count == 0)
            {
                Outmsg("数据表无效");
                return;
            }

            var field = query.FirstOrDefault(x => x.name == argdata.name);                      //字段信息
            if (field == null)
            {
                Outmsg("无效字段");
                return;
            }
            #endregion

            #region 字段的业务场景描述
            var tbBizInfo = BufHelp.ProtoBufDeserialize <List <TableInfoTiny> >(KeyCenter.TableBusinessFile)
                            ?? new List <TableInfoTiny>();
            //业务属性描述
            var currentbiz = tbBizInfo.FirstOrDefault(x => x.tablename == argdata.table);       //当前表的业务说明信息
            if (currentbiz == null || currentbiz.fieldinfo.Count == 0)                          //表不存在
            {
                var fieldbiz = new TableInfoTiny
                {
                    tablename = argdata.table,
                    fieldinfo = query.Select(x => new FieldInfo
                    {
                        name = x.name,
                        type = x.type,
                        des  = x.des,
                        biz  = x.name == argdata.name ? argdata.biz.Trim() : ""
                    }).ToList()
                };
                tbBizInfo.RemoveAll(x => x.tablename == argdata.table);
                tbBizInfo.Add(fieldbiz);
            }
            else                                                                                //表存在
            {
                var tempf = currentbiz.fieldinfo.FirstOrDefault(x => x.name == argdata.name);
                tempf.biz = argdata.biz;                                                        //修改业务描述内容
            }

            var result = BufHelp.ProtoBufSerialize <List <TableInfoTiny> >(tbBizInfo, KeyCenter.TableBusinessFile);
            Outmsg(result, outmsg: string.Format("修改字段{0}的业务属性出错", argdata.name));
            #endregion
        }