// Use this for initialization void Start() { holder = transform.GetChild(0).gameObject; // this is bad, dont do it lol. ill fix it later spriteRenderer = holder.transform.GetChild(0).GetComponent<SpriteRenderer>(); if(isBuilding) { baseBuilding = transform.parent.gameObject.GetComponent<Building>(); TotalHealth = baseBuilding.health; if(baseBuilding.team == GameData.MyPlayer.TeamID) { spriteRenderer.sprite = allyHealth; }else { spriteRenderer.sprite = enemyHealth; } }else { baseClass = transform.parent.gameObject.GetComponent<BaseClass>(); TotalHealth = baseClass.ClassStat.MaxHp; // fix this later too if(baseClass.team == GameData.MyPlayer.TeamID) { spriteRenderer.sprite = allyHealth; }else { spriteRenderer.sprite = enemyHealth; } } }
public static void Main() { BaseClass obj1=new BaseClass(); CheckReturnedInt(obj1.F1("obj1"), 1); CheckReturnedString(obj1.F2("obj1"), "String returned from BaseClass.F2:obj1"); CheckReturnedString(obj1.NonVirtualFunc(11), "String returned from BaseClass.NonVirtualFunc:11"); Console.WriteLine(""); DerivedClass obj2=new DerivedClass(); CheckReturnedInt(obj2.F1("obj2"), 2); CheckReturnedString(obj2.F2("obj2"), "String returned from DerivedClass.F2:obj2"); CheckReturnedString(obj2.NonVirtualFunc(15), "String returned from DerivedClass.NonVirtualFunc:30"); Console.WriteLine(""); BaseClass objectRef; objectRef = obj1; CheckReturnedInt(objectRef.F1("objectRef is now obj1"), 1); CheckReturnedString(objectRef.F2("objectRef is now obj1"), "String returned from BaseClass.F2:objectRef is now obj1"); CheckReturnedString(objectRef.NonVirtualFunc(11), "String returned from BaseClass.NonVirtualFunc:11"); Console.WriteLine(""); objectRef = obj2; CheckReturnedInt(objectRef.F1("objectRef is now obj2"), 2); CheckReturnedString(objectRef.F2("objectRef is now obj2"), "String returned from DerivedClass.F2:objectRef is now obj2"); CheckReturnedString(objectRef.NonVirtualFunc(15), "String returned from BaseClass.NonVirtualFunc:15"); Console.WriteLine(""); if (failed) { System.Environment.ExitCode = 1; } else { System.Environment.ExitCode = 0; } }
static void Main(string[] args) { BaseClass ba = new BaseClass("Arif"); BaseClass.MySecondClass mySecond = ba.GetMySecondClass(); mySecond.MyMethod(); }
public static void CallBaseMethod( BaseClass fake, int returnValue, bool callbackWasInvoked) { "Given a fake" .x(() => fake = A.Fake<BaseClass>()); "And I configure a method to invoke an action and call the base method" .x(() => A.CallTo(() => fake.ReturnSomething()) .Invokes(x => callbackWasInvoked = true) .CallsBaseMethod()); "When I call the method" .x(() => returnValue = fake.ReturnSomething()); "Then it calls the base method" .x(() => fake.WasCalled.Should().BeTrue()); "And it returns the value from base method" .x(() => returnValue.Should().Be(10)); "And it invokes the callback" .x(() => callbackWasInvoked.Should().BeTrue()); }
static void Main(string[] args) { //MyGenerics<int> mygen = new MyGenerics<int>(100); // myclass[] m = new myclass[5]; // //for (int i = 0; i <= m.GetUpperBound(0); i++) // //{ // // m[i] = new myclass("Sub" + i); // //} // //Console.WriteLine(m.GetUpperBound(0)); // //Console.WriteLine(m.GetLowerBound(0)); // //MyGenerics<myclass> mygen = new MyGenerics<myclass>(m); // ////mygen.ShowT(); // //mygen.IterateT(); // int num1 = 10; // int num2 = 20; // string fname = "arif"; // string lname = "khan"; // Console.WriteLine("Number1 : " + num1 + " Number2 : " + num2); // GenericMethod method = new GenericMethod(); // method.Swap<int>(ref num1, ref num2); // method.Swap<string>(ref fname, ref lname); // Console.WriteLine("Frist name " + fname + " Lname " + lname); // Console.WriteLine("Number1 : " + num1 + " Number2 : " + num2); //} BaseClass<int> bs = new BaseClass<int>(100, 200); bs.Show(); bs.Swap(); bs.Show(); }
private void Create(BaseClass baseClass, Write write) { BaseClass = baseClass; Define = new Define(); Init = new Init(this); Write = write; }
public Configuration(BaseClass home) { Class = new Classes(this); Class.DeclareClasses(home); Class.Set.Title = new List<string>(); Class.Set.Data = new List<string>(); }
/// <summary> /// Создание объекта класс с инициализацией полей /// </summary> /// <param name="bookingClassCode">Класс перелёта</param> /// <param name="baseClass">Базовый класс перелёта</param> /// <param name="baggage">Допустимая мера багажа для данного класса перелёта</param> public BookingClass(string bookingClassCode, BaseClass? baseClass = null, int freeSeatCount = -1, string mealType = null, Baggage baggage = null) { BookingClassCode = bookingClassCode; BaseClass = baseClass; Baggage = baggage; MealType = mealType; FreeSeatCount = freeSeatCount >= 0 ? freeSeatCount : (int?)null; }
new void Start() { base.Start(); target = gameObject.GetComponent<BaseClass>(); target.ClassStat.AtkPower += attackBuff; target.ClassStat.Defense += defenseBuff; target.ClassStat.MoveSpeed += speedBuff; duration = 75; }
public void SimpleContextExpression_InvocationOfAMethodThatReturnsTheValueOfASpecificPropertyOfTheInstance_ReturnsTheCorrectValueOfTheProperty() { BaseClass @base = new BaseClass(); Func<int> @delegate = @base.GetValue; var func = ExecuteLambdaWithContext<Func<int>, BaseClass>(@delegate, @base); var result = func(); Assert.AreEqual(result, 10); }
public void VerifyAddRemoveEventHandler3() { EventInfo ei = GetEventInfo(typeof(BaseClass), "EventPublicVirtual"); Assert.NotNull(ei); EventHandler myhandler = new EventHandler(MyEventHandler); BaseClass obj = new BaseClass(); ei.AddEventHandler(obj, myhandler); //Try to remove event Handler and Verify that no exception is thrown. ei.RemoveEventHandler(obj, myhandler); }
// Use this for initialization void Start () { lastPosition = transform.position; NetworkingManager.Subscribe(update_position, DataType.Player, playerID); NetworkingManager.Subscribe(took_damage, DataType.Hit, playerID); NetworkingManager.Subscribe(died, DataType.Killed, playerID); NetworkingManager.Subscribe(use_potion, DataType.Potion, playerID); NetworkingManager.Subscribe(new_stats, DataType.StatUpdate, playerID); GameData.PlayerPosition.Add(playerID, transform.position); baseClass = GetComponent<BaseClass>(); animator = gameObject.GetComponent<Animator>(); }
void Start() { rb2d = GetComponent<Rigidbody2D>(); midX = Screen.width / 2; midY = Screen.height / 2; up = "w"; down = "s"; left = "a"; right = "d"; movestyles = movestyle.absolute; anim = gameObject.GetComponent<Animator>(); baseClass = gameObject.GetComponent<BaseClass>(); GameData.PlayerPosition.Add(GameData.MyPlayer.PlayerID, transform.position); }
public static void CallToNonVirtualNonVoidOnFake( BaseClass fake, Exception exception) { "Given a fake" .x(() => fake = A.Fake<BaseClass>()); "When I start to configure a non-virtual non-void method on the fake" .x(() => exception = Record.Exception(() => A.CallTo(() => fake.ReturnSomethingNonVirtual()))); "Then it throws a fake configuration exception" .x(() => exception.Should().BeAnExceptionOfType<FakeConfigurationException>() .And.Message.Should().Contain("Non virtual methods can not be intercepted.")); }
public void CanSetTransparentProxy() { PropertyOrFieldNode pofNode = new PropertyOrFieldNode(); pofNode.Text = "ObjectProp"; BaseClass ouc = new BaseClass(); TestTransparentProxyFactory tpf = new TestTransparentProxyFactory(null, typeof(ITestObject), null); object tpo = tpf.GetTransparentProxy(); Assert.IsTrue( tpo is ITestObject ); ITestObject itpo = tpo as ITestObject; Assert.IsNotNull(itpo); pofNode.SetValue( ouc, null, itpo); Assert.AreSame( tpo, ouc.ObjectProp ); }
public void SetValue_SetsPropertyValue() { // Arrange var expected = "new value"; var instance = new BaseClass { PropA = "old value" }; var helper = PropertyHelper.GetProperties( instance.GetType()).First(prop => prop.Name == "PropA"); // Act helper.SetValue(instance, expected); // Assert Assert.Equal(expected, instance.PropA); }
public void PropertyHelper_ReturnsSetterDelegate() { // Arrange var expected = "new value"; var instance = new BaseClass { PropA = "old value" }; var helper = PropertyHelper.GetProperties( instance.GetType()).First(prop => prop.Name == "PropA"); // Act and Assert Assert.NotNull(helper.ValueSetter); helper.ValueSetter(instance, expected); // Assert Assert.Equal(expected, instance.PropA); }
internal static void inheritance() { Console.Clear(); BaseClass b = new BaseClass(); Program1 p = new Program1(); b.print(); p.print(); Console.WriteLine("BaseClass.math: {0}", b.math(2, 3)); Console.WriteLine("Inheritance.math: {0}", p.math(2, 3)); Console.ReadLine(); return; }
new void Start() { base.Start(); target = gameObject.GetComponent<BaseClass>(); target.ClassStat.MaxHp += hpBuff; area = (Rigidbody2D)Resources.Load("Prefabs/AmanBuffArea", typeof(Rigidbody2D)); //load indicator if (target.playerID == GameData.AllyKingID) indicator = (GameObject)Resources.Load("Prefabs/AllyAmanCircle", typeof(GameObject)); else indicator = (GameObject)Resources.Load("Prefabs/EnemyAmanCircle", typeof(GameObject)); instance = (GameObject)Instantiate(indicator, transform.position, transform.rotation); instance.transform.parent = target.transform; }
public Chapter2() { BaseClass baseObj = new BaseClass(); DerivedAlpha dObj1 = new DerivedAlpha(); DerivedBeta dObj2 = new DerivedBeta(); BaseClass baseRef; baseRef = baseObj; baseRef.Metod(); baseRef = dObj1; baseRef.Metod(); baseRef = dObj2; baseRef.Metod(); }
static void Main() { BaseClass b1 = new BaseClass(); DerivedClass d1 = new DerivedClass(); b1.Name = "Mary"; d1.Name = "John"; b1.Id = "Mary123"; d1.Id = "John123"; // The BaseClass.Id property is called. System.Console.WriteLine("Base: {0}, {1}", b1.Name, b1.Id); System.Console.WriteLine("Derived: {0}, {1}", d1.Name, d1.Id); // Keep the console window open in debug mode. System.Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); }
public void PlayerTookDamage(int playerID, float newHP, BaseClass.PlayerBaseStat ClassStat) { var damage = (ClassStat.CurrentHp - newHP); if (GameData.MyPlayer.PlayerID == playerID) { HUD_Manager.instance.UpdatePlayerHealth(-(damage/ClassStat.MaxHp)); if (ClassStat.CurrentHp <= 0) { PlayerDied(); } else { if (damage > 0) { HUD_Manager.instance.colourizeScreen.PlayerHurt(); } else if (damage < 0) { HUD_Manager.instance.colourizeScreen.PlayerHealed(); } } } }
public void SetClass(int classIndex) { switch (classIndex) { case 1: playerClass = new StealthClass (); Debug.Log (gameObject.name + " Class = Stealth"); break; case 2: playerClass = new TechClass (); Debug.Log (gameObject.name + " Class = Tech"); break; case 3: playerClass = new WarriorClass (); Debug.Log (gameObject.name + " Class = Warrior"); break; } movesLeft = playerClass.agility; }
static void Main() { BaseClass b = new BaseClass(); DerivedClass d = new DerivedClass(); // Display custom attributes for each class. Console.WriteLine("Attributes on Base Class:"); object[] attrs = b.GetType().GetCustomAttributes(true); foreach (Attribute attr in attrs) { Console.WriteLine(attr); } Console.WriteLine("Attributes on Derived Class:"); attrs = d.GetType().GetCustomAttributes(true); foreach (Attribute attr in attrs) { Console.WriteLine(attr); } Console.ReadKey(); }
public static void OverVirtualHidelColl2() { BaseClass bc = new BaseClass(); DerivedClass dc = new DerivedClass(); BaseClass bcdc = new DerivedClass(); bc.Method1(); bc.Method2(); dc.Method1(); dc.Method2(); bcdc.Method1(); bcdc.Method2(); // Output: // Base - Method1 // Base - Method2 // Derived - Method1 // Derived - Method2 // Derived - Method1 // Base - Method2 }
public static void CallBaseMethod( BaseClass fake, int returnValue, bool callbackWasInvoked) { "establish" .x(() => fake = A.Fake<BaseClass>()); "when configuring to call base method" .x(() => { A.CallTo(() => fake.ReturnSomething()).Invokes(x => callbackWasInvoked = true).CallsBaseMethod(); returnValue = fake.ReturnSomething(); }); "it should have called the base method" .x(() => fake.WasCalled.Should().BeTrue()); "it should return value from base method" .x(() => returnValue.Should().Be(10)); "it should invoke the callback" .x(() => callbackWasInvoked.Should().BeTrue()); }
public IList <IWebElement> GetIncompletFormsCmFromExpandView(string formDescription) { IList <IWebElement> records = BaseClass.GetDriver().FindElements(By.XPath(cmLoginPage.FormEditLinkFromCmFromExpandView.Replace("$$", formDescription))); return(records); }
public MyNewClass(BaseClass baseClass) { BaseProperty1 = baseClass.BaseProperty1; BaseProperty2 = baseClass.BaseProperty1; BaseProperty3 = baseClass.BaseProperty1; }
public void SetTarget(BaseClass newTarget) { target = newTarget; }
protected override void Initialize(System.Web.Routing.RequestContext requestContext) { base.Initialize(requestContext); this.currentUser = BaseClass.GetSession <Account>("User"); }
public void GivenIOpenBrowserAndNavigateToTheUrl() { BaseClass init = new BaseClass(); init.Initialize(); }
public void BaseClassErrorsWithNoArguments() { var expected = new BaseClass(); }
public override void StopHandler(BaseClass sender, StateEventArgs e) { base.StopHandler(sender, e); ActionSMEMAReady(false); }
public void WhenIFillInFromAndToCity() { BaseClass.EnterCities(); }
protected void btnContinue_Click(object sender, EventArgs e) { try { BaseClass baseCls = new BaseClass(); baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]); string strBoardingPointId = hdnBoardingPointIdJQ.Value; string strSeatList = hdnSeatListJQ.Value; string strFare = hdnFareJQ.Value; string strTravelInfo = hdnTravelInfoJQ.Value; string strBoardingPointName = hdnBoardingPointNameJQ.Value; string strBoardingPointAddress = ""; string lblB = Session["lblB"].ToString(); string serviceNumber = Session["ServiceNumber"].ToString(); string strInfo = ""; int noOfSeats = strSeatList.ToString().Split(',').Length; if (lblB.ToString().Split(';')[0].ToString() == "Kes") { if (noOfSeats > 4) { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('" + "You can select max 4 seats." + "');</script>", false); return; } } else { if (noOfSeats > 6) { ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('" + "You can select max 6 seats." + "');</script>", false); return; } } string[] str = new string[1]; str[0] = " || "; string[] strTravelInfoArray = strTravelInfo.Split(str, StringSplitOptions.None); DataTable dt = (DataTable)Session["dtBPForAddressAndLandmark"]; if (strBoardingPointName != "") { DataRow[] dr = dt.Select("Name ='" + strBoardingPointName + "'"); string str11 = "" + dr[0]["Landmark"].ToString(); strBoardingPointAddress = str11; if (str11 == "") { strBoardingPointAddress = dr[0]["Address"].ToString(); } strBoardingPointAddress = strBoardingPointAddress + ", " + dr[0]["Address"].ToString() + ", " + dr[0]["ContactNumber"].ToString(); } if (lblB.ToString().Split(';')[0].ToString() == "Kes") { DataTable dtDroppiongPoints = (DataTable)Session["dtDPForAddressAndLandmark"]; DataRow dr = dtDroppiongPoints.Rows[Convert.ToInt32(dtDroppiongPoints.Rows.Count - 1)]; string bpPointsKes = ""; bpPointsKes = strBoardingPointId; if (noOfSeats > 1) { for (int i = 0; i < noOfSeats - 1; i++) { bpPointsKes = bpPointsKes + "," + strBoardingPointId; } } strInfo = ";" + Convert.ToString(noOfSeats) + ";" + strSeatList + ";" + bpPointsKes + ";" + strFare + ";" + dr["Id"].ToString(); } else if (lblB.ToString().Split(';')[0].ToString() == "Bit") { strInfo = ";" + Convert.ToString(noOfSeats) + ";" + strBoardingPointId + ";" + strSeatList; } else if (lblB.ToString().Split(';')[0].ToString() == "Abh") { strInfo = ";" + strSeatList + ";" + strBoardingPointId + ";" + Convert.ToString(noOfSeats); } else if (lblB.ToString().Split(';')[0].ToString() == "Kal") { strInfo = ";" + strSeatList + ";" + strBoardingPointId + ";" + Convert.ToString(noOfSeats); } else if (lblB.ToString().Split(';')[0].ToString() == "Tig") { strInfo = ";" + strBoardingPointId; } DataTable dtTicketInfo = new DataTable(); dtTicketInfo.TableName = "TicketDetails"; dtTicketInfo.Columns.Add("Route"); dtTicketInfo.Columns.Add("JourneyDate"); dtTicketInfo.Columns.Add("Travels"); dtTicketInfo.Columns.Add("BusType"); dtTicketInfo.Columns.Add("SeatNos"); dtTicketInfo.Columns.Add("TotalFare"); dtTicketInfo.Columns.Add("BoardingPoint"); dtTicketInfo.Columns.Add("Title"); dtTicketInfo.Columns.Add("FullName"); dtTicketInfo.Columns.Add("Age"); dtTicketInfo.Columns.Add("PhoneNo"); dtTicketInfo.Columns.Add("EmailId"); dtTicketInfo.Columns.Add("Address"); dtTicketInfo.Columns.Add("OtherInfo"); dtTicketInfo.Columns.Add("BoardingInfo"); dtTicketInfo.Columns.Add("ServiceNumber"); dtTicketInfo.Columns.Add("FullNameList"); dtTicketInfo.Columns.Add("PhoneNoList"); dtTicketInfo.Columns.Add("AgeList"); dtTicketInfo.Columns.Add("GenderList"); dtTicketInfo.Columns.Add("IdType"); dtTicketInfo.Columns.Add("IdNo"); dtTicketInfo.Columns.Add("IdIssuedBy"); DataRow drTicketDetails = dtTicketInfo.NewRow(); drTicketDetails["Route"] = baseCls.preLoadParams[4].ToString() + " To " + baseCls.preLoadParams[5].ToString() + ""; drTicketDetails["JourneyDate"] = baseCls.preLoadParams[2].ToString(); drTicketDetails["Travels"] = strTravelInfoArray[0].ToString(); drTicketDetails["BusType"] = strTravelInfoArray[1].ToString(); drTicketDetails["SeatNos"] = strSeatList; drTicketDetails["BoardingPoint"] = strBoardingPointName; drTicketDetails["Title"] = ""; drTicketDetails["FullName"] = ""; drTicketDetails["Age"] = ""; drTicketDetails["PhoneNo"] = ""; drTicketDetails["EmailId"] = ""; drTicketDetails["Address"] = ""; drTicketDetails["TotalFare"] = strFare; drTicketDetails["OtherInfo"] = lblB + strInfo; drTicketDetails["BoardingInfo"] = strBoardingPointAddress; drTicketDetails["ServiceNumber"] = serviceNumber; drTicketDetails["FullNameList"] = ""; drTicketDetails["PhoneNoList"] = ""; drTicketDetails["AgeList"] = ""; drTicketDetails["GenderList"] = ""; drTicketDetails["IdType"] = ""; drTicketDetails["IdNo"] = ""; drTicketDetails["IdIssuedBy"] = ""; dtTicketInfo.Rows.Add(drTicketDetails); Session["dtTicketInfo"] = dtTicketInfo; Session["ddlSources"] = baseCls.preLoadParams[0].ToString(); Session["ddlDestinations"] = baseCls.preLoadParams[1].ToString(); Session["DOJ"] = baseCls.preLoadParams[2].ToString(); Session["From"] = baseCls.preLoadParams[4].ToString(); Session["To"] = baseCls.preLoadParams[5].ToString(); Session["ddlSourcesReturn"] = baseCls.preLoadParams[1].ToString(); Session["ddlDestinationsReturn"] = baseCls.preLoadParams[0].ToString(); Session["DOJReturn"] = baseCls.preLoadParams[3].ToString(); Session["FromReturn"] = baseCls.preLoadParams[5].ToString(); Session["ToReturn"] = baseCls.preLoadParams[4].ToString(); Session["OneWayOrRoundTrip"] = baseCls.preLoadParams[6].ToString(); if (baseCls.preLoadParams[6].ToString() == "OneWay") { Session["dtTicketInfoReturn"] = null; Response.Redirect("~/CustInfo.aspx", false); } else { Response.Redirect("~/ShowTrips_ReturnJourney.aspx", false); } } catch (Exception) { throw; } }
public override bool AssignCompatible(BaseClass otherClass) => otherClass.IsNumeric;
public void GivenUserHasEnteredTheURL() { BaseClass.OpenURL(); }
public void GivenINavigateToHomepage() { homepage = BaseClass.GivenINavigateToHomePage(); homepage.AndIAmOnHomePage(); loginpage = homepage.AndIClickLoginButton(); }
public void ShowNewOrVitual() { BaseClass a = new BaseClass(); BaseClass b = new ChildClass1(); BaseClass c = new ChildClass2(); ChildClass1 d = new ChildClass1(); ChildClass1 e = new ChildClass2(); ChildClass2 f = new ChildClass2(); string all = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n", a.Show(), b.Show(), c.Show(), d.Show(), e.Show(), f.Show()); }
protected void Page_Load(object sender, EventArgs e) { string fundCode = ""; string branchCode = ""; if (BaseContent.IsSessionExpired()) { Response.Redirect("../../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); branchCode = (string)Session["branchCode"]; fundCode = (string)Session["fundCode"]; DataTable dtReport = reportObj.getDtForReportStatement(); dtReport.TableName = "ReportStatement"; DataRow drReport; DataTable dtReportStatement = (DataTable)Session["dtReportStatement"]; if (dtReportStatement.Rows.Count > 0) { int repNo = 0; string SL_TR_NO = ""; for (int looper = 0; looper < dtReportStatement.Rows.Count; looper++) { drReport = dtReport.NewRow(); drReport["REP_NO"] = Convert.ToInt32(dtReportStatement.Rows[looper]["REP_NO"].ToString()); drReport["REP_DT"] = dtReportStatement.Rows[looper]["REP_DT"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["REP_DT"].ToString(); drReport["SL_TR_REP_NO"] = dtReportStatement.Rows[looper]["SL_TR_NO"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["SL_TR_NO"].ToString(); drReport["HNAME"] = dtReportStatement.Rows[looper]["HNAME"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["HNAME"].ToString(); drReport["JNT_NAME"] = dtReportStatement.Rows[looper]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["JNT_NAME"].ToString(); drReport["ADDRS1"] = dtReportStatement.Rows[looper]["ADDRS1"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ADDRS1"].ToString(); drReport["ADDRS2"] = dtReportStatement.Rows[looper]["ADDRS2"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ADDRS2"].ToString(); drReport["CITY"] = dtReportStatement.Rows[looper]["CITY"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CITY"].ToString(); drReport["REG_NO"] = dtReportStatement.Rows[looper]["REG_NO"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["REG_NO"].ToString(); drReport["BO"] = dtReportStatement.Rows[looper]["BO"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["BO"].ToString(); repNo = Convert.ToInt32(dtReportStatement.Rows[looper]["REP_NO"].ToString()); SL_TR_NO = dtReportStatement.Rows[looper]["SL_TR_NO"].ToString(); drReport["CERT_NO"] = reportObj.getTotalCertNo("SELECT NVL(CERT_TYPE,' ') AS CERT_TYPE, NVL(CERT_NO,0) AS CERT_NO FROM REP_CERT_NO WHERE REP_NO=" + repNo + " AND REG_BK='" + fundCode.ToString() + "'AND REG_BR='" + branchCode.ToString() + "' AND SL_TR_NO='" + SL_TR_NO.ToString() + "'", fundCode.ToString()).ToString(); drReport["CIP"] = dtReportStatement.Rows[looper]["CIP"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["CIP"].ToString(); // drReport["ID_AC"] = dtReportStatement.Rows[looper]["ID_AC"].Equals(DBNull.Value) ? "" : dtReportStatement.Rows[looper]["ID_AC"].ToString(); drReport["QTY"] = Convert.ToInt32(dtReportStatement.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0": dtReportStatement.Rows[looper]["QTY"].ToString()); drReport["RATE"] = decimal.Parse(dtReportStatement.Rows[looper]["RATE"].Equals(DBNull.Value) ? "0" : dtReportStatement.Rows[looper]["RATE"].ToString()); drReport["AMOUNT"] = decimal.Parse(dtReportStatement.Rows[looper]["AMOUNT"].Equals(DBNull.Value) ? "0" : dtReportStatement.Rows[looper]["AMOUNT"].ToString()); dtReport.Rows.Add(drReport); } // dtReport.WriteXmlSchema(@"F:\GITHUB_AMCL\DOTNET2015\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\dtUnitReportForStatement.xsd"); rep_Statement.Refresh(); rep_Statement.SetDataSource(dtReport); rep_Statement.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString())); rep_Statement.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCode.ToString()).ToString()); rep_Statement.SetParameterValue("branchCode", branchCode.ToString()); CrystalReportViewer1.ReportSource = rep_Statement; //ReportDocument rdoc = new ReportDocument(); //string Path = Server.MapPath("Report/rptRepStatement.rpt"); //rdoc.Load(Path); //rdoc.SetDataSource(dtReport); //CrystalReportViewer1.ReportSource = rdoc; //rdoc.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString())); //rdoc.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCode.ToString()).ToString()); //rdoc.SetParameterValue("branchCode", branchCode.ToString()); } else { Response.Write("No data found"); } }
public static string myFunc(BaseClass bc) { return("BaseClass"); }
public void BaseClassErrorsWhenKeyAndTokenSpecified() { var expected = new BaseClass(apiKey: "demo", accessToken: "demooooo-oooo-oooo-oooo-oooooooooooo"); }
// based on the example here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords static void Main() { // START OF TEST SECTION FOR PERSON Console.WriteLine(2014 % 12); DateTime myBirthday = new DateTime(2004, 3, 16); DateTime myBirthdayOlder = new DateTime(1990, 3, 16); Person me = new Person("Stavros", "Fakiolas", myBirthday, "*****@*****.**"); Console.WriteLine(me.Valid); Console.WriteLine(me.Adult); Console.WriteLine(me.Birthday); Console.ReadKey(); Student meButStudent = new Student("Stavros", "Fakiolas", myBirthday, "*****@*****.**", "12"); Teacher meButTeacher = new Teacher("Stavros", "Fakiolas", myBirthdayOlder, "*****@*****.**", "Pain and Suffering"); Console.ReadKey(); // END OF TEST SECTION FOR PERSON #region 1 // Step 1 create the instances of the objects BaseClass bc = new BaseClass(); DerivedClass dc = new DerivedClass(); // this is the one that's going to mess with your heads. BaseClass bcdc = new DerivedClass(); Console.WriteLine("bc 1/2"); bc.Method1(); bc.Method2(); bc.MethodA(); Console.WriteLine("\ndc 1/2"); dc.Method1(); dc.Method2(); Console.WriteLine("\nbcdc 1/2"); bcdc.Method1(); #endregion #region 3 predict the output //// #3 bcdc.Method2(); #endregion #region 7 lists // step 7 - putting them in a list // List<BaseClass> lb = new List<BaseClass> { bc, dc, bcdc }; // List<DerivedClass> ld = new List<DerivedClass> { bc, dc, bcdc}; #endregion #region 8 // step 8 method 3 - will work with ld, but not with lb #endregion #region 9 abstract // step 9 note we've not even talked about abstract ... #endregion Console.ReadKey(); }
void DoCall(BaseClass cls) { cls.CallMultipleTimes(new String[] { "buffer1", "buffer2", "buffer3" }); }
public TransPNPWorkStateMachine(BaseClass ownerObject, string ExtendName = "") : base("TransPNPWorkStateMachine", ownerObject, ExtendName) { // TODO: Add constract code here, if needed. }
public BaseClass(BaseClass dc) { this.Field1 = dc.Field1; }
static void Main() { BaseClass myBase = new BaseClass(); // Ok. BaseClass.intM = 444; // CS0117 }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); bool needIGoOn = true; while (needIGoOn) { Console.WriteLine("Option-1: Data Structure \n" + "Option-2: Algorithms \n" + "OPtion-3: Tutorial \n" + "Option-4: Coding Problems \n" + "Option-5: Sub-Console-App \n" + "Option-6: Quit \n"); int option = Convert.ToInt32(Console.ReadLine()); switch (option) { #region Data-Structure code practice case 1: Console.WriteLine("Data Structure"); //LinkedListProgram linkedListProgram = new LinkedListProgram(); //LinkedListProgram.LinkedList linkedList = new LinkedListProgram.LinkedList(); ////LinkedList linkedList = new LinkedList(); //linkedList.AddNodeToFront(5); //linkedList.AddNodeToFront(7); //linkedList.AddNodeToFront(1); //linkedList.AddNodeToFront(5); //linkedList.AddNodeToFront(10); //linkedList.AddNodeToFront(15); //linkedList.AddNodeToFront(4); //linkedList.PrintList(); //Console.WriteLine("\n --------------- \n we are done"); Console.WriteLine("We now have \n" + "1)LinkedList (Custom one without collections) \n" + "2) Array \n"); int x = Int16.Parse(Console.ReadLine()); switch (x) { case 1: BaseClass callThisClass = new BaseClass(); callThisClass.BaseMethod(); break; case 2: var array_variable = new Array_Related(); array_variable.someFunc(); break; } break; #endregion #region Algorithms practice case 2: Console.WriteLine("Algorithms"); break; #endregion case 3: // --------------------- Tutorial --------------------- // Console.WriteLine("Tutorial \n" + "Opt-1: Multiple-Inheritance \n" + "Opt-2: Structure in C# \n"); int choice = Int16.Parse(Console.ReadLine()); switch (choice) { #region Multiple inheritence tutrial case 1: var tryingMultipleInheritance = new MultipleInheritancExample(); tryingMultipleInheritance.AMethod(); tryingMultipleInheritance.BMethod(); break; #endregion #region Structs tutorial case 2: /* in the below syntax we are using default constructor * and declaring the properties of the elements inside the * structure. */ Customer C1 = new Customer(101, "Mark"); C1.PrintDetails(); Customer C2 = new Customer(); C2.ID = 102; //comment this, for below explaination C2.Name = "John"; //comment this, for below explaination C2.PrintDetails(); /********** What if we dont declare the properties ********* * Ans ``` Id = 0 && Name= ``` * basically these are default values */ //Another syntax for structure intialization //it is called object initializer syntax Customer C3 = new Customer { ID = 103, Name = "Rob" }; C3.PrintDetails(); break; #endregion #region Abstract Classes case 3: //One way of initializing abstract class Abstract_class_related P = new Abstract_class_related(); P.Print(); P.AnotherMethod(); //Another way of initialzing abstract class Abstract_className_Customer P_new = new Abstract_class_related(); P_new.Print(); /* The above code works because, * A parent class reference variable can point to a * derived class object. */ break; #endregion #region Class Constructors case 4: Varying_Constructor_technique cust_var = new Varying_Constructor_technique(); Console.WriteLine(cust_var.Id); Console.WriteLine(cust_var.Name); var customer_ = new Varying_Constructor_technique(1, "Johnson"); Console.WriteLine(customer_.Id); Console.WriteLine(customer_.Name); break; #endregion #region Collections Library case 5: CollectionsClass c_class = new CollectionsClass(); c_class.FuncForArrayList(); c_class.FuncForDictionary(); c_class.FuncForQueue(); c_class.FuncForStacks(); break; #endregion #region Getters and Setter property code case 6: Student S1 = new Student(); S1.Id = 101; S1.Name = "Chinmay"; S1.Email = "*****@*****.**"; S1.City = "Mumbai"; Console.WriteLine("{0} {1} {2} ", S1.Name, S1.Id, S1.Email); /* If you are using a constructor then initilize the value of * the setter method with value passed during object creation * ie basically; * 1)name of class variable is ```private int _id``` * 2)name of setter method is ```public int Id ``` * 3) we can assign the value for our setter method using the constructor * ```this.Id = <value passed in the constructor>``` */ // Student S1 = new Student(); //Console.WriteLine("{0} ", S1.Id); break; #endregion #region Generics Library case 7: List <Animal> animailList = new List <Animal>(); animailList.Add(new Animal() { Name = "Doug" }); animailList.Add(new Animal() { Name = "Paul" }); animailList.Add(new Animal() { Name = "Sally" }); animailList.Insert(1, new Animal() { Name = "Steve" }); animailList.RemoveAt(1); Console.WriteLine("Number of animals {0}", animailList.Count); foreach (var a in animailList) { Console.WriteLine(a.Name); } int ab = 5, ac = 5; Animal.GetSum(ref ab, ref ac); break; #endregion } break; #region Case 4 is about Coding Problem solving case 4: Console.WriteLine("Case-2"); break; #endregion #region Case 5 is about Custom-Console-App case 5: needIGoOn = false; Console.WriteLine("You Quit your Main Project"); break; #endregion case 6: needIGoOn = false; Console.WriteLine("You Quit your Main Project"); break; default: Console.WriteLine("Defaulted"); break; } } }
protected bool Equals(BaseClass other) { return(_baseValue == other._baseValue); }
public static void Move(BaseClass mm) { mm.Y += (int)mm.Direct.Y * mm.Speed; mm.X += (int)mm.Direct.X * mm.Speed; }
public void GivenINavigateToSite() { homepage = BaseClass.GivenINavigatetoHomePage(); homepage.AndIAmOnClearscore(); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { Call CommonCall = new Call(); IList <string> content = new List <string>(); if (this.Page.IsValid) { this.ModelID = DataConverter.CLng(this.HdnModel.Value); this.NodeID = DataConverter.CLng(this.HdnNode.Value); DataTable dt = this.bfield.GetModelFieldList(this.ModelID).Tables[0]; this.UserInfo = buser.GetLogin(); DataTable table = CommonCall.GetDTFromPage(dt, this.Page, ViewState); M_CommonData CData = new M_CommonData(); M_Node nodeMod = bnode.GetNodeXML(this.NodeID); CData.NodeID = this.NodeID; CData.ModelID = this.ModelID; CData.TableName = this.bmode.GetModelById(this.ModelID).TableName; CData.Title = BaseClass.CheckInjection(this.txtTitle.Text); CData.Inputer = this.UserInfo.UserName; CData.EliteLevel = 0; CData.Status = nodeMod.SiteContentAudit;//读取节点中定义的状态 CData.Template = ""; CData.InfoID = ""; CData.SpecialID = ""; CData.PdfLink = ""; CData.CreateTime = DateTime.Now; CData.FirstNodeID = GetFriestNode(this.NodeID); CData.ParentTree = GetParentTree(this.NodeID); CData.IsBid = (CData.BidType > 0) ? 1 : 0; CData.DefaultSkins = 0; string Keyword = this.TxtTagKey.Text.Trim(); CData.TagKey = Keyword; CData.TopImg = "";//首页图片 //if (allpromoney > this.UserInfo.UserPoint) //{ // function.WriteErrMsg("您的点卡不够发布此内容!请充值后再发布!"); //} //插入数据 int newID = this.bll.AddContent(table, CData); B_KeyWord kll = new B_KeyWord(); if (!string.IsNullOrEmpty(Keyword)) { string[] arrKey = Keyword.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int tt = 0; tt < arrKey.Length; tt++) { if (kll.IsExist(arrKey[tt])) { M_KeyWord kinfo = kll.GetKeyByName(arrKey[tt]); kinfo.QuoteTimes++; kinfo.LastUseTime = DateTime.Now; if (string.IsNullOrEmpty(kinfo.ArrGeneralID)) { kinfo.ArrGeneralID = newID.ToString() + ","; } else { kinfo.ArrGeneralID = kinfo.ArrGeneralID + newID.ToString() + ","; } kll.Update(kinfo); } else { M_KeyWord kinfo1 = new M_KeyWord(); kinfo1.KeyWordID = 0; kinfo1.KeywordText = arrKey[tt]; kinfo1.KeywordType = 1; kinfo1.LastUseTime = DateTime.Now; kinfo1.Hits = 0; kinfo1.Priority = 10; kinfo1.QuoteTimes = 1; kinfo1.ArrGeneralID = "," + newID.ToString() + ","; kll.Add(kinfo1); } } } //if (SiteConfig.UserConfig.InfoRule > 0) //{ // if (buser.AddExp(this.UserInfo.UserID, SiteConfig.UserConfig.InfoRule)) // { // Response.Write(this.UserInfo.UserID); // Response.End(); // M_UserExpHis hist = new M_UserExpHis(); // hist.UserID = this.UserInfo.UserID; // hist.Operator = this.UserInfo.UserID; // hist.detail = this.txtTitle.Text; // hist.score = SiteConfig.UserConfig.InfoRule; // hist.OperatorIP = Request.UserHostAddress; // B_History.AddExpHis(hist); // } //} int nodeid = this.NodeID; M_Node noinfo = bnode.GetNodeXML(nodeid); M_UserInfo uinfos = this.UserInfo; int AddPoint = DataConverter.CLng(noinfo.AddPoint); double AddMoney = DataConverter.CLng(noinfo.AddMoney); //uinfos.UserPoint = uinfos.UserPoint - allpromoney; uinfos.UserPoint = uinfos.UserPoint - AddPoint; uinfos.Purse = uinfos.Purse - AddMoney; buser.UpDateUser(uinfos); Response.Redirect("/User/Info/UserBase.aspx?sel=Tabs1"); //Response.Redirect("MyContent.aspx?NodeID=" + this.NodeID); } }
public void ThenCloseTheBrowser() { BaseClass.CloseBrowser(); }
//<summary> метод в котором мы удаляем определенный дочерний класс </summary> private void RemoveItem(BaseClass obj) { _objs.Remove(obj); }
protected void Page_Load(object sender, EventArgs e) { lblUPDOWNDate.Text = lblUPDOWNDateReturn.Text = ""; try { if (!IsPostBack) { HttpContext.Current.Session["travelOperatorSelected"] = ""; BaseClass baseCls = new BaseClass(); baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]); lblRoute.Text = baseCls.preLoadParams[4].Trim() + "<span style='color:Blue;'> to </span>" + baseCls.preLoadParams[5].Trim() + "<span style='color:Blue;'> on </span>" + baseCls.preLoadParams[2].Trim(); Boolean tempParams = false; //Loop through baseCls.preLoadParams and check if all required values are set foreach (String item in baseCls.preLoadParams) { //If return type is one way ReturnJourneyDate is optional if (baseCls.preLoadParams[6].ToUpper().Equals("ONEWAY")) if (baseCls.preLoadParams[3].Trim() == String.Empty) continue; if (item.Trim() == String.Empty) { tempParams = true; break; } } //If all required parameters are not set, reqirect user to default page. if (tempParams) { Response.Redirect("~/Default.aspx", false); } else { HttpContext.Current.Session["btnType"] = "btnContinue"; #region Load Sources and destinations in dropdowns if (ObjDataset == null) { objBAL = new ClsBAL(); ObjDataset = objBAL.GetCities(); } if (ObjDataset != null) { if (ObjDataset.Tables.Count > 0) { if (ObjDataset.Tables[0].Rows.Count > 0) { ddlSources.DataSource = ObjDataset.Tables[0]; ddlSources.DataTextField = "SourceName"; ddlSources.DataValueField = "ID"; ddlSources.DataBind(); ddlSources.Items.Insert(0, "----------"); //Session["sesDTDestinations"] = ObjDataset.Tables[0]; } } } #endregion DateTime dt = Convert.ToDateTime(baseCls.preLoadParams[2].ToString()); string sss = dt.ToString("dd-MMMM-yyyy"); lblJD.Text = sss; ListItem lt = ddlSources.Items.FindByText(baseCls.preLoadParams[4].ToString()); ddlSources.SelectedValue = lt.Value; DataTable dtDestinations = ObjDataset.Tables[0];//(DataTable)Session["sesDTDestinations"]; StringBuilder sbTravels = new StringBuilder(); if (dtDestinations.Rows.Count > 0) { sbTravels.Append("<select id=\"ddldestinationsDiv\" name=\"ddldestinationsDiv\" class=\"Dropdownlist\" >"); sbTravels.Append("<option value=''>----------</option>"); foreach (DataRow item in dtDestinations.Rows) { if (baseCls.preLoadParams[5].ToString() != item["SourceName"].ToString()) { sbTravels.Append("<option value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>"); } else { sbTravels.Append("<option selected='selected' value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>"); } } sbTravels.Append("</select>"); } destinationsDiv.InnerHtml = sbTravels.ToString(); if (baseCls.preLoadParams[6].ToString() == "OneWay") { lblOnwardJourneyHeader.Visible = false; } else { lblOnwardJourneyHeader.Visible = true; } } } } catch (Exception ex) { if (ex.Message == "Object reference not set to an instance of an object.") { Response.Redirect("~/Default.aspx", false); } } }
public void GivenOpenTheChromeBrowser() { BaseClass.BrowserInitialization(); }
public Gimx(BaseClass baseClass) { _class = baseClass; }
public Decorator(BaseClass b) { this.b = b; }
public void TransformClass() { try { BaseClass bc = new BaseClass(); ChildClass1 cc = new ChildClass1(); bc = cc;//只有子类转化的基类才能重新强制转化为子类,直接转化无法进行 ChildClass1 cc1 = (ChildClass1)bc; } catch(Exception ex) { } }
public override bool MatchCompatible(BaseClass otherClass) => otherClass.IsNumeric;