コード例 #1
0
        public List <Student> LoadAllStudentsInDepartment(DepartmentsEnum departmentsEnum)
        {
            Task <List <Student> > task = new Task <List <Student> >(() =>
            {
                string result  = "";
                string request = "student/getStudentiByFakulta?" +
                                 "stav=S&" +
                                 "fakulta=" + Enum.GetName(typeof(DepartmentsEnum), departmentsEnum) +
                                 "&outputFormat=json&" +
                                 "rok=2017";
                result = Client.SendRequest(request);
                if (result != "" && result != "[null]")
                {
                    string modResult = result.Substring(1, result.Length - 2);
                    var students     = JsonConvert.DeserializeObject <StudentsJson>(modResult);
                    if (students.Students.Count > 0)
                    {
                        AddIntoCollectionIfNotLoaded(students.Students);
                        return(students.Students);
                    }
                }
                throw new ServiceException("No students found in specified Department!: [" + Enum.GetName(typeof(DepartmentsEnum), departmentsEnum) + "]");
            });

            AddWork(task);
            return(ResultHandler(task));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // Value Type
            int i = 5;
            int x = i; // x = 5

            i = 7;     // x = 5

            object o1 = 5;
            Object o2 = o1; // o = 5

            o1 = 7;         // o2 = 5
            Console.WriteLine("o2 : " + o2);

            // Reference Type
            Person p1 = new Person
            {
                Name = "Mohamed"
            };
            Person p2 = p1;

            p1.Name = "Ahmed";
            Console.WriteLine("p2.Name : " + p2.Name); // Ahmed

            // 'enum' type uses Value Type
            DepartmentsEnum departmentsEnum1 = DepartmentsEnum.GI;
            DepartmentsEnum departmentsEnum2 = departmentsEnum1;

            departmentsEnum1 = DepartmentsEnum.GM;
            Console.WriteLine("departmentsEnum2 : " + departmentsEnum2); // DepartmentsEnum.GI

            Console.ReadLine();
        }
コード例 #3
0
 public SalesEmployee(string fName, string lName, int id, double salary, DepartmentsEnum department, IList <ISales> salesSet)
     : base(fName, lName, id, salary, department)
 {
     this.SalesSet = salesSet;
 }
コード例 #4
0
 public Employee(string fName, string lName, int id, double salary, DepartmentsEnum department)
     : base(fName, lName, id)
 {
     this.Salary     = salary;
     this.Department = department;
 }
コード例 #5
0
 public RegularEmployee(string fName, string lName, int id, double salary, DepartmentsEnum department)
     : base(fName, lName, id, salary, department)
 {
 }
コード例 #6
0
 public Developer(string firstName, string lastName, int id, double salary, DepartmentsEnum department, IList <IProject> projects)
     : base(firstName, lastName, id, salary, department)
 {
     this.Projects = projects;
 }
コード例 #7
0
 public Manager(string fName, string lName, int id, double salary, DepartmentsEnum department, IList <IEmployee> setOfEmployees)
     : base(fName, lName, id, salary, department)
 {
     this.SetOfEmployees = setOfEmployees;
 }