private static void AddAirsToSql(List <AirCompany> Tmp) { String SQLPL = @"Data Source=192.168.222.116\SQLEXPRESS;Initial Catalog=CFCStandaloneDB;User ID=manager;Password=manager "; //string pStr = @"TERM1\SQLEXPRESS"; var db = new CFCdbDataContext(SQLPL); foreach (AirCompany d in Tmp.Where(a => a.Id > 3)) { Tender oldtndr = db.Tender.FirstOrDefault(a => a.Number == 101); Tender tndr = new Tender(); foreach (PropertyInfo PI in tndr.GetType().GetProperties()) { object val = tndr.GetType().GetProperty(PI.Name).GetValue(oldtndr); tndr.GetType().GetProperty(PI.Name).SetValue(tndr, val); } tndr.Id = Guid.NewGuid(); tndr.Number = (int)d.Id + 100; tndr.Name = d.Name.Substring(0, Math.Min(d.Name.Length, 9)); db.Tender.InsertOnSubmit(tndr); db.SubmitChanges(); //tndr.FK_ReportAsTender = tndr.Id; //db.SubmitChanges(); } }
public Tender GetPostQualificationWithWithTenderObject() { Tender postQualification = new Tender("022001000000", 1, (int)Enums.TenderType.PostQualification, (int)Enums.InvitationType.Public, "Tender name test", "tender number", "Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse ", null, 1, 1, 1, null, null, null, null, null, null, null, 1, 1000, null, 1, // replace conditon book vale with null null, null, null, null, null, null, null, null, null, false, null, null, 500, null); var tender = new Tender("022001000000", 1, (int)Enums.TenderType.NewDirectPurchase, (int)Enums.InvitationType.Specific, "Tender name test", "tender number", "Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse Purpuse ", null, 1, null, null, 1, null, 1, null, null, null, null, 1, 1000, null, 1, null, null, null, null, null, null, null, null, null, false, null, null, 500); PropertyInfo propertyInfo = postQualification.GetType().GetProperty("PostQualificationTender"); propertyInfo.SetValue(postQualification, tender); postQualification.PostQualificationInvitations.Add(new PostQualificationSuppliersInvitations("1010000154")); return(postQualification); }