/// <summary> /// Test Connection /// </summary> /// <returns></returns> public bool TestConnection(string connStringName = "", string dbType = "mysql") { ISQLHelper sqlHelper = null; switch (dbType.ToLower()) { case "mysql": sqlHelper = new MySqlHelper(); break; case "sqlserver": sqlHelper = new SqlServerHelper(); break; default: sqlHelper = new MySqlHelper(); break; } if (!string.IsNullOrWhiteSpace(connStringName) && !ConnectionStringsDic.ContainsKey(connStringName)) { ConnectionStringsDic[connStringName] = System.Configuration.ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; } if (string.IsNullOrWhiteSpace(connStringName)) { sqlHelper.ConnectionString = DefaultConnectionStrings; } else { sqlHelper.ConnectionString = ConnectionStringsDic[connStringName]; } return(sqlHelper.TestConnection()); }
/// <summary> /// 构造器 /// </summary> /// <param name="pReportGuid">报表标识</param> /// <param name="pReportUserInfo">用户信息</param> /// <param name="pSQLHelper">数据库操作类</param> public MstrReportUtil(int pMstrIntegrationSessionID, string pReportGuid, ReportUserInfo pReportUserInfo) { this._mstrIntegrationSessionID = pMstrIntegrationSessionID; this._mstrReportGuid = pReportGuid; this._currentUserInfo = pReportUserInfo; this._sqlHelper = new JIT.Utility.DataAccess.DefaultSQLHelper(ConfigurationManager.AppSettings["MstrIntegrationConn"]);; }
public ZhongXin() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); MyBLL = ZhongXinFactory.Create(); MySupplier = SupplierFactory.CreateSupplier(); DBHelper = SQLHelperFactory.CreateSQLHelper(); pub = new Public_Class(); sendmessages = new ZhongXinUtil.SendMessages(); //Supplier_ID = tools.CheckInt(Session["supplier_id"].ToString()); //佣金 CommissionAccNo = System.Configuration.ConfigurationManager.AppSettings["zhongxin_commissionaccno"]; CommissionAccNm = System.Configuration.ConfigurationManager.AppSettings["zhongxin_commissionaccnm"]; //交易保证金 GuaranteeAccNo = System.Configuration.ConfigurationManager.AppSettings["zhongxin_dealguaranteeaccno"]; GuaranteeAccNm = System.Configuration.ConfigurationManager.AppSettings["zhongxin_dealguaranteeaccnm"]; }
public BaseDAL() { DbInstance = new K(); TInstance = new T(); sqlhelper = new SQLHelper(DbInstance); dallogger = new Logger(); }
public ProductType() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); MyBrand = BrandFactory.CreateBrand(); MyProductTypeExtend = ProductTypeExtendFactory.CreateProductTypeExtend(); }
private ISQLHelper GetSQLHelper(SqlAnalyModel model) { if (model == null || string.IsNullOrWhiteSpace(model.SqlConnStringName)) { throw new Exception(string.Format("数据库连接配置不正确")); } ISQLHelper sqlHelper = null; switch (model.DBType.ToLower()) { case "mysql": sqlHelper = new MySqlHelper(); break; case "sqlserver": sqlHelper = new SqlServerHelper(); break; default: throw new Exception("暂不支持" + model.DBType + "数据库"); } if (!ConnectionStringsDic.ContainsKey(model.SqlConnStringName)) { ConnectionStringsDic[model.SqlConnStringName] = System.Configuration.ConfigurationManager.ConnectionStrings[model.SqlConnStringName].ConnectionString; } sqlHelper.ConnectionString = ConnectionStringsDic[model.SqlConnStringName]; if (string.IsNullOrWhiteSpace(sqlHelper.ConnectionString)) { throw new Exception(string.Format("数据库连接地址【{0}】不正确", model.SqlConnStringName)); } return(sqlHelper); }
/// <summary> /// 构造函数 /// </summary> /// <param name="pUserInfo">当前的用户信息</param> /// <param name="pIsLoggingTSQL">是否将所执行的TSQL语句以日志的形式记录下来</param> public BaseReportDAO(ReportUserInfo pUserInfo, bool pIsLoggingTSQL, ISQLHelper pSQLHelper) : base(pUserInfo, new DirectConnectionStringManager(null)) { this.SQLHelper = pSQLHelper; if (pIsLoggingTSQL) { //给数据访问助手挂载执行完毕事件,以记录所有执行的SQL this.SQLHelper.OnExecuted += new EventHandler <SqlCommandExecutionEventArgs>(SQLHelper_OnExecuted); } }
public SCMConfig() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
public KeywordBidding() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; DBHelper = SQLHelperFactory.CreateSQLHelper(); tools = ToolsFactory.CreateTools(); MyMessage = SupplierMessageFactory.CreateSupplierMessage(); MyBLL = KeywordBiddingFactory.CreateKeywordBidding(); }
private ISQLHelper GetSQLHelper(SqlAnalyModel model) { if (model == null) { throw new Exception(string.Format("数据库连接配置不正确")); } ISQLHelper sqlHelper = null; if (string.IsNullOrWhiteSpace(model.DBType)) { model.DBType = "mysql"; } sqlHelper = new AllHelper(); //switch (model.DBType.ToLower()) //{ // case "mysql": // sqlHelper = new MySqlHelper(); // break; // case "sqlserver": // sqlHelper = new SqlServerHelper(); // break; // default: // sqlHelper = new AllHelper(); // break; //} sqlHelper.DBType = model.DBType; if (!string.IsNullOrWhiteSpace(model.SqlConnStringName)) { if (!ConnectionStringsDic.ContainsKey(model.SqlConnStringName)) { ConnectionStringsDic[model.SqlConnStringName] = System.Configuration.ConfigurationManager.ConnectionStrings[model.SqlConnStringName].ConnectionString; } sqlHelper.ConnectionString = ConnectionStringsDic[model.SqlConnStringName]; } if (string.IsNullOrWhiteSpace(sqlHelper.ConnectionString)) { if (string.IsNullOrWhiteSpace(DefaultConnectionStrings)) { throw new Exception(string.Format("数据库连接配置不正确")); } sqlHelper.ConnectionString = DefaultConnectionStrings; } if (model.Timeout >= 0) { sqlHelper.Timeout = model.Timeout; } return(sqlHelper); }
public AD() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; DBHelper = SQLHelperFactory.CreateSQLHelper(); tools = ToolsFactory.CreateTools(); MyAD = ADFactory.CreateAD(); Mychannel = AD_Position_ChannelFactory.CreateAD_Position_Channel(); Myposition = ADPositionFactory.CreateADPosition(); supplier = new Supplier(); }
public SupplierStatistics() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); JsonHelper = JsonHelperFactory.CreateJsonHelper(); product = new Product(); pub = new Public_Class(); supplier = new Supplier(); pageurl = new PageURL(); category = CategoryFactory.CreateCategory(); }
public bool init(string datasource) { //if (sqlHelper == null) { string conn = CFunctions.getConfigName(datasource); if (!string.IsNullOrEmpty(conn)) { sqlHelper = new SQLHelper(conn); return(true); } else { return(false); } // } // return true; }
private ISQLHelper GetSQLHelper(SqlAnalyModel model) { ISQLHelper sqlHelper = null; switch (model.DBType.ToLower()) { case "mysql": sqlHelper = new MySqlHelper(model.SqlConnStringName); break; case "sqlserver": sqlHelper = new SqlServerHelper(model.SqlConnStringName); break; default: throw new Exception("暂不支持" + model.DBType + "数据库"); } return(sqlHelper); }
public SCMPurchasing() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); depot = new SCMDepot(); supplier = new SCMSupplier(); PROBLL = ProductFactory.CreateProduct(); PROTYPEBLL = ProductTypeFactory.CreateProductType(); BRANDBLL = BrandFactory.CreateBrand(); }
public Suppliers() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); JsonHelper = JsonHelperFactory.CreateJsonHelper(); product = new Product(); pub = new Public_Class(); supplier = new Supplier(); pageurl = new PageURL(); category = CategoryFactory.CreateCategory(); MyPro = ProductFactory.CreateProduct(); MyShop = Glaer.Trade.B2C.BLL.MEM.SupplierShopFactory.CreateSupplierShop(); }
private ColumnProperty(ISQLHelper helper, PropertyInfo info, bool primaryKey = false) { Info = info; Helper = helper; ColumnAttribute attr = ColumnAttribute.GetAttribute(info); if (attr != null) { Name = attr.Name; Type = attr.Type; HasAttribute = true; Column = attr; } if (Name == null) { Name = info.Name; } if (Type == null) { Type = info.PropertyType; } IsPrimaryKey = primaryKey || (HasAttribute && Column.IsPrimaryKey); }
static void Main(string[] args) { try { #region 1.0 特性封装 Console.WriteLine("*************特性封装********************"); string strAndroid = MobileEnum.Android.GetRemark(); string strIOS = MobileEnum.IOS.GetRemark(); Console.WriteLine($"android备注:{strAndroid},ios的备注{strIOS}"); #endregion #region 2.0 封装方法 Console.WriteLine("*************Unity 使用********************"); //初始化unity IOCFactory.InitContainer(); Person person = new Person(); person.Address = "哈哈哈11111111"; person.Name = "dark"; person.Email = "*****@*****.**"; person.Phone = "18652428020"; ISQLHelper sqlHelper = IOCFactory.Resolve <ISQLHelper>(); sqlHelper.Insert <Person>(person); #endregion } catch (Exception ex) { Console.WriteLine($"系统异常:{ex.Message.ToString()}"); throw; } Console.ReadLine(); }
public static Dictionary <string, ColumnProperty> GetCollumns(ISQLHelper helper, Type type, bool allProps = false, params string[] primaryKeys) { if (!Cache.ContainsKey(type)) { Dictionary <string, ColumnProperty> columns = new Dictionary <string, ColumnProperty>(); foreach (PropertyInfo info in type.GetProperties()) { if (SQLHelper.IsSupportedType(info.PropertyType)) { ColumnProperty column = new ColumnProperty(helper, info); if (column.HasAttribute) { columns.Add(column.Name, column); } else if (allProps) { columns.Add(info.Name, new ColumnProperty(helper, info, primaryKeys.Contains(info.Name))); } } } Cache.Add(type, columns); } return(Cache[type]); }
public PictureRepository(ISQLHelper helper) { this.helper = helper; }
public OrdersDelivery() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
public CommonBiz() { sqlHelper = SQLHelper.SQLHelperFactory(); }
public Sources() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
public ProductReview() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
public ContractDividedPayment() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
/// <summary> /// Constructor /// </summary> /// <param name="sqlHelper">SQL Helper for execute sql commands</param> public SQLRepository(ISQLHelper sqlHelper) { _sqlHelper = sqlHelper; ExtractTableColumnInfo(); }
public OrdersLog() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
/// <summary> /// 构造函数 /// </summary> public MobileCommandRecordBLL(MobileDeviceManagementUserInfo pUserInfo, ISQLHelper pSQLHelper) { this._currentDAO = new MobileCommandRecordDAO(pUserInfo, pSQLHelper); }
public LogisticsLine() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }
public SupplierOnline() { Tools = ToolsFactory.CreateTools(); DBHelper = SQLHelperFactory.CreateSQLHelper(); }