public static void ImportGetMode() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "select * from ATTAINWAYCODE"; string insertsql = "insert into RGetMode(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.AttainWayCode code = new CY.CSTS.Core.Business.AttainWayCode(); code.Name = ds.Tables[0].Rows[i][1].ToString(); code.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), code.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportBussinessType() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strSql = "select distinct * from TRADECODE"; DataSet ds = isql.ExecuteSqlDataSet(strSql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.TradeSort trade = new CY.CSTS.Core.Business.TradeSort(); trade.TradeSortName = ds.Tables[0].Rows[i][1].ToString(); trade.Save(); rsql.ExecuteSql(string.Format("insert into RTrade(old,new) values('{0}','{1}')", ds.Tables[0].Rows[i][0].ToString(), trade.Id.ToString())); } } catch (Exception ex) { throw ex; } }
public static void ImportField() { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string sql = "select * from domaincode"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into RField(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.Field field = new CY.CSTS.Core.Business.Field(); field.FieldName = ds.Tables[0].Rows[i][1].ToString(); field.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), field.Id)); } } }
public static void ImportMachineset() { try { string strsql = "select * from Machineset"; string insertsql = "insert into RSet(old,new) values('{0}','{1}')"; ImportSqlServerUtility isql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { CY.CSTS.Core.Business.MACHINESET set = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { set = new CY.CSTS.Core.Business.MACHINESET(); set.UnitID = CY.CSTS.Import.Core.Business.UnitInfo.TransferUnitId(ds.Tables[0].Rows[i][0].ToString()); set.LabID = CY.CSTS.Import.Core.Business.Lab.TransferLabId(ds.Tables[0].Rows[i][1].ToString()); set.SETNAME = ds.Tables[0].Rows[i][3].ToString(); set.LINKMAN = ds.Tables[0].Rows[i][4].ToString(); set.GroupInstance = ds.Tables[0].Rows[i][5].ToString(); set.PHONE = ds.Tables[0].Rows[i][6].ToString(); set.FAX = ds.Tables[0].Rows[i][7].ToString(); set.EMAIL = ds.Tables[0].Rows[i][8].ToString(); set.SETMAN = ds.Tables[0].Rows[i][9].ToString(); set.AUDITINGSTATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][10].ToString()) && bool.Parse(ds.Tables[0].Rows[i][10].ToString()) ? 1 : 2; set.AUDITINGDATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][11].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][11].ToString()) : DateTime.MinValue; set.REMARK = ds.Tables[0].Rows[i][12].ToString(); set.WRITEDATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][13].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][13].ToString()) : DateTime.MinValue; ; set.UPDATEDATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][14].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][14].ToString()) : DateTime.MinValue; set.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][2].ToString(), set.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportCity() { try { string strsql = "select distinct ProvinceId, CityId ,CityName from AreaCode "; ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); DataSet ds = sql.ExecuteSqlDataSet(strsql); CY.CSTS.Core.Business.City city = null; CY.CSTS.Import.Core.Business.RCity rcity = null; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { city = new CY.CSTS.Core.Business.City() { ProvinceID = TransferProvinceId(ds.Tables[0].Rows[i][0].ToString()), Name = ds.Tables[0].Rows[i][2].ToString() }; city.Save(); rsql.ExecuteSql(string.Format("insert RCity(old,new) values('{0}','{1}')", ds.Tables[0].Rows[i][1].ToString(), city.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportTitle() { try { ImportSqlServerUtility sql = new ImportSqlServerUtility(); string strsql = "select * from POSTRANKCODE"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); rsql.ExecuteSql("truncate table rtitle "); string insertsql = " insert into rtitle(old,new) values('{0}','{1}')"; DataSet ds = sql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.UserPostRank title = new CY.CSTS.Core.Business.UserPostRank(); title.PostRankName = ds.Tables[0].Rows[i][1].ToString(); title.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), title.Id.ToString())); } } } catch (Exception ex) { throw ex; } }
public static void ImportField() { SqlServerUtility sql = new SqlServerUtility(); ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from TRADECODE"; DataSet ds = isql.ExecuteSqlDataSet(strsql); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); rsql.ExecuteSql(" truncate table RFieldForUserNLab"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //CY.CSTS.Core.Business.Field field = new CY.CSTS.Core.Business.Field(); //field.FieldName = ds.Tables[0].Rows[i][1].ToString(); //field.Save(); Guid id = sql.ExecuteSqlReader(string.Format("insert into Field(FieldName) values('{0}') ", ds.Tables[0].Rows[i][1].ToString())).GetGuid(0); rsql.ExecuteSql(string.Format("insert into RFieldForUserNLab(old,new) values('{0}','{1}')", ds.Tables[0].Rows[i][0].ToString(), id)); } } }
public static void ImportExpert() { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from expert"; DataSet ds = isql.ExecuteSqlDataSet(strsql); SqlServerUtility sql = new SqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into ruser(old,new) values('{0}','{1}')"; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User(); // 性别 user.Gender = ds.Tables[0].Rows[i][1].ToString(); //真名 user.Name = ds.Tables[0].Rows[i][2].ToString(); //局长 user.Duty = ds.Tables[0].Rows[i][3].ToString(); //教授 user.PostRankID = TransferTitltId(ds.Tables[0].Rows[i][4].ToString()); //简介 user.Resume = ds.Tables[0].Rows[i][5].ToString(); // 专长 user.Specialty = ds.Tables[0].Rows[i][7].ToString(); //研究领域 // user.FeildID = ds.Tables[0].Rows[i][0].ToString(); //教育程度 user.EducationID = TransferEducationId(ds.Tables[0].Rows[i][8].ToString()); user.RegDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][9].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][9].ToString()) : DateTime.MinValue; user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][10].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][10].ToString()) : DateTime.MinValue; user.PicURL = ds.Tables[0].Rows[i][11].ToString(); user.Email = ds.Tables[0].Rows[i][12].ToString(); user.Fax = ds.Tables[0].Rows[i][13].ToString(); user.Phone = ds.Tables[0].Rows[i][14].ToString(); //user.UnitID = ConvertUnitNameToId(ds.Tables[0].Rows[i][15].ToString()); user.Unit = ds.Tables[0].Rows[i][15].ToString(); // adiwan user.UserID = ds.Tables[0].Rows[i][2].ToString(); user.Password = "******"; user.UserType = 4; user.Save(); //TransferUserFieldRelation(ds.Tables[0].Rows[i][6].ToString(), user.Id); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), user.Id)); } } }
//public static void ImportLabLevel() //{ // try // { // ImportSqlServerUtility sql = new ImportSqlServerUtility(); // string strsql = "select * from LABTYPECODE"; // string insertsql = "insert into RLabType(old,new) values('{0}','{1}')"; // DataSet ds = sql.ExecuteSqlDataSet(strsql); // if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) // { // CY.CSTS.Core.Business.LabLevel level = null; // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // level.Name = ds.Tables[0].Rows[0][1].ToString(); // level.Save(); // sql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[0][0].ToString(),.Id)); // } // } // } // catch (Exception ex) // { // throw ex; // } //} public static void ImportLabs() { try { ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into rlab(old,new) values('{0}','{1}')"; string strsql = "select * from [LABORATORY]"; DataSet ds = sql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { CY.CSTS.Core.Business.Lab lab = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { lab = new CY.CSTS.Core.Business.Lab(); lab.UnitID = CY.CSTS.Import.Core.Business.UnitInfo.TransferUnitId(ds.Tables[0].Rows[i][0].ToString()); lab.Name = ds.Tables[0].Rows[i][2].ToString(); lab.OtherName1 = ds.Tables[0].Rows[i][3].ToString(); lab.OtherName2 = ds.Tables[0].Rows[i][4].ToString(); lab.Address = ds.Tables[0].Rows[i][5].ToString(); lab.Postalcode = ds.Tables[0].Rows[i][6].ToString(); lab.Tel = ds.Tables[0].Rows[i][7].ToString(); lab.Fax = ds.Tables[0].Rows[i][8].ToString(); lab.Website = ds.Tables[0].Rows[i][9].ToString(); lab.Email = ds.Tables[0].Rows[i][10].ToString(); lab.LabSortID = TransferLabType(ds.Tables[0].Rows[i][11].ToString()); lab.LabPrincipal = CY.CSTS.Import.Core.Business.User.TransferUser(ds.Tables[0].Rows[i][12].ToString()); lab.LinkMan = ds.Tables[0].Rows[i][13].ToString(); lab.Synopsis = ds.Tables[0].Rows[i][14].ToString(); lab.IsRecognize = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][15].ToString()) && bool.Parse(ds.Tables[0].Rows[i][15].ToString()) ? 1 : 2; lab.RecognizeNumber = ds.Tables[0].Rows[i][16].ToString(); lab.LabLevelID = TransferLabLevel(ds.Tables[0].Rows[i][17].ToString()); lab.Remark = ds.Tables[0].Rows[i][18].ToString(); lab.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][1].ToString(), lab.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportLabType() { try { ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "select distinct * from LABTYPECODE"; string insertsql = "insert into RLabType(old,new) values('{0}','{1}')"; DataSet ds = sql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { CY.CSTS.Core.Business.LabSort type = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { type = new CY.CSTS.Core.Business.LabSort(); type.Name = ds.Tables[0].Rows[i][1].ToString(); type.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), type.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportIntrumentRealm() { try { SqlServerUtility sql = new SqlServerUtility(); sql.ExecuteSql("delete from domainCode ;delete from instrRealm"); ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from DomainCode"; string cstrsql = "select * from INSTRREALM"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); rsql.ExecuteSql("delete from RDomainCode"); string insertsql = "insert into RDomainCode(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.DomainCode code = new CY.CSTS.Core.Business.DomainCode(); code.Name = ds.Tables[0].Rows[i][1].ToString(); code.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), code.Id)); } } /********************************/ ds = isql.ExecuteSqlDataSet(cstrsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.INSTRREALM real = new CY.CSTS.Core.Business.INSTRREALM(); real.InstruId = TransferInstrumentId(ds.Tables[0].Rows[i][0].ToString()); real.DomainId = TransferDomainId(ds.Tables[0].Rows[i][1].ToString()); if (real.InstruId != Guid.Empty && real.DomainId != Guid.Empty) { real.Save(); } } } } catch (Exception ex) { throw ex; } }
public static void ImportUnit() { ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "Select distinct * from Unit"; string instersql = "insert into RUnit(old,new) values('{0}','{1}')"; DataSet ds = sql.ExecuteSqlDataSet(strsql); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.UnitInfo unit = new CY.CSTS.Core.Business.UnitInfo(); unit.UnitName = ds.Tables[0].Rows[i][1].ToString();//1 unit.UnitType = TransferUnitType(ds.Tables[0].Rows[i][2].ToString());//2 unit.Alias = ds.Tables[0].Rows[i][3].ToString();//3 unit.ProvinceID = TransferProvinceId(ds.Tables[0].Rows[i][4].ToString());//4 unit.CityID = TransferCityId(ds.Tables[0].Rows[i][5].ToString());//5 unit.Address = ds.Tables[0].Rows[i][6].ToString();//6 unit.Postalcode = ds.Tables[0].Rows[i][7].ToString();//7 unit.Tel = ds.Tables[0].Rows[i][8].ToString(); unit.Fax = ds.Tables[0].Rows[i][9].ToString(); unit.Website = ds.Tables[0].Rows[i][10].ToString(); unit.Email = ds.Tables[0].Rows[i][11].ToString(); unit.Ownership = TransferOwnerShip(ds.Tables[0].Rows[i][12].ToString()); unit.DrtificialPerson = ds.Tables[0].Rows[i][13].ToString(); unit.DrtificialPersonDutyID = TransferDutyid(ds.Tables[0].Rows[i][14].ToString()); unit.DrtificialPersonTel = ds.Tables[0].Rows[i][15].ToString(); unit.LinkDepartdement = ds.Tables[0].Rows[i][16].ToString(); unit.Linkman = ds.Tables[0].Rows[i][17].ToString(); unit.LinkmanDutyID = TransferDutyid(ds.Tables[0].Rows[i][18].ToString()); unit.LinkmanTel = ds.Tables[0].Rows[i][19].ToString(); unit.ChargeDepartMent = ds.Tables[0].Rows[i][20].ToString(); unit.BankAccountName = ds.Tables[0].Rows[i][21].ToString(); unit.BankName = ds.Tables[0].Rows[i][22].ToString(); unit.BankAccount = ds.Tables[0].Rows[i][23].ToString(); unit.Certificate = ds.Tables[0].Rows[i][24].ToString(); unit.Rel_certificate = ds.Tables[0].Rows[i][25].ToString(); unit.WorkCode = ds.Tables[0].Rows[i][26].ToString(); unit.Synopsis = ds.Tables[0].Rows[i][27].ToString(); unit.InstrumentSection = ds.Tables[0].Rows[i][28].ToString(); unit.VindicatorCount = int.Parse(!string.IsNullOrEmpty(ds.Tables[0].Rows[i][29].ToString()) ? ds.Tables[0].Rows[i][29].ToString() : "0"); //�����ϵ���п�Ժ��01����������02������������03���ط���10�� unit.Subjection = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][30].ToString()) ? int.Parse(ds.Tables[0].Rows[i][30].ToString()) : 0; unit.TradeSortID = TransferTradeId(ds.Tables[0].Rows[i][31].ToString()); unit.IsModification = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][32].ToString()) && bool.Parse(ds.Tables[0].Rows[i][32].ToString()) ? 1 : 2; unit.IsCooperantUnit = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][33].ToString()) && bool.Parse(ds.Tables[0].Rows[i][33].ToString()) ? 1 : 2; unit.Operation = ds.Tables[0].Rows[i][34].ToString(); unit.AuditingState = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][35].ToString()) ? int.Parse(ds.Tables[0].Rows[i][35].ToString()) : default(int); unit.Assessor = ds.Tables[0].Rows[i][36].ToString(); unit.AuditingDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][37].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][37].ToString()) : DateTime.MinValue; unit.Remark = ds.Tables[0].Rows[i][38].ToString(); unit.CreatDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][39].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][39].ToString()) : DateTime.MinValue; unit.UpdateDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][40].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][40].ToString()) : DateTime.MinValue; unit.Save(); rsql.ExecuteSql(string.Format(instersql, ds.Tables[0].Rows[i][0].ToString(), unit.Id)); } } }
public static void ImportProvince() { try { string strsql = "select distinct ProvinceId ,ProvinceName from AreaCode"; string insertsql = "insert into RProvince(old,new) values('{0}','{1}')"; ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); DataSet ds = sql.ExecuteSqlDataSet(strsql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.Province pro = new CY.CSTS.Core.Business.Province(); pro.Name = ds.Tables[0].Rows[i][1].ToString(); pro.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), pro.Id.ToString())); } } catch (Exception ex) { throw ex; } }
public static void ImportPurpose() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from PURPOSECODE"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into RPurpose(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.InstrumentMainUser p = new CY.CSTS.Core.Business.InstrumentMainUser(); p.Name = ds.Tables[0].Rows[i][1].ToString(); p.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), p.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportUser(string oldID) { try { CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); string strsql = "select * from PERSONNEL where PERSONNELID = " + oldID; DataSet ds = isql.ExecuteSqlDataSet(strsql); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into RUser(old,new) values('{0}','{1}')"; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User(); user.UnitID = CY.CSTS.Import.Core.Business.UnitInfo.TransferUnitId(ds.Tables[0].Rows[i][0].ToString()); user.UserID = ds.Tables[0].Rows[i][4].ToString(); user.Name = ds.Tables[0].Rows[i][4].ToString(); user.Gender = ds.Tables[0].Rows[i][5].ToString(); user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][6].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][6].ToString()) : DateTime.MinValue; user.EducationID = TransferEducationId(ds.Tables[0].Rows[i][7].ToString()); user.PostRankID = TransferTitltId(ds.Tables[0].Rows[i][8].ToString()); user.Specialty = ds.Tables[0].Rows[i][9].ToString(); user.Address = ds.Tables[0].Rows[i][10].ToString(); user.Mailcode = ds.Tables[0].Rows[i][11].ToString(); user.Phone = ds.Tables[0].Rows[i][12].ToString(); user.Fax = ds.Tables[0].Rows[i][13].ToString(); user.Email = ds.Tables[0].Rows[i][14].ToString(); user.Resume = ds.Tables[0].Rows[i][15].ToString(); user.Discourse = ds.Tables[0].Rows[i][20].ToString(); user.Acquire = ds.Tables[0].Rows[i][21].ToString(); user.Status = 2; user.Remark = ds.Tables[0].Rows[i][25].ToString(); user.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), user.Id)); } } } catch (Exception ex) { throw ex; } }
public static void ImportEducation() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from Educationcode"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); rsql.ExecuteSql("truncate table reducation "); string insertsql = "insert into reducation(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.UserEducation edu = new CY.CSTS.Core.Business.UserEducation(); edu.EducationName = ds.Tables[0].Rows[i][1].ToString(); edu.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), edu.Id.ToString())); } } } catch (Exception ex) { throw ex; } }
public static void ImportInstrument() { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from Instrument"; string insertrsql = "insert Rinstrument(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { CY.CSTS.Core.Business.InstrumentCode header = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { RelationSqlServerUtility rsql = new RelationSqlServerUtility(); SqlServerUtility sql = new SqlServerUtility(); header = new CY.CSTS.Core.Business.InstrumentCode(); header.Id = Guid.NewGuid(); header.Save(); Guid id = header.Id; sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); sql.AddParameter("@InstruCode", SqlDbType.NVarChar, ds.Tables[0].Rows[i][0].ToString()); /*******************************/ sql.AddParameter("@LaboratoryId", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.Lab.TransferLabId(ds.Tables[0].Rows[i][1].ToString())); sql.AddParameter("@MachineGroupId", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.Machineset.TransferSetId(ds.Tables[0].Rows[i][2].ToString())); sql.AddParameter("@WorkingforUnitId", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.UnitInfo.TransferUnitId(ds.Tables[0].Rows[i][3].ToString())); sql.AddParameter("@PERSONNELID", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.User.TransferUserId(ds.Tables[0].Rows[i][4].ToString())); sql.AddParameter("@HNAME", SqlDbType.NVarChar, ds.Tables[0].Rows[i][5].ToString()); sql.AddParameter("@ENAME", SqlDbType.NVarChar, ds.Tables[0].Rows[i][6].ToString()); sql.AddParameter("@ALIAS", SqlDbType.NVarChar, ds.Tables[0].Rows[i][7].ToString()); sql.AddParameter("@CLASSCODE", SqlDbType.NVarChar, TransferClassCode(ds.Tables[0].Rows[i][9].ToString(), ds.Tables[0].Rows[i][10].ToString(), ds.Tables[0].Rows[i][11].ToString())); sql.AddParameter("@SITE", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.UnitInfo.TransferProvinceId(ds.Tables[0].Rows[i][15].ToString())); sql.AddParameter("@CITY", SqlDbType.UniqueIdentifier, CY.CSTS.Import.Core.Business.UnitInfo.TransferCityId(ds.Tables[0].Rows[i][16].ToString())); sql.AddParameter("@SPECTYPE", SqlDbType.NVarChar, ds.Tables[0].Rows[i][17].ToString()); sql.AddParameter("@GETMODE", SqlDbType.UniqueIdentifier, TransferGetMode(ds.Tables[0].Rows[i][18].ToString())); sql.AddParameter("@MANUFACTURE", SqlDbType.NVarChar, ds.Tables[0].Rows[i][19].ToString()); sql.AddParameter("@COUNTRYCODE", SqlDbType.UniqueIdentifier, TransferCountryId(ds.Tables[0].Rows[i][20].ToString())); sql.AddParameter("@PRODUCINGAREA", SqlDbType.NVarChar, ds.Tables[0].Rows[i][21].ToString()); sql.AddParameter("@PRODUCESORT", SqlDbType.UniqueIdentifier, TranferProduceSort(ds.Tables[0].Rows[i][22].ToString())); sql.AddParameter("@VALUERMB", SqlDbType.Decimal, ds.Tables[0].Rows[i][23].ToString()); sql.AddParameter("@NATIONALPAY", SqlDbType.Decimal, ds.Tables[0].Rows[i][26].ToString()); sql.AddParameter("@BUGETSOURCE", SqlDbType.UniqueIdentifier, TransferPurchesource(ds.Tables[0].Rows[i][27].ToString())); sql.AddParameter("@PRODUCEDATE", SqlDbType.DateTime, ds.Tables[0].Rows[i][28].ToString()); sql.AddParameter("@PURCHASEDATE", SqlDbType.DateTime, ds.Tables[0].Rows[i][29].ToString()); sql.AddParameter("@DISCARDTIME", SqlDbType.DateTime, ds.Tables[0].Rows[i][30].ToString()); sql.AddParameter("@GUIDELINE", SqlDbType.NVarChar, ds.Tables[0].Rows[i][31].ToString()); sql.AddParameter("@FUNCTIONFEATURES", SqlDbType.NVarChar, ds.Tables[0].Rows[i][32].ToString()); sql.AddParameter("@EXAMINATION", SqlDbType.UniqueIdentifier, Guid.Empty); sql.AddParameter("@TOTALLY", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][34].ToString()) && bool.Parse(ds.Tables[0].Rows[i][34].ToString()) ? 1 : 2); sql.AddParameter("@ACCEPTMISSION", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][35].ToString()) && bool.Parse(ds.Tables[0].Rows[i][35].ToString()) ? 1 : 2); sql.AddParameter("@EXTERNALSERVICE", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][36].ToString()) && bool.Parse(ds.Tables[0].Rows[i][36].ToString()) ? 1 : 2); sql.AddParameter("@PICTURE", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][37].ToString()) && bool.Parse(ds.Tables[0].Rows[i][37].ToString()) ? 1 : 2); sql.AddParameter("@ATTACHMENT", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][38].ToString()) && bool.Parse(ds.Tables[0].Rows[i][38].ToString()) ? 1 : 2); sql.AddParameter("@MEDIA", SqlDbType.Int, !string.IsNullOrEmpty(ds.Tables[0].Rows[i][39].ToString()) && bool.Parse(ds.Tables[0].Rows[i][39].ToString()) ? 1 : 2); sql.AddParameter("@PURPOSEID", SqlDbType.NVarChar, ds.Tables[0].Rows[i][40].ToString()); sql.AddParameter("@REALMID", SqlDbType.NVarChar, ds.Tables[0].Rows[i][41].ToString()); sql.AddParameter("@WRITEDATE", SqlDbType.DateTime, ds.Tables[0].Rows[i][42].ToString()); sql.AddParameter("@UPDATEDATE", SqlDbType.DateTime, ds.Tables[0].Rows[i][43].ToString()); sql.AddParameter("@REMARK", SqlDbType.NVarChar, ds.Tables[0].Rows[i][44].ToString()); sql.AddParameter("@AUDITINGSTATE", SqlDbType.Int, ds.Tables[0].Rows[i][45].ToString() == "True" ? 4 : 2); sql.AddParameter("@ASSESSOR", SqlDbType.NVarChar, ds.Tables[0].Rows[i][46].ToString()); sql.AddParameter("@AUDITINGDATE", SqlDbType.DateTime, ds.Tables[0].Rows[i][42].ToString()); /*****************************/ sql.AddParameter("@WorkState", SqlDbType.Int, 1); sql.AddParameter("@UseState", SqlDbType.Int, 1); sql.AddParameter("@HasCMA", SqlDbType.Int, 2); sql.AddParameter("@IsSpecial", SqlDbType.Int, 2); /******************************/ sql.AddParameter("@Intrument", SqlDbType.Int, ds.Tables[0].Rows[i][0].ToString()); SqlDataReader reader = sql.ExecuteSPReader("usp_InsertINSTRUMENTLegacy"); sql.Parameters.Clear(); reader.Close(); rsql.ExecuteSql(string.Format(insertrsql, ds.Tables[0].Rows[i][0].ToString(), header.Id.ToString())); } } }