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 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; } }
protected void btnModifyEName_Click(object sender, EventArgs e) { List<CY.CSTS.Core.Business.INSTRUMENT> listInstrument = CY.CSTS.Core.Business.INSTRUMENT.GetAllINSTRUMENT() as List<CY.CSTS.Core.Business.INSTRUMENT>; CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); foreach (CY.CSTS.Core.Business.INSTRUMENT instrument in listInstrument) { string stroldId = instrument.OringalId.ToString(); string strsql = "select * from INSTRUMENT where INSTRUMENTID = " + stroldId; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { if(ds.Tables[0].Rows[0]["ENAME"]!=null) { instrument.ENAME = ds.Tables[0].Rows[0]["ENAME"].ToString(); } if (ds.Tables[0].Rows[0]["ALIAS"] != null) { instrument.ALIAS = ds.Tables[0].Rows[0]["ALIAS"].ToString(); } instrument.Save(); } } }
public static void ImportAdminNUser() { ImportSqlServerUtility sql = new ImportSqlServerUtility(); string strsql = "select * from users "; DataSet ds = sql.ExecuteSqlDataSet(strsql); 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.UserID = ds.Tables[0].Rows[i][2].ToString().Length > 0 ? ds.Tables[0].Rows[i][2].ToString() : ds.Tables[0].Rows[i][9].ToString(); user.Password = ds.Tables[0].Rows[i][3].ToString().Length > 0 ? ds.Tables[0].Rows[i][3].ToString() : "123456"; user.UnitID = ConvertUnitNameToId(ds.Tables[0].Rows[i][6].ToString().Trim()); user.Name = ds.Tables[0].Rows[i][9].ToString(); user.Phone = ds.Tables[0].Rows[i][17].ToString(); if (user.UnitID != Guid.Empty) { // 单位用户 user.UserType = GetUserType(user.UnitID); } else { // 普通用户 user.UserType = 1; } user.UserType = ds.Tables[0].Rows[i][10].ToString() == "True" ? 5 : user.UserType; user.Save(); } } }
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 IEnumerable<Core.Business.AREACODE> GetAllAREACODE() { IList<Core.Business.AREACODE> aREACODElist = new List<Core.Business.AREACODE>(); ImportSqlServerUtility sql = new ImportSqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAREACODE); if(reader != null) { while(reader.Read()) { Core.Business.AREACODE aREACODE = new Core.Business.AREACODE(); if (!reader.IsDBNull(0)) aREACODE.PROVINCEID = reader.GetString(0); if (!reader.IsDBNull(1)) aREACODE.PROVINCENAME = reader.GetString(1); if (!reader.IsDBNull(2)) aREACODE.ProvinceAlias = reader.GetString(2); if (!reader.IsDBNull(3)) aREACODE.CITYID = reader.GetString(3); if (!reader.IsDBNull(4)) aREACODE.CITYNAME = reader.GetString(4); aREACODE.MarkOld(); aREACODElist.Add(aREACODE); } reader.Close(); } return aREACODElist; }
public void Insert(Core.Business.Rprovince rprovince) { ImportSqlServerUtility sql = new ImportSqlServerUtility(); sql.AddParameter("@NProcinceId", SqlDbType.UniqueIdentifier, rprovince.NProcinceId); sql.AddParameter("@OProvinceId", SqlDbType.NVarChar, rprovince.OProvinceId); sql.ExecuteSql(SqlInsertRprovince); }
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 ImportLabDomain() { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string sql2 = "select * from LABREALM "; DataSet ds = isql.ExecuteSqlDataSet(sql2); 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.LabDomain domain = new CY.CSTS.Core.Business.LabDomain(); domain.LabID = TransferLabId(ds.Tables[0].Rows[i][0].ToString()); domain.DomainID = TransferDomainId(ds.Tables[0].Rows[i][1].ToString()); domain.Save(); } } }
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 IList<Core.Business.Rprovince> GetAllRprovince() { IList<Core.Business.Rprovince> rprovincelist = new List<Core.Business.Rprovince>(); ImportSqlServerUtility sql = new ImportSqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllRprovince); if(reader != null) { while(reader.Read()) { Core.Business.Rprovince rprovince = new Core.Business.Rprovince(); if (!reader.IsDBNull(0)) rprovince.NProcinceId = reader.GetGuid(0); if (!reader.IsDBNull(1)) rprovince.OProvinceId = reader.GetString(1); rprovince.MarkOld(); rprovincelist.Add(rprovince); } reader.Close(); } return rprovincelist; }
public Core.Business.Rprovince Select(System.Int32 id) { ImportSqlServerUtility sql = new ImportSqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectRprovince); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Rprovince rprovince = new Core.Business.Rprovince(); if (!reader.IsDBNull(0)) rprovince.NProcinceId = reader.GetGuid(0); if (!reader.IsDBNull(1)) rprovince.OProvinceId = reader.GetString(1); reader.Close(); return rprovince; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
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 int TransferClassCode(string big, string mid, string sml) { try { int result = 0; if (big != null && mid != null && sml != null) { ImportSqlServerUtility isql = new ImportSqlServerUtility(); SqlServerUtility sql = new SqlServerUtility(); if (big.Length == 1) { big = "0" + big; } if (big.Length == 0) { big = "00"; } if (mid.Length == 1) { mid = "0" + mid; } if (mid.Length == 0) { mid = "00"; } if (sml.Length == 1) { sml = "0" + sml; } if (sml.Length == 0) { sml = "00"; } string strsql = "select distinct bigname,middlename,smallname from ClassCode where bigid='{0}' and middleid='{1}' and smallid='{2}'"; DataSet ds = isql.ExecuteSqlDataSet(string.Format(strsql, big, mid, sml)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { string bname = ds.Tables[0].Rows[0][0].ToString(); string mname = ds.Tables[0].Rows[0][1].ToString(); string sname = ds.Tables[0].Rows[0][2].ToString(); if (!string.IsNullOrEmpty(bname) && !string.IsNullOrEmpty(mname) && !string.IsNullOrEmpty(sname)) { IEnumerable<CY.CSTS.Core.Business.CLASSCODE> classes = CY.CSTS.Core.Business.CLASSCODE.GetAllCLASSCODE(); IEnumerable<CY.CSTS.Core.Business.CLASSCODE> temp = null; int nbigid = 0; if ((temp = classes.Where(item => item.Name.Contains(bname.Trim()))) != null && temp.Count() > 0) { nbigid = temp.First().Id; } int nmidid = 0; if ((temp = classes.Where(item => item.Name.Contains(mname.Trim()))) != null && temp.Count() > 0) { nmidid = temp.First().Id; } int nsmlid = 0; if ((temp = classes.Where(item => item.Name.Contains(sname.Trim()) && item.ParentId == nmidid)) != null && temp.Count() > 0) { nsmlid = temp.First().Id; } if (nsmlid != 0) return nsmlid; if (nmidid != 0) return nmidid; if (nbigid != 0) return nbigid; return 618; } } } return 618; } catch (Exception ex) { throw ex; } }
protected void import_Click(object sender, EventArgs e) { CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); string strsql = "select * from PERSONNEL"; DataSet ds = isql.ExecuteSqlDataSet(strsql); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string Rsql = "select * from RUser"; DataSet dsR = rsql.ExecuteSqlDataSet(Rsql); Rsql = "select * from RLab"; DataSet dsRLab = rsql.ExecuteSqlDataSet(Rsql); //List<CY.CSTS.Core.Business.Lab> listLab = CY.CSTS.Core.Business.Lab.GetAllLab() as List<CY.CSTS.Core.Business.Lab>; if (dsRLab != null && dsRLab.Tables.Count > 0 && dsRLab.Tables[0].Rows.Count > 0 && dsRLab.Tables[0].Columns.Count > 0) { for (int i = 0; i < dsRLab.Tables[0].Rows.Count; i++) { strsql = "select * from LABORATORY where LABID = " + dsRLab.Tables[0].Rows[i][0].ToString(); DataSet dsLab = isql.ExecuteSqlDataSet(strsql); if (dsLab != null && dsLab.Tables.Count > 0 && dsLab.Tables[0].Rows.Count > 0 && dsLab.Tables[0].Columns.Count > 0) { string strLeadUserID = "0"; string strLinkUserID = "0"; if (dsLab.Tables[0].Rows[0]["LEAD"] != null) { strLeadUserID = dsLab.Tables[0].Rows[0]["LEAD"].ToString(); } if (dsLab.Tables[0].Rows[0]["LINKMAN"] != null) { strLinkUserID = dsLab.Tables[0].Rows[0]["LINKMAN"].ToString(); } if (strLeadUserID == "") { strLeadUserID = "0"; } if (strLinkUserID == "") { strLinkUserID = "0"; } strsql = "select * from PERSONNEL where PERSONNELID = " + strLeadUserID; DataSet dsLabLeadP = isql.ExecuteSqlDataSet(strsql); strsql = "select * from PERSONNEL where PERSONNELID = " + strLinkUserID; DataSet dsLabLinkP = isql.ExecuteSqlDataSet(strsql); string leadName = ""; string linkName = ""; if (dsLabLeadP != null && dsLabLeadP.Tables.Count > 0 && dsLabLeadP.Tables[0].Rows.Count > 0 && dsLabLeadP.Tables[0].Columns.Count > 0) { leadName = dsLabLeadP.Tables[0].Rows[0]["NAME"].ToString(); } if (dsLabLinkP != null && dsLabLinkP.Tables.Count > 0 && dsLabLinkP.Tables[0].Rows.Count > 0 && dsLabLinkP.Tables[0].Columns.Count > 0) { linkName = dsLabLinkP.Tables[0].Rows[0]["NAME"].ToString(); } if (CY.Utility.Common.StringHelper.IsGuid(dsRLab.Tables[0].Rows[i][1].ToString())) { Guid LabId = new Guid(dsRLab.Tables[0].Rows[i][1].ToString()); CY.CSTS.Core.Business.Lab lab = CY.CSTS.Core.Business.Lab.Load(LabId); if (lab != null) { lab.LabPrincipal = leadName; lab.LinkMan = linkName; lab.Save(); } } } } } }
protected void import_Machine_LinkMan_Click(object sender, EventArgs e) { CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string Rsql = "select * from RSet"; DataSet dsRSet = rsql.ExecuteSqlDataSet(Rsql); if (dsRSet != null && dsRSet.Tables.Count > 0 && dsRSet.Tables[0].Rows.Count > 0 && dsRSet.Tables[0].Columns.Count > 0) { for (int i = 0; i < dsRSet.Tables[0].Rows.Count; i++) { string strsql = "select * from MACHINESET where SETID = " + dsRSet.Tables[0].Rows[i][0].ToString(); DataSet dsSet = isql.ExecuteSqlDataSet(strsql); string strLinkID = "0"; if (dsSet != null && dsSet.Tables.Count > 0 && dsSet.Tables[0].Rows.Count > 0 && dsSet.Tables[0].Columns.Count > 0) { strLinkID = dsSet.Tables[0].Rows[0]["LINKMAN"].ToString(); } if (strLinkID == "") { strLinkID = "0"; } strsql = "select * from PERSONNEL where PERSONNELID = " + strLinkID; DataSet dsLabLinkP = isql.ExecuteSqlDataSet(strsql); string linkName = ""; if (dsLabLinkP != null && dsLabLinkP.Tables.Count > 0 && dsLabLinkP.Tables[0].Rows.Count > 0 && dsLabLinkP.Tables[0].Columns.Count > 0) { linkName = dsLabLinkP.Tables[0].Rows[0]["NAME"].ToString(); } if (CY.Utility.Common.StringHelper.IsGuid(dsRSet.Tables[0].Rows[i][1].ToString())) { Guid SetId = new Guid(dsRSet.Tables[0].Rows[i][1].ToString()); CY.CSTS.Core.Business.MACHINESET set = CY.CSTS.Core.Business.MACHINESET.Load(SetId); if (set != null) { set.LINKMAN = linkName; set.Save(); } } } } }
/// <summary> /// OK /// </summary> /// <param name="old"></param> /// <returns></returns> public static string TransferOwnerShip(string old) { try { string result = string.Empty; if (old != null) { ImportSqlServerUtility sql = new ImportSqlServerUtility(); string strsql = "select distinct affiliatedNAME from AFFILIATEDCODE where AffiliatedID='{0}' "; DataSet ds = sql.ExecuteSqlDataSet(string.Format(strsql, old)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { result = ds.Tables[0].Rows[0][0].ToString(); } } return result; } 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 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 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; } }
/// <summary> /// Not Need to Install Raltion Table /// </summary> public static void ImportDuty() { string strsql = "select distinct LEADDUTY from Unit "; ImportSqlServerUtility sql = new ImportSqlServerUtility(); DataSet ds = sql.ExecuteSqlDataSet(strsql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.Duty duty = new CY.CSTS.Core.Business.Duty(); duty.Nmae = ds.Tables[0].Rows[i][0].ToString(); duty.Save(); } }
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)); } } }
protected void import_MachineMemeber_Click(object sender, EventArgs e) { List<CY.CSTS.Core.Business.INSTRUMENT> listInstrument = CY.CSTS.Core.Business.INSTRUMENT.GetAllINSTRUMENT() as List<CY.CSTS.Core.Business.INSTRUMENT>; CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string Rsql = "select * from RSet"; DataSet dsRSet = rsql.ExecuteSqlDataSet(Rsql); if (dsRSet != null && dsRSet.Tables.Count > 0 && dsRSet.Tables[0].Rows.Count > 0 && dsRSet.Tables[0].Columns.Count > 0) { for (int i = 0; i < dsRSet.Tables[0].Rows.Count; i++) { string strsql = "select * from MACHINESET where SETID = " + dsRSet.Tables[0].Rows[i][0].ToString(); DataSet dsSet = isql.ExecuteSqlDataSet(strsql); string[] strSetManID; string strSetMan = ""; if (dsSet != null && dsSet.Tables.Count > 0 && dsSet.Tables[0].Rows.Count > 0 && dsSet.Tables[0].Columns.Count > 0) { strSetMan = dsSet.Tables[0].Rows[0]["SETMAN"].ToString(); } if (strSetMan == "") { strSetMan = "0"; } if (strSetMan != "0") { strSetManID = strSetMan.Split(','); for (int j = 0; j < strSetManID.Count(); j++) { string strManID = strSetManID[j]; int iTemp = 0; if (strManID != "" && int.TryParse(strManID, out iTemp)) { //try { if (CY.Utility.Common.StringHelper.IsGuid(dsRSet.Tables[0].Rows[i][1].ToString())) { Guid NewSetID = new Guid(dsRSet.Tables[0].Rows[i][1].ToString()); CY.CSTS.Core.Business.MACHINESET newM = CY.CSTS.Core.Business.MACHINESET.Load(NewSetID); int usertype = 0; Guid UintID = new Guid(); if (newM.Unit != null) { if (newM.Unit.IsCooperantUnit == 2) { usertype = 2; } else { usertype = 3; } UintID = newM.Unit.Id; strsql = "select * from PERSONNEL where PERSONNELID = " + strManID; 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 k = 0; k < ds.Tables[0].Rows.Count; k++) { if (ds.Tables[0].Rows[k][4] != null) { CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.GetUserByUserId(ds.Tables[0].Rows[k][4].ToString()); if (user == null) { user = new CY.CSTS.Core.Business.User(); user.UnitID = UintID; user.UserType = usertype; user.Password = "******"; user.UserID = ds.Tables[0].Rows[k][4].ToString(); user.Name = ds.Tables[0].Rows[k][4].ToString(); user.Gender = ds.Tables[0].Rows[k][5].ToString(); user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[k][6].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[k][6].ToString()) : DateTime.MinValue; user.EducationID = CY.CSTS.Import.Core.Business.User.TransferEducationId(ds.Tables[0].Rows[k][7].ToString()); user.PostRankID = CY.CSTS.Import.Core.Business.User.TransferTitltId(ds.Tables[0].Rows[k][8].ToString()); user.Specialty = ds.Tables[0].Rows[k][9].ToString(); user.Address = ds.Tables[0].Rows[k][10].ToString(); user.Mailcode = ds.Tables[0].Rows[k][11].ToString(); user.Phone = ds.Tables[0].Rows[k][12].ToString(); user.Fax = ds.Tables[0].Rows[k][13].ToString(); user.Email = ds.Tables[0].Rows[k][14].ToString(); user.Resume = ds.Tables[0].Rows[k][15].ToString(); user.Discourse = ds.Tables[0].Rows[k][20].ToString(); user.Acquire = ds.Tables[0].Rows[k][21].ToString(); user.Status = 2; user.Remark = ds.Tables[0].Rows[k][25].ToString(); user.Save(); } List<CY.CSTS.Core.Business.INSTRUMENT> tempListI = listInstrument.Where(Items => Items.MachineGroupId == newM.Id).ToList(); if (tempListI.Count > 0) { CY.CSTS.Core.Business.MachineGroupMember MMember = new CY.CSTS.Core.Business.MachineGroupMember(); MMember.InstruID = tempListI[0].Id; MMember.UserID = user.Id; MMember.MachineGroupID = newM.Id; MMember.Save(); } } } } } } } //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; } }
/// <summary> /// 仪器主要用途 或研 /// </summary> public static void ImportInstrmenPurpose() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from PURPOSE"; 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.PURPOSE ip = new CY.CSTS.Core.Business.PURPOSE(); ip.InstruId = TransferInstrumentId(ds.Tables[0].Rows[i][0].ToString()); ip.PURPOSEID = TransferPurpose(ds.Tables[0].Rows[i][1].ToString()); ip.Save(); } } } catch (Exception ex) { throw ex; } }
public static void ImportUser2() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from Users"; 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.User user = new CY.CSTS.Core.Business.User(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.Password = ds.Tables[0].Rows[i][0].ToString(); //user.UnitID = ds.Tables[0].Rows[i][0].ToString(); //user.Name = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); //user.UserID = ds.Tables[0].Rows[i][0].ToString(); } } } catch (Exception ex) { throw ex; } }
protected void import_Machine_Click(object sender, EventArgs e) { CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility(); string strsql = "select * from INSTRUMENT"; DataSet ds = isql.ExecuteSqlDataSet(strsql); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string Rsql = "select * from RInstrument"; DataSet dsR = rsql.ExecuteSqlDataSet(Rsql); Rsql = "select * from RInstrument"; DataSet dsRLab = rsql.ExecuteSqlDataSet(Rsql); //List<CY.CSTS.Core.Business.INSTRUMENT> listLab = CY.CSTS.Core.Business.INSTRUMENT.GetAllINSTRUMENT() as List<CY.CSTS.Core.Business.INSTRUMENT>; if (dsRLab != null && dsRLab.Tables.Count > 0 && dsRLab.Tables[0].Rows.Count > 0 && dsRLab.Tables[0].Columns.Count > 0) { for (int i = 0; i < dsRLab.Tables[0].Rows.Count; i++) { strsql = "select * from INSTRUMENT where INSTRUMENTID = " + dsRLab.Tables[0].Rows[i][0].ToString(); DataSet dsLab = isql.ExecuteSqlDataSet(strsql); if (dsLab != null && dsLab.Tables.Count > 0 && dsLab.Tables[0].Rows.Count > 0 && dsLab.Tables[0].Columns.Count > 0) { string oldMID = "0"; if (dsLab.Tables[0].Rows[0]["SETID"] != null) { oldMID = dsLab.Tables[0].Rows[0]["SETID"].ToString(); } if (oldMID == "") { oldMID = "0"; } strsql = "select * from RSet where old = " + oldMID; DataSet dsRSet = rsql.ExecuteSqlDataSet(strsql); string strMID = ""; if (dsRSet != null && dsRSet.Tables.Count > 0 && dsRSet.Tables[0].Rows.Count > 0 && dsRSet.Tables[0].Columns.Count > 0) { strMID = dsRSet.Tables[0].Rows[0][1].ToString(); if (CY.Utility.Common.StringHelper.IsGuid(strMID)) { Guid MId = new Guid(strMID); if (CY.CSTS.Core.Business.MACHINESET.Load(MId) != null) { if (CY.Utility.Common.StringHelper.IsGuid(dsRLab.Tables[0].Rows[i][1].ToString())) { Guid IId = new Guid(dsRLab.Tables[0].Rows[i][1].ToString()); CY.CSTS.Core.Business.INSTRUMENT instrument = CY.CSTS.Core.Business.INSTRUMENT.Load(IId); if (instrument != null) { instrument.MachineGroupId = MId; instrument.Save(); } } } } } } } } }
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 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)); } } }