public override void Update(DBTypes target) { switch (target) { case DBTypes.Person: break; case DBTypes.Name: Filter = filter; break; case DBTypes.NameGroup: NameGroups = db.NameGroups.ToList(); break; case DBTypes.Event: break; case DBTypes.Place: break; default: break; } }
public override void Update(DBTypes target) { switch (target) { case DBTypes.Person: break; case DBTypes.Name: SimilarNames = db.Names.Where(n => n.NameRaw.Contains(RawName)).ToList(); break; case DBTypes.NameGroup: NameGroupFilter = NameGroupFilter; break; case DBTypes.Event: break; case DBTypes.Place: break; default: break; } }
public PocoFrom() { InitializeComponent(); var dbTypes = new DBTypes(); dbTypes.Add(new DBType() {Name = "MSSQL"}); dbTypes.Add(new DBType() {Name = "Oracle"}); this.ddlDbType.DataSource = dbTypes; this.ddlDbType.DisplayMember = "Name"; this.ddlDbType.ValueMember = "Name"; this.ddlDbType.SelectedIndex = 0; //設定預設值 tbxHost.Text = ConfigHelper.HostIp; tbxPort.Text = ConfigHelper.Port; tbxUserName.Text = ConfigHelper.UserId; tbxPwd.Text = ConfigHelper.UserPwd; tbxDBName.Text = ConfigHelper.DbName; tbxDBOwner.Text = ConfigHelper.DbOwner; cbxValidateByWindow.Checked = ConfigHelper.ValidateByWindow; ddlDbType.SelectedIndex = ConfigHelper.DbType; this.tbxPort.Enabled = false; this.tbxDBOwner.Enabled = false; this.cbxOriColumnName.Checked = true; this.rblReadMe.LoadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ReadMe.txt"), RichTextBoxStreamType.PlainText); }
public static CoreNHibernate.ISessionFactory CreateSessionFactory(DBTypes dbType) { FluentConfiguration config = Fluently.Configure(); switch (dbType) { case DBTypes.Oracle: config = OracleHelper.ConfigurationFactory(); break; case DBTypes.MSSQL: config = MsSqlHelper.ConfigurationFactory(); break; case DBTypes.SQLite: config = SQLiteHelper.ConfigurationFactory(); break; case DBTypes.MySQL: default: throw new NotImplementedException("Not implemented yet..."); } var enversConf = new EnversNHibernate.Configuration.Fluent.FluentConfiguration(); List <Type> domainEntities = Assembly.GetAssembly(typeof(Clients)).GetTypes() // Assembly.Load("bilisimHR.DataLayer.Core").GetTypes() .Where(t => (typeof(Entity <int>).IsAssignableFrom(t) && !t.IsGenericType)) .ToList(); foreach (Type type in domainEntities) { enversConf.Audit(type); } CoreNHibernate.Cfg.Configuration cfg = new CoreNHibernate.Cfg.Configuration(); cfg = config.BuildConfiguration(); cfg.BuildMappings(); cfg.SetInterceptor(new TrackingInterceptor()); //Envers RevType Values //0(ADD), 1(MODIFY) and 2(DELETE) ConfigurationKey.AuditTableSuffix.SetUserValue(cfg, "_LOG"); IRevisionInfoService revInfoService = new RevisionInfoService(); // Service Locator Registry ServiceLocator.RegisterService(revInfoService); ServiceLocator.RegisterService(new HttpRequestMessageService()); enversConf.SetRevisionEntity <CustomRevInfo>(e => e.Id, e => e.RevisionDate, new CustomRevInfoListener()); cfg.IntegrateWithEnvers(enversConf); config.ExposeConfiguration(exp => new SchemaUpdate(cfg).Execute(false, true)) .ExposeConfiguration(c => { c.CurrentSessionContext <CoreNHibernate.Context.CallSessionContext>(); }); //config.ExposeConfiguration(exp => new SchemaExport(cfg).Execute(true, true, false)); return(config.BuildSessionFactory()); }
public static IDBScriptGenerator CreateGenerator(DBTypes type) { switch (type) { case DBTypes.MSSQL: return(new MssqlScriptGenerator()); case DBTypes.ORACLE: return(new OracleScriptGenerator()); default: return(null); } }
private DataTypeDatabaseType ConvertDBTypesToDataTypeDatabaseType(DBTypes legacyValue) { switch (legacyValue) { case DBTypes.Date: return(DataTypeDatabaseType.Date); case DBTypes.Integer: return(DataTypeDatabaseType.Integer); case DBTypes.Ntext: return(DataTypeDatabaseType.Ntext); default: // case DBTypes.Nvarchar: return(DataTypeDatabaseType.Nvarchar); } }
/// <summary> /// Returns the data column for the data base where the value resides based on the dbType /// </summary> /// <param name="dbType"></param> /// <returns></returns> internal static string GetDataFieldName(DBTypes dbType) { switch (dbType) { case DBTypes.Date: return("dataDate"); case DBTypes.Integer: return("dataInt"); case DBTypes.Ntext: return("dataNtext"); case DBTypes.Nvarchar: return("dataNvarchar"); default: return("dataNvarchar"); } }
public PocoFrom() { InitializeComponent(); var dbTypes = new DBTypes(); dbTypes.Add(new DBType() { Name = "MSSQL" }); dbTypes.Add(new DBType() { Name = "Oracle" }); this.ddlDbType.DataSource = dbTypes; this.ddlDbType.DisplayMember = "Name"; this.ddlDbType.ValueMember = "Name"; this.ddlDbType.SelectedIndex = 0; //設定預設值 tbxHost.Text = ConfigHelper.HostIp; tbxPort.Text = ConfigHelper.Port; tbxUserName.Text = ConfigHelper.UserId; tbxPwd.Text = ConfigHelper.UserPwd; tbxDBName.Text = ConfigHelper.DbName; tbxDBOwner.Text = ConfigHelper.DbOwner; cbxValidateByWindow.Checked = ConfigHelper.ValidateByWindow; ddlDbType.SelectedIndex = ConfigHelper.DbType; this.tbxPort.Enabled = false; this.tbxDBOwner.Enabled = false; this.cbxOriColumnName.Checked = true; this.rblReadMe.LoadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ReadMe.txt"), RichTextBoxStreamType.PlainText); }
public override void Update(DBTypes target) { switch (target) { case DBTypes.Person: Persons = db.Persons.OrderBy(p => p.FirstnameRaw).ToList(); break; case DBTypes.Name: SelectedPerson = SelectedPerson; break; case DBTypes.NameGroup: SelectedPerson = SelectedPerson; break; case DBTypes.Event: SelectedPerson = SelectedPerson; break; case DBTypes.Place: break; } }
private DataTypeDatabaseType ConvertDBTypesToDataTypeDatabaseType(DBTypes legacyValue) { switch (legacyValue) { case DBTypes.Date: return DataTypeDatabaseType.Date; case DBTypes.Integer: return DataTypeDatabaseType.Integer; case DBTypes.Ntext: return DataTypeDatabaseType.Ntext; default: // case DBTypes.Nvarchar: return DataTypeDatabaseType.Nvarchar; } }
/// <summary> /// Initializes a new instance of the <see cref="AbstractJsonPrevalueEditor"/> class. /// </summary> /// <param name="dataType">Type of the data.</param> /// <param name="dbType">Type of the database field.</param> public AbstractJsonPrevalueEditor(BaseDataType dataType, DBTypes dbType) : base() { this.m_DataType = dataType; this.m_DataType.DBType = dbType; }
/// <summary> /// /// </summary> /// <param name="fileName"></param> /// <param name="removeReverse"></param> /// <param name="removeIPIVersionNumber"></param> /// <param name="considerOnlyFirstName"></param> /// <param name="useRegexForTitleOrDescription">If you wish to only consider items that have certain words in their descriptions or names. You should also set the Regex parameter</param> /// <param name="theRegex"></param> public void ParseFile( StreamReader sr, bool removeReverse, DBTypes dbType, bool useRegexForTitleOrDescription = false, Regex theRegex = null ) { //Prepare the stream Reader variables string read; Regex ipiVersion = new Regex(@"\.[0-9]+", RegexOptions.Compiled); Regex ipiRemove = new Regex(@">IPI:", RegexOptions.Compiled); Regex NextProtIDRegex = new Regex(@">nxp:([A-Z|0-9|\-|_]+) ", RegexOptions.Compiled); Regex correctIPI = new Regex(@"^\|>", RegexOptions.Compiled); Regex spaceSplitter = new Regex(@" ", RegexOptions.Compiled); Regex SequestFriendlyGI = new Regex(@">gi\|([0-9]*)", RegexOptions.Compiled); Regex SequestFriendlyGIDescription = new Regex(@">[^ ]* (.*)", RegexOptions.Compiled); Regex SequestFriendlyIPI = new Regex(@"IPI:(IPI[0-9|\.]+)\|", RegexOptions.Compiled); Regex SequestFriendlyIPIDescription = new Regex(@"Tax_Id=[0-9]+ Gene_Symbol=(.*)", RegexOptions.Compiled); Regex SequestFriendUniProt = new Regex(@"[a-z]+\|([A-Z|0-9|\-]+)\|", RegexOptions.Compiled); Regex SequestFriendlyUniProtDescription = new Regex(@" (.*)"); Regex TitleSpaceDescriptionID = new Regex(@">(\S+)", RegexOptions.Compiled); Regex TitleSpaceDescriptionDescription = new Regex(@" (.*)", RegexOptions.Compiled); //Declare the PathCandidates we will use //Parse and load to Ram FastaItem item = new FastaItem(); int SequenceCounter = 0; int lineCounter = 0; int problematicCounter = 0; while ((read = sr.ReadLine()) != null) { lineCounter++; if (read.StartsWith(">")) { if (SequenceCounter > 0) { if (useRegexForTitleOrDescription) { if (theRegex.IsMatch(item.SequenceIdentifier) || theRegex.IsMatch(item.Description)) { myItems.Add(item); } } else { myItems.Add(item); } } else { SequenceCounter++; } //---Parse search engine friendly item = new FastaItem(); Match id; Match description; if (dbType.Equals(DBTypes.NCBInr)) { id = SequestFriendlyGI.Match(read); description = SequestFriendlyGIDescription.Match(read); item.Description = description.Groups[1].Value; } else if (dbType.Equals(DBTypes.IPI)) { id = SequestFriendlyIPI.Match(read); description = SequestFriendlyIPIDescription.Match(read); item.Description = description.Groups[1].Value; } else if (dbType.Equals(DBTypes.IDSpaceDescription)) { id = TitleSpaceDescriptionID.Match(read); description = TitleSpaceDescriptionDescription.Match(read); item.Description = description.Groups[1].Value; } else if (dbType.Equals(DBTypes.UniProt)) { id = SequestFriendUniProt.Match(read); description = SequestFriendlyUniProtDescription.Match(read); item.Description = description.Groups[1].Value; } else if (dbType.Equals(DBTypes.NeXtProt)) { id = NextProtIDRegex.Match(read); List <string> cols = Regex.Split(read, Regex.Escape(@"\")).ToList(); string desc = cols.Find(a => a.StartsWith("Pname=")); item.Description = desc.Remove(0, 6); } else if (dbType.Equals(DBTypes.Contaminant)) { //we are working with dbtypes = all id = Regex.Match(read, @">(.*)"); //we do not want a match in the description description = Regex.Match(read, @"cvbcvbfgz"); item.Description = description.Groups[1].Value; } else { string[] cols = Regex.Split(read, " "); id = Regex.Match(cols[0], @">(.*)"); try { string desc = read.Substring(id.Length + 1); description = Regex.Match(desc, @"(.*)"); item.Description = description.Groups[1].Value; } catch { item.Description = "No Description"; } } if (id.Groups[1].Value.Length == 0) { item.SequenceIdentifier = "ProblematicID" + problematicCounter++; Console.WriteLine("Problem parsing identifier: " + lineCounter + " problem:" + problematicCounter); } else { item.SequenceIdentifier = id.Groups[1].Value; } //------------ } else { item.Sequence += read; } } Console.WriteLine(lineCounter + "lines parsed in the fasta DB."); //And now for the last item if (useRegexForTitleOrDescription) { if (theRegex.IsMatch(item.SequenceIdentifier) || theRegex.IsMatch(item.Description)) { myItems.Add(item); } } else { myItems.Add(item); } if (removeReverse) { myItems.RemoveAll(a => a.SequenceIdentifier.Contains("Reverse_")); } sr.Close(); }
public DBController(DBTypes type) { myDBType = type; }
/// <summary> /// This is used internally for performance reasons since we are querying for all of the data properties at once in the /// DefaultData object, therefore, the DefaultDataObject will set these properties manually instead of incurring a bunch /// of additional SQL calls. /// </summary> /// <param name="dataField"></param> /// <param name="dataType"></param> internal void SetDataTypeProperties(string dataField, DBTypes dataType) { _datafield = dataField; _DBType = dataType; }
public static string GetConnectioonString(this IServiceCollection services, IConfiguration Configuration, DBTypes dbTypes = DBTypes.MS) { var connectionString = Environment.GetEnvironmentVariable("TIMETRACKER_CONNECTIONNSTRING"); if (string.IsNullOrWhiteSpace(connectionString)) { connectionString = Configuration.GetConnectionString(dbTypes.ToString()); } return(connectionString); }
public DBController() { // Default DB Type is MYSQL myDBType = DBTypes.MySQL; }
/// <summary> /// Returns the data column for the data base where the value resides based on the dbType /// </summary> /// <param name="dbType"></param> /// <returns></returns> internal static string GetDataFieldName(DBTypes dbType) { switch (dbType) { case DBTypes.Date: return "dataDate"; case DBTypes.Integer: return "dataInt"; case DBTypes.Ntext: return "dataNtext"; case DBTypes.Nvarchar: return "dataNvarchar"; default: return "dataNvarchar"; } }
/// <summary> /// Initializes a new instance of the <see cref="NoOptionsPrevalueEditor"/> class. /// </summary> /// <param name="dataType">Type of the data.</param> /// <param name="dbType">Type of the db.</param> public NoOptionsPrevalueEditor(BaseDataType dataType, DBTypes dbType) : base() { this.m_DataType = dataType; this.m_DataType.DBType = dbType; }
/// <summary> /// Initializes a new instance of the <see cref="AbstractJsonPrevalueEditor"/> class. /// </summary> /// <param name="dataType">Type of the data.</param> /// <param name="dbType">Type of the database field.</param> protected AbstractJsonPrevalueEditor(BaseDataType dataType, DBTypes dbType) : base() { this.DataType = dataType; this.DataType.DBType = dbType; }
public static bool Get(string Atom_WorkPeriod_Type_Name, string Atom_WorkPeriod_Type_Description, long Atom_myOrganisation_Person_ID, long Atom_WorkingPlace_ID, long Atom_Computer_ID, long Atom_ElectronicDevice_ID, DateTime Login_time, DBTypes.DateTime_v Logout_time_v, ref long Atom_WorkPeriod_ID) { long Atom_WorkPeriod_Type_ID = -1; if (f_Atom_WorkPeriod_Type.Get(Atom_WorkPeriod_Type_Name, Atom_WorkPeriod_Type_Description, ref Atom_WorkPeriod_Type_ID)) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string scond_Atom_WorkPeriod_Type_ID = null; string sval_Atom_WorkPeriod_Type_ID = "null"; if (Atom_WorkPeriod_Type_ID >= 0) { string spar_Atom_WorkPeriod_Type_ID = "@par_Atom_WorkPeriod_Type_ID"; SQL_Parameter par_Atom_WorkPeriod_Type_ID = new SQL_Parameter(spar_Atom_WorkPeriod_Type_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_WorkPeriod_Type_ID); lpar.Add(par_Atom_WorkPeriod_Type_ID); scond_Atom_WorkPeriod_Type_ID = "Atom_WorkPeriod_Type_ID = " + spar_Atom_WorkPeriod_Type_ID; sval_Atom_WorkPeriod_Type_ID = spar_Atom_WorkPeriod_Type_ID; } else { scond_Atom_WorkPeriod_Type_ID = "Atom_WorkPeriod_Type_ID is null"; sval_Atom_WorkPeriod_Type_ID = "null"; } string scond_Atom_myOrganisation_Person_ID = null; string sval_Atom_myOrganisation_Person_ID = "null"; if (Atom_myOrganisation_Person_ID >= 0) { string spar_Atom_myOrganisation_Person_ID = "@par_Atom_myOrganisation_Person_ID"; SQL_Parameter par_Atom_myOrganisation_Person_ID = new SQL_Parameter(spar_Atom_myOrganisation_Person_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_myOrganisation_Person_ID); lpar.Add(par_Atom_myOrganisation_Person_ID); scond_Atom_myOrganisation_Person_ID = "Atom_myOrganisation_Person_ID = " + spar_Atom_myOrganisation_Person_ID; sval_Atom_myOrganisation_Person_ID = spar_Atom_myOrganisation_Person_ID; } else { scond_Atom_myOrganisation_Person_ID = "Atom_myOrganisation_Person_ID is null"; sval_Atom_myOrganisation_Person_ID = "null"; } string scond_Atom_WorkingPlace_ID = null; string sval_Atom_WorkingPlace_ID = "null"; if (Atom_WorkingPlace_ID >= 0) { string spar_Atom_WorkingPlace_ID = "@par_Atom_WorkingPlace_ID"; SQL_Parameter par_Atom_WorkingPlace_ID = new SQL_Parameter(spar_Atom_WorkingPlace_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_WorkingPlace_ID); lpar.Add(par_Atom_WorkingPlace_ID); scond_Atom_WorkingPlace_ID = "Atom_WorkingPlace_ID = " + spar_Atom_WorkingPlace_ID; sval_Atom_WorkingPlace_ID = spar_Atom_WorkingPlace_ID; } else { scond_Atom_WorkingPlace_ID = "Atom_WorkingPlace_ID is null"; sval_Atom_WorkingPlace_ID = "null"; } string scond_Atom_Computer_ID = null; string sval_Atom_Computer_ID = "null"; if (Atom_Computer_ID >= 0) { string spar_Atom_Computer_ID = "@par_Atom_Computer_ID"; SQL_Parameter par_Atom_Computer_ID = new SQL_Parameter(spar_Atom_Computer_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_Computer_ID); lpar.Add(par_Atom_Computer_ID); scond_Atom_Computer_ID = "Atom_Computer_ID = " + spar_Atom_Computer_ID; sval_Atom_Computer_ID = spar_Atom_Computer_ID; } else { scond_Atom_Computer_ID = "Atom_Computer_ID is null"; sval_Atom_Computer_ID = "null"; } string scond_Atom_ElectronicDevice_ID = null; string sval_Atom_ElectronicDevice_ID = "null"; if (Atom_ElectronicDevice_ID >= 0) { string spar_Atom_ElectronicDevice_ID = "@par_Atom_ElectronicDevice_ID"; SQL_Parameter par_Atom_ElectronicDevice_ID = new SQL_Parameter(spar_Atom_ElectronicDevice_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_ElectronicDevice_ID); lpar.Add(par_Atom_ElectronicDevice_ID); scond_Atom_ElectronicDevice_ID = "Atom_ElectronicDevice_ID = " + spar_Atom_ElectronicDevice_ID; sval_Atom_ElectronicDevice_ID = spar_Atom_ElectronicDevice_ID; } else { scond_Atom_ElectronicDevice_ID = "Atom_ElectronicDevice_ID is null"; sval_Atom_ElectronicDevice_ID = "null"; } string scond_Login_time = null; string sval_Login_time = "null"; if (Login_time >= DateTime.MinValue) { string spar_Login_time = "@par_LoginTime"; SQL_Parameter par_Login_time = new SQL_Parameter(spar_Login_time, SQL_Parameter.eSQL_Parameter.Datetime, false, Login_time); lpar.Add(par_Login_time); scond_Login_time = "LoginTime = " + spar_Login_time; sval_Login_time = spar_Login_time; } else { scond_Login_time = "LoginTime is null"; sval_Login_time = "null"; } string scond_Logout_time = null; string sval_Logout_time = "null"; if (Logout_time_v !=null) { string spar_Logout_time = "@par_LogoutTime"; SQL_Parameter par_Logout_time = new SQL_Parameter(spar_Logout_time, SQL_Parameter.eSQL_Parameter.Datetime, false, Logout_time_v.v); lpar.Add(par_Logout_time); scond_Logout_time = "LogoutTime = " + spar_Logout_time; sval_Logout_time = spar_Logout_time; } else { scond_Logout_time = "LogoutTime is null"; sval_Logout_time = "null"; } string Err = null; DataTable dt = new DataTable(); string sql = @"select ID from Atom_WorkPeriod where (" + scond_Atom_WorkPeriod_Type_ID + ") and (" + scond_Atom_myOrganisation_Person_ID + ") and (" + scond_Atom_WorkingPlace_ID + ") and (" + scond_Atom_Computer_ID + ") and (" + scond_Atom_ElectronicDevice_ID + ") and (" + scond_Login_time + ") and (" + scond_Logout_time + ")"; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_WorkPeriod_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into Atom_WorkPeriod (Atom_WorkPeriod_TYPE_ID, Atom_myOrganisation_Person_ID, Atom_WorkingPlace_ID, Atom_Computer_ID, Atom_ElectronicDevice_ID, LoginTime, LogoutTime) values (" + sval_Atom_WorkPeriod_Type_ID +"," + sval_Atom_myOrganisation_Person_ID +"," + sval_Atom_WorkingPlace_ID +"," + sval_Atom_Computer_ID +"," + sval_Atom_ElectronicDevice_ID + "," + sval_Login_time +"," + sval_Logout_time + ")"; object objretx = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Atom_WorkPeriod_ID, ref objretx, ref Err, "Atom_WorkPeriod")) { return true; } else { LogFile.Error.Show("ERROR:f_Atom_WorkPeriod:Get:" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Atom_WorkPeriod:Get:" + sql + "\r\nErr=" + Err); return false; } } else { return false; } }
public virtual void Update(DBTypes Target) { }