// создание объектов private static void CreateObjects(IFaker faker) { ClassA a = faker.Create <ClassA>(); objectList.Add(a); ClassB b = faker.Create <ClassB>(); objectList.Add(b); ClassC c = faker.Create <ClassC>(); objectList.Add(c); ClassD d = faker.Create <ClassD>(); objectList.Add(d); ClassE e = faker.Create <ClassE>(); objectList.Add(e); ClassF f = faker.Create <ClassF>(); objectList.Add(f); ClassG g = faker.Create <ClassG>(); objectList.Add(g); ClassH h = faker.Create <ClassH>(); objectList.Add(h); ClassI i = faker.Create <ClassI>(); objectList.Add(i); }
public Genericitycs2() { this.Method1 <ClassA>(new ClassA()); Console.WriteLine((new ClassA()).ToString()); this.Method1 <ClassA>(new ClassD()); Console.WriteLine((new ClassD()).ToString()); ClassA b = new ClassA(); b.Field1 = 1; b.Field2 = "hi"; this.Method2(b as T); ClassC c = new ClassC(); c.Field1 = 1; c.Field2 = "hi"; c.Field3 = "you"; c.Field4 = 2; this.Method2(c as T); ClassC c1 = this.Method3(2) as ClassC; ClassA a1 = this.Method3(2); ClassA a = new ClassA(); a.Field1 = 10; a.Field2 = "plop"; a.Field3 = "plip"; ClassE e = this.Method4 <ClassE, ClassA, ClassC>(a, c); ClassD d = this.Method4 <ClassD, ClassA, ClassB>(a, c); }
public void XmlTextSizeForClassInheritedFromAGenericList() { var objectToWrite = new ClassE { 1, 2 }; var xmlText = SerializeAsXml(objectToWrite); Assert.Less(xmlText.Length, 2000); }
protected override void OnInit(EventArgs e) { base.OnInit(e); try { classE1_1 = new ClassE(GetDirectory() + userDir); } catch (Exception) { Master.ShowErrorMessage("MPX internal error has occured."); } string sheet = "Cheat Sheet General Input Page"; Master.SetHelpSheet(sheet + ".pdf", sheet); }
public static void save_errors_results(ClassE classE1_1, string msgResults, string msgErrors) { string commandString; string msgResultsRep = msgResults.Replace("<br/>", "\n"); string msgErrorsRep = msgErrors.Replace("<br/>", "\n"); msgResultsRep = DbUse.removeRedColor(msgResultsRep); commandString = "UPDATE zstblresults SET zstblresults.results = '" + msgResultsRep + "';"; classE1_1.runsql(commandString); commandString = "UPDATE zstblresults SET zstblresults.errors = '" + msgErrorsRep + "';"; classE1_1.runsql(commandString); }
protected void MakeResultsTree(string productId) { try { ClassE classE = new ClassE(GetDirectory() + userDir); classE.setGlobalVar(); int prodId = int.Parse(productId); classE.m_makeResultsTree(prodId); classE.place_tree(prodId); classE.Close(); } catch (Exception ex) { logFiles.ErrorLog(ex); Master.ShowErrorMessage("MPX internal error has occured."); } }
public void CanSerialiseClassInheritedFromAGenericList() { var objectToWrite = new ClassE { 1, 2, 3 }; var xmlText = SerializeAsXml(objectToWrite); var testedClass = ReadXmlText <ClassE>(xmlText); Assert.AreEqual(3, testedClass.Count); Assert.AreEqual(1, testedClass[0]); Assert.AreEqual(2, testedClass[1]); Assert.AreEqual(3, testedClass[2]); }
protected void FillAllowableComponentsDdl(AjaxControlToolkit.ComboBox ddl) { { ClassE calc = new ClassE(GetDirectory() + userDir); calc = new ClassE(GetDirectory() + userDir); calc.runsql("DELETE tblPossibleComp.* from tblPossibleComp;"); try { calc.MakePossibleTable(int.Parse(dropListProducts.SelectedValue)); } catch (Exception) { } calc.Close(); } OleDbConnection connec = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + GetDirectory() + userDir + MAIN_USER_DATABASE + ";"); string commandRouting = "Select tblPossibleComp.* from tblPossibleComp ORDER BY ProdDesc;"; OleDbCommand cmd = new OleDbCommand(commandRouting, connec); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); // { try { connec.Open(); DataTable ds = new DataTable(); adapter.Fill(ds); if (ddl != null) { ddl.Items.Clear(); for (int i = 0; i < ds.Rows.Count; i++) { ListItem item = new ListItem(ds.Rows[i]["ProdDesc"].ToString(), ds.Rows[i]["ProdID"].ToString()); ddl.Items.Add(item); } } connec.Close(); } catch (Exception ex) { try { connec.Close(); connec = null; } catch { } string message = ex.Message; } } }
public void SingletonClassETest() { ClassE ins1 = ClassE.Instance; ClassE ins2 = ClassE.Instance; Assert.AreEqual(ins1.Num, 0); Assert.AreEqual(ins1.Num, ins2.Num); ins1.Num = 123; Assert.AreEqual(ins2.Num, 123); ins2.Num = 456; Assert.AreEqual(ins1.Num, 456); }
public static string GetErrorMessage(ClassE classE1_1) { ADODB.Recordset reccust = null; string errorMsg; classE1_1.Open(); DbUse.open_ado_rec(classE1_1.globaldb, ref reccust, "SELECT zstblErrors.* FROM zstblErrors ORDER BY zstblErrors.Level, zstblErrors.text, zstblErrors.Table, " + " zstblErrors.equipid, zstblErrors.partid; "); // 6-26-17 sort by ... errorMsg = ""; while (!reccust.EOF) { errorMsg = errorMsg + (string)reccust.Fields["Text"].Value + "<br/>"; reccust.MoveNext(); } DbUse.CloseAdoRec(reccust); return(errorMsg); }
protected void SetAllowableComponentData() { { ClassE calc = new ClassE(GetDirectory() + userDir); calc = new ClassE(GetDirectory() + userDir); calc.runsql("DELETE * FROM tblPossibleComp;"); try { calc.MakePossibleTable(int.Parse(dropListProducts.SelectedValue)); } catch (Exception) { } calc.Close(); } OleDbConnection connec = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + GetDirectory() + userDir + MAIN_USER_DATABASE + ";"); string commandRouting = "SELECT tblPossibleComp.* from tblPossibleComp ORDER BY ProdDesc;"; OleDbCommand cmd = new OleDbCommand(commandRouting, connec); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); // { try { connec.Open(); DataTable dt = new DataTable(); adapter.Fill(dt); DataView dv = dt.DefaultView; //need to bind this to a droplist connec.Close(); } catch (Exception ex) { try { connec.Close(); connec = null; } catch { } string message = ex.Message; } } }
protected override void SetData() { { ClassE calc = new ClassE(GetDirectory() + userDir); calc.setGlobalVar(); calc.runsql("DELETE * FROM tblbomTree;"); if (dropListProducts.Items.Count > 0 && dropListProducts.SelectedItem == null) { dropListProducts.SelectedIndex = 0; } try { calc.MakeIbomTree(0, int.Parse(dropListProducts.SelectedValue), 0); } catch (Exception) { } calc.Close(); } if (!checkAllSubComponents.Checked) { tableQueryString += " WHERE Show = -1"; } base.SetData(); }
protected override void SetData() { { ClassE calc = new ClassE(GetDirectory() + userDir); calc.setGlobalVar(); calc.runsql("DELETE * FROM tblbomTree;"); if (dropListProducts.Items.Count > 0 && dropListProducts.SelectedItem == null) { dropListProducts.SelectedIndex = 0; } try { calc.MakeIbomTree(0, int.Parse(dropListProducts.SelectedValue), 0); } catch (Exception) { } calc.Close(); } if (!checkAllSubComponents.Checked) { //tableQueryString += " WHERE Show = -1"; tableQueryString += " WHERE Level = 1"; } else { tableQueryString += " WHERE Level >= 1"; } base.SetData(); GridViewRow myRow = grid.FooterRow; TextBox myText = (TextBox)myRow.Cells[2].Controls[0].Controls[0]; myText.Text = "1"; }
/// <summary> /// A method /// </summary> /// <param name="x">ClassA param</param> /// <param name="y">ClassE param</param> /// <returns>a string array</returns> protected virtual string[] MethodC(ClassB x, ClassE y) { return(null); }
public void TestEnumableProperties() { // ²âÊÔÊý×éµÄ¿½±´ ClassD d = new ClassD { VuleTypeArray = new [] { 1, 2, 3 }, ClassATypeArray = new [] { new ClassA { ValueTypeProp = 1, StringProp = "string1" }, new ClassA { ValueTypeProp = 2, StringProp = "string2" } } }; ClassE e = Copier.Copy <ClassD, ClassE>(d); Assert.Equal(d.VuleTypeArray, e.VuleTypeArray); Assert.NotSame(d.VuleTypeArray, e.VuleTypeArray); Assert.Equal(d.ClassATypeArray.Select(x => x.ValueTypeProp), e.ClassATypeArray.Select(x => x.ValueTypeProp)); Assert.Equal(d.ClassATypeArray.Select(x => x.StringProp), e.ClassATypeArray.Select(x => x.StringProp)); Assert.NotEqual(d.ClassATypeArray.AsEnumerable(), e.ClassATypeArray.AsEnumerable()); Assert.NotSame(d.ClassATypeArray, e.ClassATypeArray); // ²âÊÔListµÄ¿½±´ ClassD d2 = new ClassD { VuleTypeList = new List <int> { 1, 2, 3 }, ClassATypeList = new List <ClassA> { new ClassA { ValueTypeProp = 1, StringProp = "string1" }, new ClassA { ValueTypeProp = 2, StringProp = "string2" } } }; ClassE e2 = Copier.Copy <ClassD, ClassE>(d2); Assert.Equal(d2.VuleTypeList, e2.VuleTypeList); Assert.NotSame(d2.VuleTypeList, e2.VuleTypeList); Assert.Equal(d2.ClassATypeList.Select(x => x.ValueTypeProp), e2.ClassATypeList.Select(x => x.ValueTypeProp)); Assert.Equal(d2.ClassATypeList.Select(x => x.StringProp), e2.ClassATypeList.Select(x => x.StringProp)); Assert.NotEqual(d2.ClassATypeList.AsEnumerable(), e2.ClassATypeList.AsEnumerable()); Assert.NotSame(d2.ClassATypeList, e2.ClassATypeList); }
static void Main(string[] args) { IKernel kernel = new StandardKernel(new ModuleBinding()); ClassA a = new ClassA(); a.Method1(); a.Method2(); // hello world a.Method3(); ClassB b = new ClassB(); b.Method1(); b.Method2(); b.Method3(); ClassD d = new ClassD(a); d.Method1(); ClassE e = new ClassE(); e.Method2(); e.Method5(); ClassH h = new ClassH(); h.Method2(); ClassJ j = new ClassJ(); j.Method1(); ClassK k = new ClassK(); k.Method1(); ClassM m = new ClassM(); m.Method2(); m.Method3(); m.Method7(); m.Method8(); ClassN n = new ClassN(); n.Method3(); ClassO o = new ClassO(); o.Method2(); ClassP p = new ClassP(); p.Method10(); p.Method2(); p.Method9(); ClassL l = new ClassL(p); l.Method1(); ClassQ q = new ClassQ(); q.Method3(); ClassR r = new ClassR(); r.Method1(); ClassS s = new ClassS(); s.Method1(); s.Method2(); s.Method3(); ClassT t = new ClassT(e); t.Method2(); ClassU u = new ClassU(); u.Mehthod1(); ClassV v = new ClassV(); v.Method2(); ClassW w = new ClassW(kernel.Get <IInterfaceSomething>()); w.Method2(); w.Method3(); ClassX x = new ClassX(); x.Method1(); ClassY y = new ClassY(); y.Method2(); ClassZ z = new ClassZ(); z.Method2(); }