示例#1
0
        public List <EnumData> QueryEnumMember(string enumName, bool isContainerDelete)
        {
            Dictionary <string, string> columns = SqlCmdHelper.GenerateColumnMapPropertyDict <EnumData>();

            string[] col = columns.Keys.ToArray();
            EnumData ed  = new EnumData()
            {
                Code = enumName
            };
            string sql = ed.QueryEnumMembersSqlFormat(col, isContainerDelete);

            return(CommonRepository.QueryModels <EnumData, EnumData>(sql, ed, SqlConnString));
        }
示例#2
0
        public bool SaveMaybeSpecialWord(char word, string spellName, out object responseCode)
        {//存储疑似生僻字
            string         cmd   = @"EXEC	@return_value = [dbo].[SP_VerifyAndAddMaybeSpellName]
		@Name = @Name,
		@Code =@Code,
		@result = @result OUTPUT"        ;
            MaybeSpellName maybe = new MaybeSpellName()
            {
                Name = word.ToString(),
                Code = spellName
            };

            return(CommonRepository.RunProcedureNoQuery(cmd, SqlConnString, maybe, "@result", SqlDbType.Int, out responseCode) > 0);
        }
        public List <CategoryItems> GetNodeListByParent(string parentNodeCode)
        {
            List <CategoryItems> datas = new List <CategoryItems>();
            CategoryItems        model = new CategoryItems();
            string sql = model.BuilderSqlParam();

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter()
                {
                    ParameterName = "@code", Value = parentNodeCode
                }
            };
            return(CommonRepository.QueryModelList <CategoryItems>(sql, param, SqlConnString, 0, int.MaxValue));
        }
        public int BatchChangeSpell(Dictionary <int, string> idWithSpells)
        {
            if (idWithSpells.Count == 0)
            {
                return(idWithSpells.Count);
            }
            List <CategoryItems> entities = new List <CategoryItems>();

            foreach (var item in idWithSpells)
            {
                CategoryItems spell = new CategoryItems()
                {
                    Id = item.Key, IndexSpell = item.Value
                };
                entities.Add(spell);
            }
            string sql = entities[0].GetChangeSpellWord();

            return(CommonRepository.ExtBatchInsert(sql, SqlConnString, entities));
        }
        public int Count(RequestParam param)
        {
            string sql = SqlCmdHelper.GenerateCountSql <Organze>();
            List <SqlParameter> sqlParam = new List <SqlParameter>();

            if (!string.IsNullOrEmpty(param.QueryKey))
            {
                sql += "and  Code like @key+'%' or Name like @key+'%'";
                sqlParam.Add(new SqlParameter()
                {
                    ParameterName = "@key", Value = param.QueryKey
                });
            }
            SqlCmdHelper help = new SqlCmdHelper()
            {
                SqlConnString = SqlConnString
            };

            return(CommonRepository.ExecuteCount(sql, sqlParam.ToArray(), SqlConnString));
        }
        public List <Organze> QueryOrganzes(RequestParam param)
        {
            string sql = SqlCmdHelper.GenerateSampleSelectSql <Organze>() + " where 1=1";
            List <SqlParameter> sqlParam = new List <SqlParameter>();

            if (!string.IsNullOrEmpty(param.QueryKey))
            {
                sql += "and  Code like @key+'%' or Name like @key+'%'";
                sqlParam.Add(new SqlParameter()
                {
                    ParameterName = "@key", Value = param.QueryKey
                });
            }
            SqlCmdHelper help = new SqlCmdHelper()
            {
                SqlConnString = SqlConnString
            };

            return(CommonRepository.QueryModelList <Organze>(sql, sqlParam.ToArray(), SqlConnString, param.RowBeginIndex, param.RowEndIndex));
        }
