Ejemplo n.º 1
0
        public void BindData()
        {
            LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中...");

            try
            {
                var schoolId = CurrUserInfo.SchoolId;
                var year     = searchQuarter.Year;
                var quarter  = searchQuarter.Quarter;
                var district = searchDistrict;
                var course   = searchCourse;
                var grade    = "";
                if (searchGradeList.Any())
                {
                    grade = string.Join(",", searchGradeList.ToArray());
                }

                var areaCodes = ""; //店长登录用
                if (CurrUserInfo.Type == (int)UserType.ShopManager)
                {
                    areaCodes = CurrUserInfo.AreaCodes;
                }

                new System.Threading.Thread(new ThreadStart(() =>
                {
                    var list = SumService.GetSumPaymentListByArea(schoolId, year, quarter, dataType, sortType, district, grade, course, out totalCount, 1, 1, 500, areaCodes);
                    CurrActivity.RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        if (list != null)
                        {
                            var totalData      = list.TotalData;
                            this.avgGrowthRate = totalData.GrowthRate;
                            this.sumList       = list.List;
                            var totalEntity    = new PaymentSumAreaEntity()
                            {
                                Name = "总计", CurrentSum = totalData.CurrentSum, LastYearSum = totalData.LastYearSum, GrowthRate = totalData.GrowthRate
                            };
                            this.sumList.Add(totalEntity);

                            var gradeListParam = "";
                            if (searchGradeList.Count != gradeList.Count)
                            {
                                gradeListParam = string.Join(",", searchGradeList.ToArray());
                            }
                            mAdapter.SetData(this.sumList, this.avgGrowthRate, this.searchQuarter, this.dataType, this.searchCourse);
                            mAdapter.NotifyDataSetChanged();
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Server server = null;

            try
            {
                server = new Server()
                {
                    Services = { GreetingService.BindService(new GreetingServiceImpl()),
                                 SumService.BindService(new SumServiceImpl()),
                                 PrimeNumberService.BindService(new PrimeNumberServiceImpl()),
                                 ComputeAverageService.BindService(new ComputeAverageServiceImpl()),
                                 FindMaximumService.BindService(new FindMaximumServiceImpl()) },
                    Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
                };
                server.Start();
                Console.WriteLine("The server is listening on the port: " + Port);
                Console.ReadKey();
            }
            catch (IOException e)
            {
                Console.WriteLine("The server failed to start: " + e.Message);
                throw;
            }
            finally
            {
                if (server != null)
                {
                    server.ShutdownAsync().Wait();
                }
            }
        }
Ejemplo n.º 3
0
        public virtual async Task <ComposedValue> GetComposedValue(
            string parameter, Session session, CancellationToken cancellationToken)
        {
            var chatTail = await ChatService.GetChatTail(1, cancellationToken);

            var uptime = await TimeService.GetUptime(10, cancellationToken);

            var sum = (double?)null;

            if (double.TryParse(parameter, out var value))
            {
                sum = await SumService.GetSum(new [] { value }, true, cancellationToken);
            }
            var lastChatMessage = chatTail.Messages.SingleOrDefault()?.Text ?? "(no messages)";
            var user            = await AuthService.GetUser(session, cancellationToken);

            var activeUserCount = await ChatService.GetActiveUserCount(cancellationToken);

            return(new ComposedValue()
            {
                Parameter = $"{parameter} - local",
                Uptime = uptime,
                Sum = sum,
                LastChatMessage = lastChatMessage,
                User = user,
                ActiveUserCount = activeUserCount
            });
        }
Ejemplo n.º 4
0
        public override void OnCreate()
        {
            ISumService sumService = new SumService();

            IScreenVM sumScreenVm(IScreenContainerVM parent) => new SumScreenVM(InitDisposeManager, parent, sumService);

            MainWindowVM = new MainWindowVM(InitDisposeManager, "QuickTools Demo", sumScreenVm);
        }
Ejemplo n.º 5
0
        public void Sum_One_And_Two_Not_Equal_Five()
        {
            var sumService = new SumService();

            var result = sumService.Sum(1, 2);

            Assert.AreEqual(3, result);
        }
Ejemplo n.º 6
0
        public JsonResult GetSumPer(string nickTime, int curPage, int id)
        {
            long recordCount          = 0;
            int  pageSize             = Convert.ToInt32(ConfigHelp.GetConfigValue("pageSize"));
            List <SumBaseDto> sumList = SumService.GetSumPer(nickTime, curPage, pageSize, id, out recordCount);
            string            jsonStr = JsonConvert.SerializeObject(new { recordCount = recordCount, pageSize = pageSize, lists = sumList });

            return(Json(jsonStr));
        }
Ejemplo n.º 7
0
    public void TestSingleTable()
    {
        var sums = SumService.FullTable(10);

        Assert.Equal(10, sums.Count);

        Assert.Equal(55, sums.Sum(s => s.A));
        Assert.Equal(100, sums.Sum(s => s.B));
    }
Ejemplo n.º 8
0
        public void Solve(object a)
        {
            var strArray = a.ToString().Split(' ');

            int[] arr = strArray.Select <string, int>(int.Parse).ToArray();


            Console.WriteLine($"{SumService.MinSum(arr)} {SumService.MaxSum(arr)}");
        }
Ejemplo n.º 9
0
        public void Sum_One_And_One()
        {
            var sumService = new SumService();
            // act (акт)
            var result = sumService.Sum(1, 1);

            // assert (утверждение)
            Assert.AreEqual(2, result);
        }
        public static void Run([QueueTrigger("sum-items", Connection = "AzureWebJobsStorage")] string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");

            var item    = JsonConvert.DeserializeObject <SumItem>(myQueueItem);
            var service = new SumService();
            var output  = service.Sum(item);

            log.LogInformation("The sum is {0}", output);
        }
Ejemplo n.º 11
0
        public void BindData()
        {
            try
            {
                if (!NetUtil.CheckNetWork(CurrActivity))
                {
                    ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                    return;
                }
                LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中...");

                var schoolId = CurrUserInfo.SchoolId;
                var grade    = "";
                if (searchGradeList.Any())
                {
                    grade = string.Join(",", searchGradeList.ToArray());
                }

                //加校区查询权限判断--店长登录
                var areaCodes = "";
                if (CurrUserInfo.Type == (int)UserType.ShopManager)
                {
                    areaCodes = CurrUserInfo.AreaCodes;
                }

                new Thread(new ThreadStart(() =>
                {
                    var list = SumService.GetSumPaymentListByTeacher(schoolId, year, quarter, dataType, sortType, areaCode, grade, searchCourse);
                    CurrActivity.RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        if (list != null)
                        {
                            sumTeacherList = list.List;
                            //添加合计行
                            sumTeacherList.Add(list.TotalData);

                            mAdapter.SetData(sumTeacherList);
                            mAdapter.NotifyDataSetChanged();
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                //var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
            }
        }
Ejemplo n.º 12
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            var    item        = JsonConvert.DeserializeObject <SumItem>(requestBody);
            var    service     = new SumService();
            var    output      = service.Sum(item);

            log.LogInformation("The sum is {0}", output);

            return(new OkObjectResult(output));
        }
Ejemplo n.º 13
0
        public ActionResult EvalSum(int Id, bool flag)
        {
            if (flag == true)
            {
                ViewBag.Msgs = "提交成功!";
            }
            ViewBag.ID = Id;
            string oldEval = SumService.GetOne(Id);
            string eval    = SumService.HtmlEntitiesEncode(oldEval);

            eval            = HttpUtility.HtmlDecode(eval);
            ViewBag.oldEval = eval.Replace("\r\n", "<br/>");
            return(View());
        }
Ejemplo n.º 14
0
        public ActionResult Person(SumBaseDto summary)
        {
            bool isSuccess = SumService.InsertSum(summary);

            if (isSuccess == true)
            {
                ViewBag.msg = "添加成功!";
            }
            else
            {
                ViewBag.msg = "添加失败!";
            }
            return(RedirectPermanent("/Summary/AddSum?id=" + Convert.ToInt32(LoginBase.ID) + "&flag=true"));
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Server server = null;

            try
            {
                var serverCert = File.ReadAllText("ssl/server.crt");
                var serverKey  = File.ReadAllText("ssl/server.key");
                var keypair    = new KeyCertificatePair(serverCert, serverKey);
                var caCrt      = File.ReadAllText("ssl/ca.crt");

                var credentials = new SslServerCredentials(new List <KeyCertificatePair>()
                {
                    keypair
                }, caCrt, true);

                server = new Server()
                {
                    Services =
                    {
                        GreetingService.BindService(new GreetingServiceImpl()),
                        SumService.BindService(new SumServiceImpl()),
                        PrimeNumbersService.BindService(new PrimeNumbersServiceImpl()),
                        AverageService.BindService(new AverageServiceImpl()),
                        MaxService.BindService(new MaxServiceImpl()),
                        SqrtService.BindService(new SquareRootServiceImpl()),
                        ServerReflection.BindService(new ReflectionServiceImpl(GreetingService.Descriptor, ServerReflection.Descriptor))
                    },

                    Ports = { new ServerPort("localhost", port, credentials) }
                };

                server.Start();
                Console.WriteLine($"Server is listening on port: {port}");
                Console.ReadKey();
            }
            catch (IOException e)
            {
                Console.WriteLine($"Server failed to start - {e.Message}");
                throw;
            }
            finally
            {
                if (server != null)
                {
                    server.ShutdownAsync().Wait();
                }
            }
        }
Ejemplo n.º 16
0
        public ActionResult Index(SumBaseDto summary)
        {
            bool isSuccess = SumService.Update(summary);

            if (isSuccess == true)
            {
                ViewBag.Msgs = "提交成功!";
            }
            else
            {
                ViewBag.Msgs = "提交失败!";
            }

            //return View("EvalSubmit");
            return(RedirectPermanent("/Summary/EvalSum?Id=" + summary.TID + "&flag=true"));
        }
Ejemplo n.º 17
0
        public virtual async Task <ComposedValue> GetComposedValueAsync(
            string parameter, Session session, CancellationToken cancellationToken)
        {
            var chatTail = await ChatService.GetChatTailAsync(1, cancellationToken).ConfigureAwait(false);

            var uptime = await TimeService.GetUptimeAsync(TimeSpan.FromSeconds(10), cancellationToken).ConfigureAwait(false);

            var sum = (double?)null;

            if (double.TryParse(parameter, out var value))
            {
                sum = await SumService.SumAsync(new [] { value }, true, cancellationToken).ConfigureAwait(false);
            }
            var lastChatMessage = chatTail.Messages.SingleOrDefault()?.Text ?? "(no messages)";
            var user            = await AuthService.GetUserAsync(session, cancellationToken).ConfigureAwait(false);

            var activeUserCount = await ChatService.GetActiveUserCountAsync(cancellationToken).ConfigureAwait(false);

            return(new ComposedValue($"{parameter} - server", uptime, sum, lastChatMessage, user, activeUserCount));
        }
Ejemplo n.º 18
0
 static void Main(string[] args)
 {
     Grpc.Core.Server server = null;
     try
     {
         server = new Grpc.Core.Server()
         {
             Services = { SumService.BindService(new SumServiceImpl()) },
             Ports    = { new Grpc.Core.ServerPort("localhost", _port, ServerCredentials.Insecure) }
         };
         server.Start();
         Console.WriteLine(($"The Server is listening on port : {_port}"));
         Console.ReadKey();
     }
     catch (IOException e)
     {
         Console.WriteLine($"Server Connection Error: {e.Message}");
     }
     finally {
         server?.ShutdownAsync().Wait();
     }
 }
Ejemplo n.º 19
0
 static int birthday(List <int> s, int d, int m)
 {
     return(SumService.CountSumWithLength(s.ToArray(), d, m));
 }
 static int divisibleSumPairs(int n, int k, int[] ar)
 {
     return(SumService.NumberOfSumPairs(k, ar));
 }
 public void ShouldReturn5()
 {
     Assert.Equal(5, SumService.Sum(2, 3));
 }
Ejemplo n.º 22
0
 public SumServiceTest()
 {
     _service = new SumService();
 }
Ejemplo n.º 23
0
        //导出到excell
        /// <summary>
        ///
        /// </summary>
        /// <param name="nickName"></param>
        /// <param name="nickTime"></param>
        public FileResult Export(string nickName, string nickTime)
        {
            //try
            //{
            List <SumBaseDto>          SumSheet = SumService.GetAll(nickName, nickTime);
            HSSFWorkbook               book     = new HSSFWorkbook();
            DocumentSummaryInformation dsi      = PropertySetFactory.CreateDocumentSummaryInformation();

            dsi.Company = "NPOI Team";
            SummaryInformation si = PropertySetFactory.CreateSummaryInformation();

            si.Subject = "NPTO SDK Example";
            si.Title   = "学习或工作总结表";
            book.DocumentSummaryInformation = dsi;
            book.SummaryInformation         = si;
            ISheet sheet = book.CreateSheet("sheet1");

            IRow row0 = sheet.CreateRow(0);

            row0.CreateCell(0).SetCellValue("用户ID");
            row0.CreateCell(1).SetCellValue("姓名");
            row0.CreateCell(2).SetCellValue("学习/工作内容");
            row0.CreateCell(3).SetCellValue("学习/工作情况简介");
            row0.CreateCell(4).SetCellValue("遇到的问题");
            row0.CreateCell(5).SetCellValue("是否解决");
            row0.CreateCell(6).SetCellValue("教师回复");
            row0.CreateCell(7).SetCellValue("总结时间");

            for (int i = 0; i < SumSheet.Count; i++)
            {
                IRow rowtemp = sheet.CreateRow(i + 1);
                rowtemp.CreateCell(0).SetCellValue(SumSheet[i].User_ID);
                rowtemp.CreateCell(1).SetCellValue(SumSheet[i].Real_Name);
                rowtemp.CreateCell(2).SetCellValue(SumSheet[i].Title);
                rowtemp.CreateCell(3).SetCellValue(SumSheet[i].Progress);

                if (SumSheet[i].Problem == null)
                {
                    rowtemp.CreateCell(4).SetCellValue("无");
                    rowtemp.CreateCell(5).SetCellValue("");
                }
                else
                {
                    rowtemp.CreateCell(4).SetCellValue(SumSheet[i].Problem);
                    if (SumSheet[i].IS_Solve == 0)
                    {
                        rowtemp.CreateCell(5).SetCellValue("已解决");
                    }
                    if (SumSheet[i].IS_Solve == 1)
                    {
                        rowtemp.CreateCell(5).SetCellValue("尚未解决");
                    }
                }
                rowtemp.CreateCell(6).SetCellValue(SumSheet[i].Teacher_evaluation);
                rowtemp.CreateCell(7).SetCellValue(SumSheet[i].Time.ToString());
            }
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            book.Write(ms);

            ms.Seek(0, SeekOrigin.Begin);
            return(File(ms, "application/vnd.ms-excel", "学习或工作总结" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"));
            //String fileName = "学习或工作总结.xls ";
            //return View();
        }