Exemplo n.º 1
0
        public eTrainingOnlineEntities getTrainingOnlineCenterInfo()
        {
            string           providerName = "System.Data.SqlClient";
            ConnectionEntity objEntity    = getConnEntityOnlineInfo();

            SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();

            sqlBuilder.DataSource               = objEntity.serverName;
            sqlBuilder.InitialCatalog           = objEntity.databaseName;
            sqlBuilder.UserID                   = objEntity.userName;
            sqlBuilder.Password                 = objEntity.password;
            sqlBuilder.MultipleActiveResultSets = true;

            string providerString = sqlBuilder.ToString();

            EntityConnectionStringBuilder objEcsb = new EntityConnectionStringBuilder();

            objEcsb.Provider = providerName;
            objEcsb.ProviderConnectionString = providerString;
            //objEcsb.Metadata = @"res://*/eCenterTrainning.csdl|res://*/eCenterTrainningOffline.ssdl|res://*/eCenterTrainningOffline.msl";
            objEcsb.Metadata = @"res://*/eTrainingOnlineModel.csdl|res://*/eTrainingOnlineModel.ssdl|res://*/eTrainingOnlineModel.msl";
            EntityConnection objConnection = new EntityConnection(objEcsb.ToString());

            //TrainingCenterOfflineEntities objTraining = new TrainingCenterOfflineEntities(objConnection.ToString());
            eTrainingOnlineEntities objTraining = new eTrainingOnlineEntities(objEcsb.ToString());

            return(objTraining);
        }
Exemplo n.º 2
0
        public ConnectionEntity getConnEntityOnlineInfo()
        {
            ConnectionEntity obj = new ConnectionEntity();

            obj.serverName   = DecryptInfo("" + ConfigurationManager.AppSettings["iMICServer"]);
            obj.databaseName = DecryptInfo("" + ConfigurationManager.AppSettings["iMICDatabase"]);
            obj.userName     = DecryptInfo("" + ConfigurationManager.AppSettings["iMICUser"]);
            obj.password     = DecryptInfo("" + ConfigurationManager.AppSettings["iMICPass"]);
            return(obj);
        }