Exemple #1
0
 internal override QueryConverter CreateQueryConverter(SqlFactory sql)
 {
     return(new PgsqlQueryConverter(services, typeProvider, translator, sql)
     {
         ConverterStrategy = ConverterStrategy.CanUseJoinOn
     });;
 }
Exemple #2
0
        public void Initialize()
        {
            //Need to setup the logger first
            if (LoggingEnabled)
                LoggerProvider = Options.LoggerProvider ?? new SystemLoggerProviderLog4Net(this);

            _logger = LoggerProvider.CreateLogger(typeof(Settings));

            //Setting up the rest of the system
            _logger.Info("Settings - Setup Started");
            _logger.Debug(() => string.Format("Settings - Settings Extension Options - {0}", Options));

            var sqlFactory = new SqlFactory();

            var feedProvider = new NugetReleaseFeedProvider();
            var persistencyProvider = new ReleasePersistencyProvider(sqlFactory);
 
            QueryProvider = new CacheReleaseQueryProvider();

            ExistingReleaseService = new ExistingReleaseQueryService(QueryProvider);
            NewReleaseService = new NewReleaseQueryService(QueryProvider);
            UpdateReleaseRepositoryService = new UpdateReleaseRepositoryService(feedProvider, persistencyProvider);
            UpdateReleaseService = new UpdateReleaseService(this, UpdateReleaseRepositoryService, QueryProvider);
            ReleaseService = new ReleaseService(QueryProvider);

            _logger.Info("Settings - Setup Finished");

            //Run system setup
            _logger.Info("Settings - Pre Initialize");
             
            UpdateReleaseService.Execute(true);

            _logger.Info("Settings - Post Initialize");
        }
Exemple #3
0
        public static SqlFactory CreateInstance <T>()
            where T : System.Data.Common.DbProviderFactory
        {
            SqlFactory fac = CreateInstance <T>(null);

            return(fac);
        }
        public ActionResult VoteQuestionAdd()
        {
            DbUser             user = base.Session["user"] as DbUser;
            List <VotePersons> list = SqlFactory.GetSqlhelper().CreateWhere <VotePersons>().Where(o => o.VoteID == user.LimitVoteID).Select();

            base.ViewData["persons"] = list;
            return(base.View());
        }
        public ProposalRepository()
        {
            sqlcmd   = SqlFactory.MSSQL();
            prop     = new Proposal();
            propinfo = new ProposalInfo();

            // ...MoreComing.
        }
        public static void FactoryMethod()
        {
            DbFactory   dbFactory = new SqlFactory();
            IConnection sqlConn   = dbFactory.ConnectToDb();

            DbFactory   dbFactory2 = new OracleFactory();
            IConnection oracleConn = dbFactory2.ConnectToDb();
        }
Exemple #7
0
 // constructors
 public Database(DbModel dbModel, DbSettings settings)
 {
     this.DbModel = dbModel;
     Settings     = settings;
     _driver      = Settings.Driver;
     _timeService = dbModel.EntityApp.TimeService;
     SqlFactory   = new SqlFactory(dbModel);
 }
Exemple #8
0
 public int ExecuteNonQuery(string sql)
 {
     using (var command = SqlFactory.CreateCommand())
     {
         command.CommandText = sql;
         return(ExecuteNonQuery(command));
     }
 }
Exemple #9
0
        //public new DbConnection Connection
        //{
        //    get
        //    {
        //        this.CheckDispose();
        //        this.CheckInitialized();
        //        return ((Connection)this.conManager.Connection).Source;
        //    }
        //}

        internal override QueryConverter CreateQueryConverter(SqlFactory sql)
        {
            return(new SQLiteQueryConverter(services, typeProvider, translator, sql)
            {
                ConverterStrategy = ConverterStrategy.CanOutputFromInsert | ConverterStrategy.CanUseJoinOn |
                                    ConverterStrategy.CanUseOuterApply & ConverterStrategy.CanUseRowStatus
            });
        }
Exemple #10
0
 public virtual System.Collections.Generic.List <System.Data.IDbDataParameter> BuildParams__TokenKey()
 {
     System.Collections.Generic.List <System.Data.IDbDataParameter> paramlist = new System.Collections.Generic.List <System.Data.IDbDataParameter>();
     System.Data.IDbDataParameter p_TokenKey = SqlFactory.CreateParam("@TokenKey", System.Data.SqlDbType.VarChar);
     SetParameterValue(p_TokenKey, _TokenKey);
     paramlist.Add(p_TokenKey);
     return(paramlist);
 }
Exemple #11
0
 internal override QueryConverter CreateQueryConverter(SqlFactory sql)
 {
     return(new SqlQueryConverter(services, typeProvider, translator, sql)
     {
         ConverterStrategy = ConverterStrategy.CanUseJoinOn | ConverterStrategy.CanUseRowStatus |
                             ConverterStrategy.CanUseScopeIdentity
     });
 }
