Example #1
0
        public virtual List <T> getFromToWithSrc(int from, int to, string srcClm, string srcValue)
        {
            string cmtext = query.getFromToWithSrc(from, to, srcClm);

            using (CommanderBase commander = DBContext.CreateCommander())
                return(commander.Reader <T>(cmtext, new List <DbParameter> {
                    commander.SetParametr(srcClm, srcValue)
                }));
        }
Example #2
0
        public virtual List <T> GetByColumName(string columName, object value)
        {
            string cmtext = query.GetByColumName(columName);

            using (CommanderBase commander = DBContext.CreateCommander())
                return(commander.Reader <T>(cmtext, new List <DbParameter>()
                {
                    commander.SetParametr(columName, value)
                }));
        }
Example #3
0
        public virtual (M, bool) GetByColumNameFist <M>(string columName, object value, params string[] selectColumn) where M : class, new()
        {
            string cmtext = query.GetByColumName <M>(columName, selectColumn);

            using (CommanderBase commander = DBContext.CreateCommander())
            {
                return(commander.ReaderFist <M>(cmtext, new List <DbParameter>()
                {
                    commander.SetParametr(columName, value)
                }));
            }
        }
Example #4
0
        public virtual bool Update <M>(string[] columns, object[] values, int id) where M : class, new()
        {
            string cmtext = query.Update <M>(id.ToString(), columns);
            var    p      = new List <DbParameter>();

            using (CommanderBase commander = DBContext.CreateCommander())
            {
                for (int i = 0; i < columns.Length; i++)
                {
                    p.Add(commander.SetParametr(columns[i], values[i]));
                }
                return(commander.NonQuery(cmtext, p));
            }
        }
Example #5
0
        public virtual int RowCountWithSrc(string srcClm, string srcValue)
        {
            string cmtext = query.RowCountWithSrc(srcClm);

            using (CommanderBase commander = DBContext.CreateCommander())
            {
                var o = commander.Scaller(cmtext, new List <DbParameter>()
                {
                    commander.SetParametr(srcClm, srcValue)
                });

                if (o != null)
                {
                    return(Convert.ToInt32(o));
                }
                else
                {
                    return(0);
                }
            }
        }