public Parse() { RegionMask.RegionMaskInit(); RegionMask.maskList.Where(s => s.propertyName == "REGION_ID").First().colNum = 0; RegionMask.maskList.Where(s => s.propertyName == "REGION_ID").First().value = "0"; RegionMask.maskList.Where(s => s.propertyName == "REGION_NAME").First().colNum = 1; RegionMask.maskList.Where(s => s.propertyName == "REGION_NAME").First().value = "REG_0"; SQL_HR_COPY sql = new SQL_HR_COPY(); decimal id = 5; REGIONS rg = new REGIONS { REGION_ID = id, REGION_NAME = "A" }; //sql.REGIONS.Add(new REGIONS { REGION_ID = decimal.Parse(rm.GetValueByName(@"REGION_ID")), REGION_NAME = rm.GetValueByName(@"REGION_NAME") }); sql.REGIONS.Add(rg); try { sql.SaveChanges(); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message); } }
//copy from ORacle db to sql with new contexts public void ORCL_to_SQL_copy_FULL() { ORCL_HR ORCL_DB = new ORCL_HR(); SQL_HR_COPY SQL_DB = new SQL_HR_COPY(); IQueryable <SB.Entities.COUNTRIES> regions = from s in ORCL_DB.COUNTRIES select s; foreach (SB.Entities.COUNTRIES rg in regions) { SQL_DB.COUNTRIES.Add(new SB.Entities.COUNTRIES { COUNTRY_ID = rg.COUNTRY_ID, COUNTRY_NAME = rg.COUNTRY_NAME, REGION_ID = rg.REGION_ID }); SQL_DB.SaveChanges(); } }
public void ORCL_to_SQL_copy_repo() { ORCL_HR ORCL_DB = new ORCL_HR(); SQL_HR_COPY SQL_DB = new SQL_HR_COPY(); Repository <LOCATIONS> orcl_jobs = new Repository <LOCATIONS>(ORCL_DB); Repository <LOCATIONS> sql_jobs = new Repository <LOCATIONS>(SQL_DB); IEnumerable <LOCATIONS> jobs_ = orcl_jobs.GetAll().AsNoTracking(); //works for entity with no navigation properties foreach (LOCATIONS jb in jobs_) { //sql_jobs.Add(new JOBS { JOB_ID=jb.JOB_ID, JOB_TITLE=jb.JOB_TITLE,MIN_SALARY=jb.MIN_SALARY,MAX_SALARY=jb.MAX_SALARY} ); sql_jobs.Add(jb); sql_jobs.SaveChnages(); } }
public PropertyBind() { db = new SQL_HR_COPY(); regRepo = new Repository <REGIONS>(db); }