Exemple #12
0
 // Methods
 internal Translator(IDataServices services, SqlFactory sqlFactory, ITypeSystemProvider typeProvider,
                     SqlProvider provider)
 {
     this.services     = services;
     sql               = sqlFactory;
     this.typeProvider = typeProvider;
     this.provider     = provider;
 }
        public ActionResult VoteBonusAdd(TF.WeiXinVote.Data.VoteBonus bonus)
        {
            DbUser user = base.Session["user"] as DbUser;

            bonus.VoteID = user.LimitVoteID;
            SqlFactory.GetSqlhelper().Save <TF.WeiXinVote.Data.VoteBonus>(bonus);
            return(base.Success());
        }
        public ActionResult VotePageAdd(VotePages page)
        {
            DbUser user = base.Session["user"] as DbUser;

            page.VoteID = user.LimitVoteID;
            SqlFactory.GetSqlhelper().Save <VotePages>(page);
            return(base.Success());
        }
Exemple #15
0
        public async Task <List <SubTableInfo> > GetSubTableList(string conn, string tableName)
        {
            string sql = "SELECT * FROM Ray_SubTable where TableName=@TableName";

            using (var connection = SqlFactory.CreateConnection(conn))
            {
                return((await connection.QueryAsync <SubTableInfo>(sql, new { TableName = tableName })).AsList());
            }
        }
Exemple #16
0
        public BudgetRepository()
        {
            //string connString = Settings.Default.EntityConnection;
            //  Context = new BOTADBEntities1();
            Connection conn = new Connection();

            connectString = conn.GetDirectConnString();
            sqlcmd        = SqlFactory.MSSQL();
        }
        public AbstractUnitTest()
        {
            var sqlModule = new DBLibrary.Configuration.EntryPoint(typeof(Portal), "DBConnect");
            var kernel    = new StandardKernel(sqlModule.GetModules());

            BaseFactory.Instance = new BaseFactory(kernel);
            Factory = Database.Current.Factory;
            sqlModule.Load();
        }
Exemple #18
0
 public object ExecuteScalar(string sql)
 {
     using (var command = SqlFactory.CreateCommand())
     {
         command.CommandText = sql;
         command.Transaction = CurrentTransaction;
         return(ExecuteScalar(command));
     }
 }
Exemple #19
0
        /// <summary>
        ///     Deletes all rows from the specified Table
        /// </summary>
        public void TruncateTable(string tableName)
        {
            var connection = GetWriteConnection();

            using var command   = SqlFactory.CreateCommand();
            command.Connection  = connection;
            command.CommandText = $"DELETE FROM {tableName}";
            command.ExecuteNonQuery();
        }
        public ActionResult VoteQuestionEdit(int id)
        {
            VoteQuestions      model = SqlFactory.GetSqlhelper().SingleById <VoteQuestions>(id);
            DbUser             user  = base.Session["user"] as DbUser;
            List <VotePersons> list  = SqlFactory.GetSqlhelper().CreateWhere <VotePersons>().Where(o => o.VoteID == user.LimitVoteID).Select();

            base.ViewData["persons"] = list;
            return(base.View(model));
        }
        public ActionResult Index(string mobile = "")
        {
            List <VoteBonusRecord> model = new List <VoteBonusRecord>();

            if (!string.IsNullOrEmpty(mobile))
            {
                model = SqlFactory.GetSqlhelper().CreateWhere <VoteBonusRecord>().Where(o => o.UseDate == null).Where(o => o.Mobile == mobile).Select().Where(o => o.Bonus.Title != "现金红包").ToList();
            }
            return(base.View(model));
        }
        public ActionResult Get(PostModel postModel, string echostr, int id)
        {
            string token = SqlFactory.GetSqlhelper().SingleById <VoteInfos>(id).Token;

            if (CheckSignature.Check(postModel.Signature, postModel.Timestamp, postModel.Nonce, token))
            {
                return(base.Content(echostr));
            }
            return(base.Content("failed:" + postModel.Signature + "," + CheckSignature.GetSignature(postModel.Timestamp, postModel.Nonce, token) + "。如果你在浏览器中看到这句话,说明此地址可以被作为微信公众账号后台的Url,请注意保持Token一致。"));
        }
Exemple #23
0
 // Methods
 internal Visitor(Options options, IEnumerable <SqlParameter> parentParameters,
                  SqlFactory sqlFactory, SqlIdentifier sqlIdentity)
 {
     this.options          = options;
     this.sql              = sqlFactory;
     this.canJoin          = true;
     this.isTopLevel       = true;
     this.parentParameters = parentParameters;
     this.sqlIdentity      = sqlIdentity;
 }
Exemple #24
0
        /// <summary>
        /// Deletes all rows from the specified Table
        /// </summary>
        public void TruncateTable(string tableName)
        {
            var connection = GetConnection();

            using (var command = SqlFactory.CreateCommand())
            {
                command.Connection  = connection;
                command.CommandText = string.Format("DELETE FROM {0}", tableName);
                command.ExecuteNonQuery();
            }
        }
