Inheritance: IDisposable
Exemplo n.º 1
0
   static public void Main () 
   {
      I i = new MyClass();

      i.MyEvent += new MyDelegate(f);
      i.FireAway();
   }
Exemplo n.º 2
0
    public static void Main()
    {
        Type t = typeof(MyClass);

        //除了这种方法外,你也可以使用
        MyClass instance1 = new MyClass();
        Type t1 = instance1.GetType();

        MethodInfo[] x = t.GetMethods();
        foreach (MethodInfo xtemp in x)
        {
            Console.WriteLine(xtemp.ToString());
        }

        Console.WriteLine();

        MemberInfo[] x2 = t1.GetMembers();
        foreach (MemberInfo xtemp2 in x2)
        {
            Console.WriteLine(xtemp2.ToString());
        }

        Console.WriteLine();

        int radius = 3;
        Console.WriteLine("Area = {0} ", radius*radius*Math.PI);
        Console.WriteLine("The type is {0}", (radius*radius*Math.PI).GetType());

        Console.ReadLine();
    }
Exemplo n.º 3
0
 public void TestClass()
 {
     var o = new MyClass();
     AssertTrue((o is MyClass));
     AssertTrue((o is object));
     AssertTrue((!(o is string)));
 }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Perform any additional setup after loading the view, typically from a nib.
            Device = new MyClass();

            // If you are developing and want to avoid having to enter the full connection string on the device,
            // you can temporarily hard code it here. Comment this when done!
            //Device.DisplayName = "[DisplayName]";
            //Device.ConnectionString = "[ConnectionString]";

            buttonConnect.Enabled = false;
            buttonConnect.TouchUpInside += ButtonConnect_TouchUpInside;

            buttonSend.Enabled = false;
            buttonSend.TouchUpInside += ButtonSend_TouchUpInside;

            textDisplayName.EditingDidEnd += TextDisplayName_EditingDidEnd;
            textDisplayName.Text = Device.DisplayName;

            textConnectionString.EditingDidEnd += TextConnectionString_EditingDidEnd;
            textConnectionString.Text = Device.ConnectionString;

            buttonConnect.Enabled = Device.checkConfig();

            sliderTemperature.MinValue = 0;
            sliderTemperature.MaxValue = 100;
            sliderTemperature.ValueChanged += SliderTemperature_ValueChanged;
            sliderTemperature.Value = 50;

            sliderHumidity.MinValue = 0;
            sliderHumidity.MaxValue = 100;
            sliderHumidity.ValueChanged += SliderHumidity_ValueChanged;
            sliderHumidity.Value = 50;
        }
