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 Guid TransferSetId(string old) { try { Guid result = Guid.Empty; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "select distinct new from Rset where old='{0}'"; DataSet ds = rsql.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 = new Guid(ds.Tables[0].Rows[0][0].ToString()); } return result; } 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; } }
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(); } } } } } }
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; } }
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(); } } } } } } } } }
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(); } } } } }
public static void ImportInstrumentAttach() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "select * from INSTRATTACHMENT"; string insertsql = "insert RIntrumentAttach(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.INSTRATTACHMENT attach = new CY.CSTS.Core.Business.INSTRATTACHMENT(); attach.InstruId = CY.CSTS.Import.Core.Business.Instrument.TransferInstrumentId(ds.Tables[0].Rows[i][0].ToString()); attach.ATTACHMENTNAME = ds.Tables[0].Rows[i][2].ToString(); attach.ATTACHMENTAMOUNT = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][3].ToString()) ? int.Parse(ds.Tables[0].Rows[i][3].ToString()) : 0; attach.ATTACHMENTSPEC = ds.Tables[0].Rows[i][4].ToString(); attach.ATTACHMENTPRICE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][5].ToString()) ? decimal.Parse(ds.Tables[0].Rows[i][5].ToString()) : 0.0m; attach.PURPOSE = ds.Tables[0].Rows[i][6].ToString(); attach.MANUFACTURER = ds.Tables[0].Rows[i][7].ToString(); attach.REMARK = ds.Tables[0].Rows[i][8].ToString(); attach.WRITEDATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][9].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][9].ToString()) : DateTime.MinValue; attach.UPDATEDATE = attach.WRITEDATE;// !string.IsNullOrEmpty(ds.Tables[0].Rows[i][10].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][10].ToString()) : DateTime.MinValue; attach.Save(); } } } catch (Exception ex) { throw ex; } }
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> /// 而且要添加ExpertFirld /// </summary> public static void TransferUserFieldRelation(string old, Guid userid) { Guid result = Guid.Empty; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); DataSet ds = rsql.ExecuteSqlDataSet(string.Format("select new from RFieldForUserNLab where old='{0}'", old)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { result = new Guid(ds.Tables[0].Rows[0][0].ToString()); } CY.CSTS.Core.Business.ExpertField expertfield = new CY.CSTS.Core.Business.ExpertField(); expertfield.FieldID = result; expertfield.ExpertID = userid; expertfield.Save(); }
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 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; } }
/// <summary> /// OK /// </summary> /// <param name="old"></param> /// <returns></returns> public static Guid TransferTradeId(string old) { try { if (!string.IsNullOrEmpty(old)) { RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "Select distinct new from RTrade where old='{0}'"; DataSet ds = rsql.ExecuteSqlDataSet(string.Format(strsql, old)); if (ds != null && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { return new Guid(ds.Tables[0].Rows[0][0].ToString()); } else { return Guid.Empty; } } return Guid.Empty; } 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; } }
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 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)); } } }
private static Guid TransferDomainId(string old) { Guid result = Guid.Empty; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); if (!string.IsNullOrEmpty(old)) { string strsql = "select distinct new from RField where old='{0}'"; DataSet ds = rsql.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 = new Guid(ds.Tables[0].Rows[0][0].ToString()); } } return result; }
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 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())); } } }