Exemple #25
0
 public virtual System.Collections.Generic.List <System.Data.IDbDataParameter> BuildParams__EndpointID_ContextID()
 {
     System.Collections.Generic.List <System.Data.IDbDataParameter> paramlist = new System.Collections.Generic.List <System.Data.IDbDataParameter>();
     System.Data.IDbDataParameter p_EndpointID = SqlFactory.CreateParam("@EndpointID", System.Data.SqlDbType.VarChar);
     SetParameterValue(p_EndpointID, _EndpointID);
     paramlist.Add(p_EndpointID);
     System.Data.IDbDataParameter p_ContextID = SqlFactory.CreateParam("@ContextID", System.Data.SqlDbType.VarChar);
     SetParameterValue(p_ContextID, _ContextID);
     paramlist.Add(p_ContextID);
     return(paramlist);
 }
Exemple #26
0
        private void GetPersonDetail()
        {
            string      name    = HttpContext.Current.Request.QueryString["person"];
            int         voteid  = int.Parse(HttpContext.Current.Request.QueryString["voteid"]);
            VotePersons persons = SqlFactory.GetSqlhelper().CreateWhere <VotePersons>().Where(o => (o.VoteID == voteid) && (o.RealName == name)).SingleOrDefault();

            if (persons != null)
            {
                HttpContext.Current.Response.Write(persons.Description);
            }
        }
Exemple #27
0
        public AccountRepository()
        {
            //  conn = new Connection();
            //  _configuration = ObjectFactory.GetInstance<IConfiguration>();

            account = new Account();
            sqlcmd  = SqlFactory.MSSQL();

            //Later we can add more like SqlFactory.Oracle(); Which will still have the same sqlcmd.GetUserByName(Username) methods.
            //How? StrucuteMapBootStrapper will switch the ISqlCommands to another Implementer!
        }
        public ActionResult VoteQuestionAdd(VoteQuestions question)
        {
            DbUser user = base.Session["user"] as DbUser;

            question.VoteID = user.LimitVoteID;
            if (string.IsNullOrEmpty(question.Person))
            {
                return(base.Error("请选择关联人员"));
            }
            SqlFactory.GetSqlhelper().Save <VoteQuestions>(question);
            return(base.Success());
        }
Exemple #29
0
 /// <summary>
 /// 쿼리를 실행하여 object을 반환하는 Web Method를 실행합니다.
 /// </summary>
 /// <param name="dbName">DB 연결정보</param>
 /// <param name="command">Command String</param>
 /// <param name="cmdType">Command Type</param>
 /// <param name="paramList">Command Parameters</param>
 /// <param name="valueList">Command Parameters Values</param>
 /// <param name="outParam"></param>
 /// <param name="outValue"></param>
 /// <returns></returns>
 /// <remarks>
 /// 2009-01-08 최초생성 : 황준혁
 /// 변경내역
 ///
 /// </remarks>
 public object NTx_ExecuteScalar(string dbName, string command, string cmdType, string[] paramList, object[] valueList, string[] outParam, ref object[] outValue)
 {
     try
     {
         SqlFactory wsProxy = new SqlFactory(_webUrl);
         return(wsProxy.NTx_ExecuteScalar(command, cmdType, paramList, valueList, outParam, ref outValue));
     }
     catch
     {
         throw;
     }
 }
Exemple #30
0
 /// <summary>
 /// DataTable을 사용하여 쿼리를 실행하여 Multi 처리하고 영향을 받은 Row 수를 반환하는 Web Method를 실행합니다.
 /// </summary>
 /// <param name="dbName">DB 연결정보</param>
 /// <param name="command">Command String</param>
 /// <param name="cmdType">Command Type</param>
 /// <param name="paramList">Command Parameters</param>
 /// <param name="dt">Command Parameters Values(DataTable)</param>
 /// <param name="outParam">Output Parameters</param>
 /// <param name="outValue">Output ParametersValue</param>
 /// <returns></returns>
 public int Tx_ExecuteNonQueryByDataTable(string dbName, string command, string cmdType, string[] paramList, DataTable dt, string[] outParam, ref object[] outValue)
 {
     try
     {
         SqlFactory wsProxy = new SqlFactory(_webUrl);
         return(wsProxy.Tx_ExecuteNonQueryByDataTable(command, cmdType, paramList, dt, outParam, ref outValue));
     }
     catch
     {
         throw;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["openid"] == null)
            {
                Fun.Error("参数错误");
            }
            string openid     = this.Session["openid"].ToString();
            var    enumerable = SqlFactory.GetSqlhelper().CreateWhere <VoteBonusRecord>().Where(o => o.OpenId == openid).Select();

            this.DataList.DataSource = enumerable;
            this.DataList.DataBind();
        }