예제 #1
0
        //获取所有拥有权限的任务类型
        public List<MODEL.T_TaskType> GetAccessRightTaskTypeList()
        {
            List<MODEL.T_TaskType> listTaskType = new List<MODEL.T_TaskType>();

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            if (iBLLSession.IProjectInformationBLL.GetListBy(proj => proj.ProjLeader == stuNum).Count > 0)
            {
                //添加项目任务
                listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10003)[0]);
            }

            List<MODEL.T_RoleAct> listRoleAct = iBLLSession.IRoleActBLL.GetListBy(ra => ra.RoleActor == stuNum);

            foreach(MODEL.T_RoleAct role in listRoleAct)
            {
                if (role.RoleId == 10001)//总裁
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10004)[0]);//学生讲座
                }
                if (role.RoleId == 10002)//部长
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10002)[0]);//开发任务
                }
                if (role.RoleId == 10003)//团长
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10001)[0]);//学习任务
                }
            }

            return listTaskType;
        }
예제 #2
0
 /// <summary>
 /// Returns the content of required uris.
 /// Method has to use the asynchronous way and can be used to compare the performace 
 /// of sync \ async approaches. 
 /// maxConcurrentStreams parameter should control the maximum of concurrent streams 
 /// that are running at the same time (throttling). 
 /// </summary>
 /// <param name="uris">Sequence of required uri</param>
 /// <param name="maxConcurrentStreams">Max count of concurrent request streams</param>
 /// <returns>The sequence of downloaded url content</returns>
 public static IEnumerable<string> GetUrlContentAsync(this IEnumerable<Uri> uris, int maxConcurrentStreams)
 {           
         List<string> result = new List<string>();
         int length = uris.Count();
         Func<Uri, string>[] arrOfDownloads = new Func<Uri, string>[Math.Min(maxConcurrentStreams, length)];
         for (int i = 0; i < arrOfDownloads.Length; i++)
             arrOfDownloads[i] = new WebClient().DownloadString;
         int k;
         IAsyncResult[] results = new IAsyncResult[arrOfDownloads.Length];
         for (int i = 0; i < length; i++)
         {
             if (i < maxConcurrentStreams)
                 results[i] = arrOfDownloads[i].BeginInvoke(uris.ElementAt(i), null, null);
             else
             {
                 k = i%maxConcurrentStreams;
                 if (results[k].IsCompleted)
                 {
                     result.Add(arrOfDownloads[k].EndInvoke(results[k]));
                     results[k] = arrOfDownloads[k].BeginInvoke(uris.ElementAt(i), null, null);
                 }
                 else
                     i--;
             }
         }
         return result;      
 }
예제 #3
0
 public GSM(string modelInput,string manifacturerInput,int priceInput, string ownerInput, 
     Battery battery, Display display,List<Call> callHistory)
     : this(modelInput,manifacturerInput)
 {
     this.Price = priceInput;
     this.Owner = ownerInput;
     this.Battery = battery;
     this.Display = display;
     this.CallHistory = callHistory;
 }
        public static void GSMCallHistoryTestMethod()
        {
            List<Call> newRange = new List<Call>();

            // P12
            GSM phone3 = new GSM(
                "iPhone 4",
                "Apple",
                1200,
                "Doncho",
                new Battery("xxxx", 12, 3, BatteriesEnum.LiIon),
                new Display(12, 222),
                new List<Call>());
                var date1 = new DateTime(2014, 03, 10, 04, 55, 0);
                var date2 = new DateTime(2014, 03, 10, 13, 55, 0);
                var date3 = new DateTime(2014, 03, 10, 18, 55, 0);
            Call newcall1 = new Call(date1, "1234567890", 100);
            Call newcall2 = new Call(date2, "1234567890", 100);
            Call newcall3 = new Call(date3, "1234567890", 100);
            phone3.CallHistory.Add(newcall1);
            phone3.CallHistory.Add(newcall2);
            phone3.CallHistory.Add(newcall3);

            // P12
            phone3.AddCall();
            phone3.RemoveCall(phone3.CallHistory);
            phone3.PrintHistory();
            Console.WriteLine("Enter the price per minute:");
            double multi = double.Parse(Console.ReadLine());
            double totalSum = phone3.Calculate(multi);
            Console.WriteLine("Total sum for conversations:");
            Console.WriteLine(totalSum);
            int indexForRemoving = 0;
            double longestConversation = double.MinValue;
            for (int i = 0; i < phone3.CallHistory.Count; i++)
            {
                if (phone3.CallHistory[i].Duration > longestConversation)
                {
                    indexForRemoving = i;
                }
            }

            Console.WriteLine("Enter record {0} for removing (longest call in the list)", indexForRemoving);
            phone3.RemoveCall(phone3.CallHistory);
            double totalSumRecalc = phone3.Calculate(multi);
            Console.WriteLine("Total sum for conversations after removing the longest call:");
            Console.WriteLine(totalSumRecalc);
            phone3.PrintHistory();
            phone3.ClearAll();
        }
예제 #5
0
        public List<Call> RemoveCall(List<Call> callHistory)
        {
            Console.WriteLine("Number of calls for removing:");
               int number = int.Parse(Console.ReadLine());
               for (int i = 0; i < number; i++)
               {
               int remove = int.Parse(Console.ReadLine());
               this.CallHistory.RemoveAt(remove);
               }

               return this.CallHistory;
        }