Exemplo n.º 5
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: The generic type is custom type");

        try
        {
            MyClass myclass1 = new MyClass();
            MyClass myclass2 = new MyClass();
            MyClass myclass3 = new MyClass();
            MyClass[] mc = new MyClass[3] { myclass1, myclass2, myclass3 };
            List<MyClass> listObject = new List<MyClass>(mc);
            if (!listObject.Contains(myclass1))
            {
                TestLibrary.TestFramework.LogError("005", "The result is not the value as expected");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
Exemplo n.º 6
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: The key to be remove is a custom class");

        try
        {
            IDictionary iDictionary = new Dictionary<object,object>();
            MyClass mc = new MyClass();
            int value = TestLibrary.Generator.GetInt32(-55);
            iDictionary.Add(mc, value);
            iDictionary.Remove(mc);
            if (iDictionary.Contains(mc))
            {
                TestLibrary.TestFramework.LogError("003", "The result is not the value as expected ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
Exemplo n.º 7
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: The generic type is int");

        try
        {
            int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 };
            List<int> listObject = new List<int>(iArray);
            MyClass myClass = new MyClass();
            Action<int> action = new Action<int>(myClass.sumcalc);
            listObject.ForEach(action);
            if (myClass.sum != 40)
            {
                TestLibrary.TestFramework.LogError("001", "The result is not the value as expected,sum is: " + myClass.sum);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
Exemplo n.º 8
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: The generic type is type of string");

        try
        {
            string[] strArray = { "Hello", "wor", "l", "d" };
            List<string> listObject = new List<string>(strArray);
            MyClass myClass = new MyClass();
            Action<string> action = new Action<string>(myClass.joinstr);
            listObject.ForEach(action);
            if (myClass.result != "Helloworld")
            {
                TestLibrary.TestFramework.LogError("003", "The result is not the value as expected,sum is: " + myClass.sum);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
 static void Method2(int number, string text, MyClass myClass)
 {
     number += 10;
       text += " changed";
       myClass.Changed = true;
     //true
 }
Exemplo n.º 10
0
    public bool NegTest1()
    {
        bool retVal = true;

        int count;
        bool actualValue;
        bool expectedValue;

        count = 20;
        expectedValue = count >= c_CRITERIA;

        TestLibrary.TestFramework.BeginScenario("NegTest1: call the method Predicate.BeginInvoke asynchronously");
        try
        {
            MyClass myClass = new MyClass(count);
            Predicate<int> selector = myClass.IsGreatEnough;
            IAsyncResult asyncResult = selector.BeginInvoke(c_CRITERIA, null, null);
            actualValue = selector.EndInvoke(asyncResult);
            retVal = false;
            TestLibrary.TestFramework.LogError("003", "NotSupportedException expected");
        }
        catch (NotSupportedException)
        {
            //expected
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
        static void Main(string[] args)
        {
            int i = 1;
              string s = "string";
              MyClass m = new MyClass(false);
              Method1(i, s, m);
              Console.WriteLine("i: {0}\ts: {1,-18}m: {2}", i, s, m.Changed);

              #region same for Method2
              i = 1;
              s = "string";
              m = new MyClass(false);
              Method2(i, s, m);
              Console.WriteLine("i: {0}\ts: {1,-18}m: {2}", i, s, m.Changed);
              #endregion

              #region same for Method1Ref
              i = 1;
              s = "string";
              m = new MyClass(false);
              Method1Ref(ref i, ref s, ref m);
              Console.WriteLine("i: {0}\ts: {1,-18}m: {2}", i, s, m.Changed);
              #endregion

              #region same for Method2Ref
              i = 1;
              s = "string";
              m = new MyClass(false);
              Method2Ref(ref i, ref s, ref m);
              Console.WriteLine("i: {0}\ts: {1,-18}m: {2}", i, s, m.Changed);
              #endregion

              Console.ReadLine();
        }
 static void Method1(int number, string text, MyClass myClass)
 {
     number = 10;
       text = "new string";
       myClass = new MyClass(true);
     //same
 }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            var s=new ConcretePorotype("id");
               var fIdd= ((Test1.ProtoType) s).Idd();//访问父类被隐藏的Idd方法
            var cIdd=s.Idd();//默认访问新类的Idd方法;
            var sClone = s.Clone();
            Console.WriteLine(fIdd);
            Console.WriteLine(cIdd);
            Console.WriteLine(sClone);
            Console.WriteLine("********************************");
            var a=new WorkExperice()
            {
                Name = "testName",
                StarTime = DateTime.Now,
                EndTime = DateTime.Now.AddDays(7)
            };

            var b = a.Clone();
            Console.WriteLine(b);

            var c=new MyClass();
            var d = c.Clone();
            Console.WriteLine(d);
            Console.ReadKey();
        }
Exemplo n.º 14
0
 //Main_3_4_1
 public static void Main()
 {
     MyStruct ms = new MyStruct();
     MyClass mc = new MyClass();
     Console.WriteLine("IL Keywords.");
     Console.Read();
 }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            // C# 6: With "index initializers" values can be set on indexers in the same style as
            // when using "object initializers" and "collection initializers" to initialize objects.
            var myClass = new MyClass
            {
                [2] = "Index2",
                [4] = "Index4",
                [6] = "Index6",
            };

            var valuesNew = new Dictionary<int, string>
            {
                [1] = "Val1",
                [2] = "Val2",
                [3] = "Val3",
            };

            // Previously the syntax to initialize dictionaries was not as elegant.
            var valuesOld = new Dictionary<int, string>
            {
                { 1, "Val1" },
                { 2, "Val2" },
                { 3, "Val3" },
            };

            Console.Read();
        }
Exemplo n.º 16
0
		static void Main(string[] args)
		{
			MyClass mc = new MyClass(); // Create an instance of the class.
			Type t = mc.GetType(); // Get the Type object from the instance.

			// IsDefined
			bool isDefined = // Check the Type for the attribute.
			t.IsDefined(typeof(ReviewCommentAttribute), false);
			if( isDefined )
			{
				Console.WriteLine("ReviewComment is applied to type {0}", t.Name);
			}
			
			// GetCustomAttributes
			object[] AttArr = t.GetCustomAttributes( false );
			foreach ( Attribute a in AttArr )
			{
				ReviewCommentAttribute attr = a as ReviewCommentAttribute;
				if ( null != attr )
				{
					Console.WriteLine( "Description : {0}", attr.Description );
					Console.WriteLine( "Version Number : {0}", attr.VersionNumber );
					Console.WriteLine( "Reviewer ID : {0}", attr.ReviewerID );
				}
			}
		}
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            MyClass myclass = new MyClass("1","2","3","4","5");

            Printer myPrinter = new Printer();
            myPrinter.Print(myclass);
        }
Exemplo n.º 18
0
 public static void Main (string[] args) {
     var ct = new CustomType(1);
     var mc = new MyClass();
     mc.UpdateWithNewState(2, ct);
     ct.Value = 3;
     Console.WriteLine("ct={0}, mc={1}", ct, mc);
 }
Exemplo n.º 19
0
 public static void Main() 
 {
    MyClass mC = new MyClass(); 
    mC.x = 110;
    mC.y = 150;
    Console.WriteLine("x = {0}, y = {1}", mC.x, mC.y); 
 }
Exemplo n.º 20
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            const int N = 200;
            
            double step = Math.PI * 2 / N;

            #region CompositeDataSource
            double[] x = new double[N];
            double[] y = new double[N];
            
            for (int i = 0; i < N; i++)
            {
                x[i] = i *step;
                y[i] = Math.Sin(x[i]);
            }

            var xDataSource = x.AsXDataSource();
            var yDataSource = y.AsYDataSource();

            CompositeDataSource compositeDataSource = xDataSource.Join(yDataSource);

            sin = new LineGraph(compositeDataSource, "sin(x)");

            PlotterMain.Children.Add(sin);
            #endregion

            #region RawDataSource
            Point[] points = new Point[N];

            for (int i = 0; i < N; i++) { 
                points[i] = new Point(i*step, (0.7 * Math.Cos(x[i] * 3) + 3) + (1.5 * Math.Sin(x[i] / 2 + 4)));
            }

            RawDataSource rawDataSource = points.AsDataSource();
            
            cos = new LineGraph(rawDataSource, "(0.7 * Cos(3x)+3)+(1.5*Sin(x/2+4))");
            
            PlotterMain.Children.Add(cos);
            #endregion

            #region EnumerableDataSource and Custom Graph Settings
            
            MyClass[] myObjects = new MyClass[N];
            for (int i = 0; i < N; i++)
                myObjects[i] = new MyClass() { A = 0.1 + i * step };

            EnumerableDataSource<MyClass> enumDataSource = myObjects.AsDataSource<MyClass>();
            enumDataSource.SetXYMapping(o => new Point(o.A,o.B));

            LineGraphSettings settings = new LineGraphSettings();
            settings.LineColor = Colors.Magenta;
            settings.LineThickness = Math.PI;
            settings.Description = "Log10";
            log = new LineGraph(enumDataSource, settings);
            PlotterMain.Children.Add(log);

            #endregion

            PlotterMain.FitToView();
        }
Exemplo n.º 21
0
      /// <summary>
      /// Итак у нас есть событие событие содержит ключевое слово event ТипДелегатаОбрабатывающегоСобытие НазваниеСобытия
      /// ДЕлегат это объект содержащий в себе ссылку на одну единственную функцию. Важный момент, что делегат и функция должны иметь
      /// одинаковую сигнатуру. 
      /// Мы создаем объект делегата, в конструктор передаем делегату функцию, которая соответсвует сигнатуре делегата. Затем мы берем событие
      /// и подписываем на него делегат.
      /// Событие отрабатывает -> зовутся все делегаты которые подписаны на событие -> зовутся все методы-обработчики.
      /// Не рекомендуется поджписывать событие на несколько обработчиков(делегатов) т.к в этом случае точный порядок вызовов обработчиков 
      /// не известен
      /// </summary>
      /// <param name="args"></param>
      static void Main(string[] args) {
         var objMyClass = new MyClass();

         for(int i = 0; i < 1; ++i) {
            objMyClass.CallEvent();
         }
      }
 public static void Main()
 {
     var myInstance = new MyClass();
     var fieldInfo = typeof(MyClass).GetField("answer", BindingFlags.NonPublic | BindingFlags.Instance);
     var answer = fieldInfo.GetValue(myInstance);
     Console.WriteLine(answer);
 }
Exemplo n.º 23
0
    public bool PosTest2()
    {
        bool retVal = true;

        int count;
        bool actualValue;
        bool expectedValue;

        count = 99;
        expectedValue = count >= c_CRITERIA;

        TestLibrary.TestFramework.BeginScenario("PosTest2: call the method Predicate.EndInvoke synchronously");
        try
        {
            MyClass myClass = new MyClass(count);
            Predicate<int> selector = myClass.IsGreatEnough;
            actualValue = selector(c_CRITERIA);
            if (actualValue != expectedValue)
            {
                TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") != ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            MyClass<string> cl = new MyClass<string>();

            cl.Add("Dan");
            cl.Add("Bob");
            cl.Add("Max");
            cl.Add("Nina");
            cl.Add("Marina");
            cl.Add("Nadya");
            cl.Add("Vanya");
            //cl.Add("Vova");
            //cl.Add("Vasya");

            foreach (string temp in cl)
                Console.WriteLine(temp);

            Console.WriteLine(cl.Count);
            Console.WriteLine();

            Console.WriteLine(cl[4]);
            Console.WriteLine();

            cl.Remove("Bob");
            foreach (string temp in cl)
                Console.WriteLine(temp);
            Console.WriteLine(cl.Count);
            Console.ReadLine();
        }
Exemplo n.º 25
0
		public void OrderByWithAttributeShouldStillWork()
		{
			using (var store = NewDocumentStore())
			{
				const int count = 1000;

				using (var session = store.OpenSession())
				{
					for (var i = 0; i < count; i++)
					{
						var model = new MyClass
						{
							ThisWontWork = i,
							ThisWillWork = i
						};
						session.Store(model);
					}
					session.SaveChanges();
				}

				using (var session = store.OpenSession())
				{
					var orderedWithoutAttribute = session.Query<MyClass>().OrderBy(x => x.ThisWillWork).Take(count).ToList();
					var orderedWithAttribute = session.Query<MyClass>().OrderByDescending(x => x.ThisWontWork).Take(count).ToList();

					Assert.Equal(count, orderedWithoutAttribute.Count);
					Assert.Equal(count, orderedWithAttribute.Count);

					for (var i = 1; i <= count; i++)
					{
						Assert.Equal(orderedWithoutAttribute[i - 1].ThisWontWork, orderedWithAttribute[count - i].ThisWontWork);
					}
				}
			}
		}
Exemplo n.º 26
0
        public void test2()
        {
            int a = 2;
            int b = 2;

            int c, d, result;

            MyClass myClass1 = new MyClass();
            MyClass myClass2 = new MyClass();

            while ((a > 1) && (b > 1))
            {
                c = 3;
                d = 1;

                while (d < b)
                {
                    result = AddAll(myClass1, a, b, c, d, myClass2);

                    AssertEquals(8, result);

                    b = 0;
                }
            }
        }
Exemplo n.º 27
0
	static void Main()
	{
		var inst1 = new MyClass();
		inst1.x = 10;
		ChangeMyClass(inst1);
		System.Console.WriteLine(inst1.x);

		var inst2 = new MyStruct();
		inst2.x = 10;
		ChangeMyStruct(ref inst2);
		System.Console.WriteLine(inst2.x);

		var inst3 = inst1;
		inst1.x = 5;
		System.Console.WriteLine(inst3.x);

		var inst4 = inst2;
		inst2.x = 5;
		System.Console.WriteLine(inst4.x);

		var inst5 = new MyClass();
		inst5.x = 5;
		System.Console.WriteLine(System.String.Format("inst3 and inst1 are {0}equal!", (inst3 == inst1) ? "" : "not "));
		System.Console.WriteLine(System.String.Format("inst5 and inst1 are {0}equal!", (inst5 == inst1) ? "" : "not "));

		var s1 = "Hello Trainer!";
		System.String s2 = s1;
		s1 = "Hello Trainees!";
		System.Console.WriteLine(s1);
		System.Console.WriteLine(s2);
		System.Console.WriteLine(System.String.Format("s1 and s2 are {0}equal!", (s1==s2) ? "" : "not "));

		var s3 = System.Console.ReadLine();
		System.Console.WriteLine(System.String.Format("s1 and s3 are {0}equal!", (s1==s3) ? "" : "not "));
	}
Exemplo n.º 28
0
 public static bool InitObj()
 {
     MyClass c = new MyClass();
     return c.x == c.y &&
            c.y == c.z &&
            c.z == 0;
 }
Exemplo n.º 29
0
        public void GetValue()
        {
            var mc = new MyClass
            {
                MyProperty = 100,
                Depth2 = new Depth2
                {
                    MyProperty = 1000,
                    Depth3 = new Depth3
                    {
                        MyProperty = 10000
                    }
                }
            };

            {
                Expression<Func<MyClass, int>> selector = x => x.MyProperty;
                var accessor = ReflectionAccessor.Create(selector.Body as MemberExpression);
                accessor.GetValue(mc).Is(100);
            }

            {
                Expression<Func<MyClass, int>> selector = x => x.Depth2.MyProperty;
                var accessor = ReflectionAccessor.Create(selector.Body as MemberExpression);
                accessor.GetValue(mc).Is(1000);
            }

            {
                Expression<Func<MyClass, int>> selector = x => x.Depth2.Depth3.MyProperty;
                var accessor = ReflectionAccessor.Create(selector.Body as MemberExpression);
                accessor.GetValue(mc).Is(10000);
            }
        }
 public static int MainMethod(string[] args)
 {
     MyClass mc = new MyClass();
     dynamic d = mc.Prop;
     d(3); //We invoke the dynamic delegate
     return Test.s_status ? 0 : 1;
 }
Exemplo n.º 31
0
        public static void StructTest2()
        {
            MyClass c = new MyClass();

            Console.WriteLine(c.ToString());
        }
Exemplo n.º 32
0
    public static void CaptureDelegate()
    {
        MyClass temp = new MyClass();

        MyClass.NonStaticDelegate = new Action(temp.NonStaticMethod);
    }
Exemplo n.º 33
0
 public void DoSomethingWithFunction_works()
 => MyClass.DoSomethingWithFunction("abc", foo).Should().Be(3);
Exemplo n.º 34
0
 static void Main(string[] args)
 {
     MyClass <Derived>  my1 = new MyClass <Derived>();
     MyClass2 <Derived> my2 = new MyClass2 <Derived>();
     MyClass3 <Derived> my3 = new MyClass3 <Derived>();
 }
 public MyClassWrapper(MyClass wrapped)
 {
     this.wrapped = wrapped;
 }
 internal MyPropertyAccessor(MyClass m)
 {
     myclass = m;
 }
Exemplo n.º 37
0
 static benchmark_reflection_vs_cachedreflection_using_appdomaincachemanager()
 {
     myClass         = new MyClass();
     myClass.Alpha12 = 1234;
 }
Exemplo n.º 38
0
 private static void MyMethod(MyClass i)
 {
     i.MyInt++;
 }
Exemplo n.º 39
0
 static void Main()
 {
     MyClass mc = new MyClass(); // error CS0122: 'MyClass.MyClass()' is inaccessible due to its protection level
 }
 public Form1()
 {
     InitializeComponent();
     MyClassObject = new MyClass(this);
     MyClassObject.test("hello");
 }
Exemplo n.º 41
0
        static void Main(string[] args)
        {
            MyClass test = new MyClass("Happy!");

            test.PrintMessage();
        }
 public AnotherClass(ApplicationDbContext context, MyClass myClass)
 {
     _context = context;
     _myClass = myClass;
 }
Exemplo n.º 43
0
 public MyClassInvoker(MyClass myclass)
 {
     _myTimer = new Timer();
     _myclass = myclass;
 }
Exemplo n.º 44
0
 // Make a copy of ob.
 public void Copy(MyClass ob)
 {
     alpha = ob.alpha;
     beta  = ob.beta;
 }
    public static MyClass operator --(MyClass a)
    {
        MyClass t = new MyClass((char)((int)a.symb - 1));

        return(t);
    }
Exemplo n.º 46
0
 static MyClass()
 {
     Instance = new MyClass();
 }
Exemplo n.º 47
0
        public JsonResult GetAssetSubCodeEdit(DateTime transdate, string CatMultivalue, string CatRangevalue1, string CatRangevalue2, string AssetMultivalue, string AssetRangevalue1, string AssetRangevalue2)
        {
            var catlist   = CatMultivalue == null ? null : CatMultivalue.Split(",");
            var assetlist = AssetMultivalue == null ? null : AssetMultivalue.Split(",");
            Func <Fixed_Asset_Register, bool> none = a => a.CreatedBy != "test";
            //Func<FixedAssetMDepreciation, bool> enddate = none;
            Func <Fixed_Asset_Register, bool> CatCheckmultivalue   = none;
            Func <Fixed_Asset_Register, bool> AssetCheckmultivalue = none;
            Func <Fixed_Asset_Register, bool> CatRangeval1         = none;
            Func <Fixed_Asset_Register, bool> AssetRangeval1       = none;

            if ((CatMultivalue != null && CatMultivalue != "") && CatMultivalue != "undefined")
            {
                CatCheckmultivalue = new Func <Fixed_Asset_Register, bool>(a => catlist.Contains(a.Id.ToString()));
            }
            if ((AssetMultivalue != null && AssetMultivalue != "") && AssetMultivalue != "undefined")
            {
                AssetCheckmultivalue = new Func <Fixed_Asset_Register, bool>(a => assetlist.Contains(a.Id.ToString()));
            }
            if ((CatRangevalue1 != null && CatRangevalue1 != "") && CatRangevalue1 != "undefined")
            {
                CatRangeval1 = new Func <Fixed_Asset_Register, bool>(y => y.Id >= Convert.ToInt32(CatRangevalue1) && y.Id <= Convert.ToInt32(CatRangevalue2));
            }
            if ((AssetRangevalue1 != null && AssetRangevalue1 != "") && AssetRangevalue1 != "undefined")
            {
                AssetRangeval1 = new Func <Fixed_Asset_Register, bool>(y => y.Id >= Convert.ToInt32(AssetRangevalue1) && y.Id <= Convert.ToInt32(AssetRangevalue2));
            }


            var res = _context.FixedAssetRegisters.Where(CatCheckmultivalue).Where(AssetCheckmultivalue).Where(CatRangeval1).Where(AssetRangeval1).Select(x => x.Id).ToList();


            StringBuilder html = new StringBuilder();

            var           id              = 0;
            List <string> fcuk            = new List <string>();
            List <string> psname1         = new List <string>();
            List <string> plname1         = new List <string>();
            int           days            = DateTime.DaysInMonth(transdate.Year, transdate.Month);
            DateTime      firstDayOfMonth = new DateTime(transdate.Year, transdate.Month, 1);

            System.TimeSpan diff  = transdate.Subtract(firstDayOfMonth);
            System.TimeSpan diff1 = transdate - firstDayOfMonth;
            string          diff2 = (transdate - firstDayOfMonth).TotalDays.ToString();
            int             num   = int.Parse(diff2);


            List <MyClass> data = new List <MyClass>();


            List <AllModuleFormSub> dat = new List <AllModuleFormSub>();

            foreach (var item in res)
            {
                dat.AddRange(_context.AllModuleFormSub.Where(y => y.Fixed_Asset_RegisterId == item).ToList());
            }

            //MyClass ch = new MyClass();
            foreach (var item in dat)
            {
                var gh = _context.FixedAssetMDepreciation.Where(t => t.Id == item.Fixed_Asset_RegisterId).Select(x => x.DepreciationAmount).FirstOrDefault();
                var h  = _context.FixedAssetWriteOffSubForm.Where(t => t.Id == item.Fixed_Asset_RegisterId).Select(x => x.Remark).FirstOrDefault();
                //var h = _context.ChartOfAccounts.Where(x => x.Id == _context.FixedAssetRegisters.Where(t => t.Id == item.Fixed_Asset_RegisterId).Select(x => x.PL_DepreciationAccount).FirstOrDefault()).Select(x => x.Name + "-" + x.Code).FirstOrDefault();
                MyClass ch = new MyClass()
                {
                    AssetSubCode            = item.asssubcode,
                    SerialNumber            = item.serialno,
                    Remark                  = h,
                    UnitAmount              = Convert.ToDecimal(item.unitprc),
                    AccumulatedDepreciation = (gh / days) * num,
                    //NetBookValue = UnitAmount - AccumulatedDepreciation;
                };
                ch.NetBookValue = ch.UnitAmount - ch.AccumulatedDepreciation;
                data.Add(ch);
            }

            var ch1 = data;

            foreach (var(item, i) in data.Select((v, i) => (v, i)))
            {
                html.Append($"<div class=\"link{i}\"><span>1</span><i class=\"fa fa-chevron-down\">#{i}</i></div>");
                html.Append($"<ul id=\"link{i}\" class=\"submenu\">");

                #region TD1

                {
                    html.Append($"<div class=\"row\">");
                    html.Append($"<div class=\"col-sm-4\">");
                    html.Append($"<div class=\"form-group\">");
                    html.Append($"<label class=\"col-sm-4 control-label col-form-label\">Asset SubCode)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                    html.Append($"<input name=\"AssetSubCode{i}\" id=\"AssetSubCode{i}\" asp-for=\"{item.AssetSubCode}\" autocomplete=\"off\" class=\"form-control\" readonly />");
                    html.Append("<span asp-validation-for=\"AssetSubCode\" class=\"text-danger\"></span></div></div>");
                }

                #endregion

                #region TD2

                html.Append($"<div class=\"col-sm-4\">");
                html.Append($"<div class=\"form-group\">");
                html.Append($"<label class=\"col-sm-4 control-label col-form-label\">Serial Number)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                html.Append($"<input name=\"SerialNUmber{i}\" id=\"SerialNumber{i}\" asp-for=\"{item.SerialNumber}\" autocomplete=\"off\" class=\"form-control\" readonly />");
                html.Append("<span asp-validation-for=\"Serial Number\" class=\"text-danger\"></span></div></div>");
                #endregion

                html.Append($"<div class=\"col-sm-4\">");
                html.Append($"<div class=\"form-group\">");
                html.Append($"<label class=\"col-sm-4 control-label col-form-label\">Remark)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                html.Append($"<input name=\"Remark{i}\" id=\"Remark{i}\" asp-for=\"{item.Remark}\" autocomplete=\"off\" class=\"form-control\" />");
                html.Append("<span asp-validation-for=\"Remark\" class=\"text-danger\"></span></div></div></div>");

                html.Append($"<div class=\"row\">");
                html.Append($"<div class=\"col-sm-3\">");
                html.Append($"<div class=\"form-group\">");
                html.Append($"<label class=\"col-sm-12 control-label col-form-label\">Unit Amount)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                html.Append($"<div class=\"col-sm-12\">");
                html.Append($"<input name=\"UnitAmount{i}\" id=\"UnitAmount{i}\" asp-for=\"{item.UnitAmount}\" autocomplete=\"off\" class=\"form-control\" readonly />");
                html.Append("<span asp-validation-for=\"UnitAmount\" class=\"text-danger\"></span></div></div></div>");

                html.Append($"<div class=\"col-sm-3\">");
                html.Append($"<div class=\"form-group\">");
                html.Append($"<label class=\"col-sm-12 control-label col-form-label\">Accumulated Depreciation)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                html.Append($"<div class=\"col-sm-12\">");
                html.Append($"<inputname=\"AccumulatedDepreciation{i}\" id=\"AccumulatedDepreciation{i}\" asp-for=\"{item.AccumulatedDepreciation}\" autocomplete=\"off\" class=\"form-control\" readonly />");
                html.Append("<span asp-validation-for=\"AccumulatedDepreciation\" class=\"text-danger\"></span></div></div></div>");

                html.Append($"<div class=\"col-sm-3\">");
                html.Append($"<div class=\"form-group\">");
                html.Append($"<label class=\"col-sm-12 control-label col-form-label\">Net Book Value)<span class=\"value-mandatory\"><i class=\"mdi mdi-value\"></i></span></label>");
                html.Append($"<div class=\"col-sm-12\">");
                html.Append($"<input name=\"NetBookValue{i}\" id=\"NetBookValue{i}\" asp-for=\"{item.NetBookValue}\" autocomplete=\"off\" class=\"form-control\" readonly />");
                html.Append("<span asp-validation-for=\"NetBookValue\" class=\"text-danger\"></span></div></div></div></div>");

                html.Append($"<div class=\"form-check row\">");
                html.Append($"<input class=\"form-check-input\" type=\"checkbox\" value=\"\" id=\"check{i}\">");
                html.Append($"<label class=\"form- check-label\" for=\"check{i}\">Checked for delete selected</label>");
                html.Append($"<button class=\"btn btn-danger btn-sm rounded-0\" type=\"button\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Delete Selected\"><i class=\"fa fa - trash\"></i></button></div>");

                html.Append("</ul>");
            }
            return(Json(new { data = html.ToString(), rowcount = data.Count() }));
        }
Exemplo n.º 48
0
 static void Main(string[] args)
 {
     MyClass my = new MyClass();
 }
Exemplo n.º 49
0
    static void PerformBuild()
    {
        //clear out any existing timeline objects
        if (GameObject.Find("TIMELINE") != null)
        {
            DestroyImmediate(GameObject.Find("TIMELINE"));
        }
        //create new timeline
        GameObject       timeline      = new GameObject("TIMELINE");
        PlayableDirector director      = timeline.AddComponent <PlayableDirector>();
        TimelineAsset    timelineAsset = ScriptableObject.CreateInstance <TimelineAsset>();

        timelineAsset.editorSettings.fps = 25;
        director.playableAsset           = timelineAsset;


        //load json into class
        string          jsonText          = File.ReadAllText(Application.dataPath + "/Resources/json/" + GetArg("-shotName") + ".json");
        PlayerStatsList myPlayerStatsList = new PlayerStatsList();

        JsonUtility.FromJsonOverwrite(jsonText, myPlayerStatsList);

        //add abc cache to scene
        foreach (PlayerStats e in myPlayerStatsList.extras)
        {
            BuildScene.MyClass abcObject = new BuildScene.MyClass();
            abcObject.characterPath = e.abc;
            Extras.addExtras(abcObject, director, timelineAsset);
        }

        //add camera to scene
        foreach (PlayerStats c in myPlayerStatsList.cameras)
        {
            //place asset in scene
            MyClass myObject = new MyClass();
            myObject.cameraPath = c.model;
            GameObject tempobj = (GameObject)Instantiate(Resources.Load(myObject.cameraPath), new Vector3(0, 0, 0), Quaternion.identity);
            tempobj.name = c.name;

            //create animation track on TIMELINE
            AnimationTrack newTrack = timelineAsset.CreateTrack <AnimationTrack>(null, "Animation Track " + tempobj.name);
            director.SetGenericBinding(newTrack, tempobj);
            myObject.animPath = c.anim;
            AnimationClip animClip = Resources.Load <AnimationClip>(myObject.animPath);

            TimelineClip timelineClip = newTrack.CreateClip(animClip);
            //Turn remove start offset off to fix camera position
            var animPlayableAsset = (AnimationPlayableAsset)timelineClip.asset;
            animPlayableAsset.removeStartOffset = false;

            //make rim light
            myObject.rimPath = c.rimProfile;
            RimLight.createRimLight(tempobj, myObject.rimPath);

            //add post processing
            PostProcessing.addPostProcessing(tempobj, c.profile);
        }

        //loop through objects in class
        foreach (PlayerStats p in myPlayerStatsList.characters)
        {
            //place asset in scene
            MyClass myObject = new MyClass();
            myObject.characterPath = p.model;
            GameObject tempobj = (GameObject)Instantiate(Resources.Load(myObject.characterPath), new Vector3(0, 0, 0), Quaternion.identity);
            tempobj.name = p.name;
            //set objects to "Characters" layer
            foreach (Transform trans in tempobj.GetComponentsInChildren <Transform>(true))
            {
                trans.gameObject.layer = LayerMask.NameToLayer("Characters");
            }

            //create animation track on TIMELINE
            AnimationTrack newTrack = timelineAsset.CreateTrack <AnimationTrack>(null, "Animation Track " + tempobj.name);
            director.SetGenericBinding(newTrack, tempobj);
            myObject.animPath = p.anim;
            AnimationClip animClip = Resources.Load <AnimationClip>(myObject.animPath);

            TimelineClip timelineClip = newTrack.CreateClip(animClip);

            //Turn remove start offset off to fix camera position
            var animPlayableAsset = (AnimationPlayableAsset)timelineClip.asset;
            animPlayableAsset.removeStartOffset = false;
        }
        //add sets to scene
        foreach (PlayerStats s in myPlayerStatsList.sets)
        {
            //place asset in scene
            MyClass myObject = new MyClass();
            myObject.setPath = s.model;
            GameObject tempobj = (GameObject)Instantiate(Resources.Load(myObject.setPath), new Vector3(0, 0, 0), Quaternion.identity);
            tempobj.name = s.name;
        }
        //add post processing to camera

        /*
         * GameObject cam = GameObject.Find("CAM");
         * if (cam != null)
         * {
         *  cam.AddComponent<PostProcessLayer>();
         *  ppv = cam.AddComponent<PostProcessVolume>();
         *  ppp = Resources.Load<PostProcessProfile>("Profiles/MainCameraProfile1");
         *  ppv.profile = ppp;
         * }
         * else
         * {
         *  Debug.LogWarning("No Camera found. The camera must be named - CAM");
         * }
         */
        //save scene
        EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene(), GetArg("-scenePath"));
    }
Exemplo n.º 50
0
    public MyClass AddItem(MyClass item)
    {
        // Add the object

        return(this);
    }
Exemplo n.º 51
0
    public static void Main()
    {
        MyClass obj = new MyClass();

        obj.Method();
    }
Exemplo n.º 52
0
 public void ExecuteAssembly(MyClass param1)
Exemplo n.º 53
0
 public static void MyMethod2(MyClass myClass)
 {
     myClass.Name += " - Method2";
 }
Exemplo n.º 54
0
    static void Main()
    {
        MyClass mc = new MyClass();          // Create instance.

        mc.PrintOut("object");               // Call method.
    }
Exemplo n.º 55
0
 public void Method([FromRequestBody] MyClass parameter)
 {
 }
Exemplo n.º 56
0
 public static void MyMethod(MyClass myClass, MyClass myClass2)
 {
     myClass.Name += " - Method";
     MyMethod2(myClass);
     myClass2.Name += " - Method";
 }
Exemplo n.º 57
0
 static void Main(string[] args)
 {
     MN.MyClass myClass = new MyClass("Joined", 5);
     myClass.info();
     Console.ReadKey();
 }
Exemplo n.º 58
0
 public void RemoveChild(MyClass child)
 {
     _children.Remove(child);
     child.Parent = null;
 }
Exemplo n.º 59
0
 public void AddChild(MyClass child)
 {
     child.Parent = this;
     _children.Add(child);
 }
Exemplo n.º 60
0
    static void Main()                       // Declare the method.
    {
        MyClass mc = new MyClass();

        mc.PrintDateAndTime();               // Invoke the method.
    }