示例#7
0
        public bool WriteLog(ELogType type, string log, string title, bool isNormalLog)
        {
            DateTime appTime = Domain.GlobalModel.AppRunData.RunTime;//程序启动时的时间
            LogData  data    = new LogData()
            {
                CreateTime = DateTime.Now,
                Category   = (short)type.GetHashCode(),
                Id         = Guid.NewGuid(),
                IsError    = !isNormalLog,
                Note       = log,
                Title      = title
            };

            data.DayInt = int.Parse(data.CreateTime.ToString(CommonFormat.DateIntFormat));
            SqlCmdHelper cmd = new SqlCmdHelper()
            {
                SqlConnString = SqlConnString
            };
            string sql = SqlCmdHelper.GenerateInsertSql <LogData>();

            return(CommonRepository.ExtInsert(sql, SqlConnString, data));
            // throw new NotImplementedException();
        }
        public List <Domain.CommonData.FindQQDataTable> QueryUinList(DateTime beginTime, DateTime endTime, int beginRow, int endRow, out int count)
        {//必须声明标量变量 "@return_value
            string sql             = @" EXEC @return_value = [dbo].[SP_QueryAccount]
		@beginDayInt=@bi ,
		@endDayInt=@ei ,
		@beginRow=@br,
		@endRow=@er,
		@total=@total  OUTPUT "        ;
            List <SqlParameter> ps = new List <SqlParameter>();
            string format          = "yyyyMMdd";//String[4]: Size 属性具有无效大小值 0

            ps.Add(new SqlParameter()
            {
                ParameterName = "@beginDayInt", Value = int.Parse(beginTime.ToString(format)), DbType = DbType.Int32
            });
            ps.Add(new SqlParameter()
            {
                ParameterName = "@endDayInt", Value = int.Parse(endTime.ToString(format)), DbType = DbType.Int32
            });
            ps.Add(new SqlParameter()
            {
                ParameterName = "@beginRow", Value = beginRow, DbType = DbType.Int32
            });
            ps.Add(new SqlParameter()
            {
                ParameterName = "@endRow", Value = endRow, DbType = DbType.Int32
            });
            ps.Add(new SqlParameter()
            {
                ParameterName = "@total", Direction = ParameterDirection.Output, DbType = DbType.Int32
            });
            List <FindQQDataTable> data = CommonRepository.QuerySPModelList <FindQQDataTable>("SP_QueryAccount", ps.ToArray(), SqlConnString, 0, int.MaxValue);

            count = (int)ps[ps.Count - 1].Value;
            return(data);
        }
示例#9
0
        public List <LogData> QueryLogs(RequestParam param, out int total)
        {
            string day = param.BeginTime;

            if (string.IsNullOrEmpty(day))
            {
                day = DateTime.Now.ToString(Common.Data.CommonFormat.DateFormat);
            }
            total = 0;
            if (param.RowEndIndex < param.RowBeginIndex)
            {
                return(new List <LogData>());
            }
            //将这个日期转换为指定的日期串【兼容传递的值为 date或者datetime】
            DateTime qd     = DateTime.ParseExact(day, Common.Data.CommonFormat.DateFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None);
            int      dayInt = int.Parse(qd.ToString(Common.Data.CommonFormat.DateIntFormat));
            //exec SP_QueryDayLog 20180705 ,1,200,@total out 使用这样的形式没法获取到输出参数,修改未调用存储过程
            List <SqlParameter> ps = new List <SqlParameter>();
            string exec            = "  exec SP_QueryDayLog {day},{beginRow},{endRow} ,{total} output";

            /*
             * 如果存在一个参数被赋值:
             * 必须传递参数 4,并以 '@name = value' 的形式传递后续的参数。一旦使用了 '@name = value' 形式之后,所有后续的参数就必须以 '@name = value' 的形式传递。
             */
            LogQueryParam p = new LogQueryParam()
            {
                day = dayInt, beginRow = param.RowBeginIndex, endRow = param.RowEndIndex
            };
            Dictionary <ParameterDirection, string[]> dict = new Dictionary <ParameterDirection, string[]>();

            dict.Add(ParameterDirection.Output, new string[] { "total" });
            List <LogData> data = CommonRepository.QueryModels <LogData, LogQueryParam>(exec, p, SqlConnString, dict);

            total = p.total;
            return(data);
        }
示例#10
0
 public void BulkSave(List <MaybeSpellName> rows)
 {
     CommonRepository.BulkSave <MaybeSpellName>(typeof(MaybeSpellName).Name, SqlConnString, rows);
 }
示例#11
0
        public bool SaveNote(ReportNote note)
        {
            string sql = note.GetInsertSql();

            return(CommonRepository.ExtInsert <ReportNote>(sql, SqlConnString, note));
        }