Exemplo n.º 1
0
        public int InsertQuery(bool isPrefixTableName = false)
        {
            var tablename = Url("_tablename");

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            var obj = QueryToDic(tablename);

            return(DB.Kata.Query(tablename).Insert(obj));
        }
Exemplo n.º 2
0
        public int InsertForm(bool isPrefixTableName = false)
        {
            var tablename = Form("_tablename");

            var obj = FormToDic(tablename);

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            return(InsertDic(tablename, obj));
        }
Exemplo n.º 3
0
        public int UpdateForm(bool isPrefixTableName = false)
        {
            var tablename = Form("_tablename");
            var id        = Form("_id").ToInt();
            var obj       = FormToDic(tablename);

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            Logger.LogInfo(nameof(UpdateForm), $"UpdateForm {tablename} dic {obj.ToJson() }");
            return(Update(tablename, id, obj));
        }
Exemplo n.º 4
0
        public Dictionary <string, object> FormToDic(string tablename, bool isprefixtableName = false)
        {
            if (isprefixtableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            var cols = DB.UniClient.DbMaintenance.GetColumnInfosByTableName(tablename);
            Dictionary <string, object> dic = new Dictionary <string, object>();

            foreach (var cinfo in cols)
            {
                if (cinfo.DbColumnName.ToLower() != "id" && FormCollection.ContainsKey(cinfo.DbColumnName))
                {
                    dic.Add(cinfo.DbColumnName, FormCollection[cinfo.DbColumnName]);
                }
            }
            return(dic);
        }