Example #1
0
File: Time.cs Project: ikvm/test
        public override object calculate()
        {
            if (base.paramList.Count == 0)
            {
                throw new ReportError("time函数参数列表为空");
            }
            object obj2 = ConvertTool.getValue(((ExpParse)base.paramList[0]).calculate());

            if (obj2 != null)
            {
                if (!(obj2 is string))
                {
                    throw new ReportError("time函数参数应该为字符串");
                }
                try
                {
                    return(DateTimeTool.parseTime((string)obj2));
                }
                catch (FormatException exception)
                {
                    throw new ReportError("time函数执行异常:" + exception.Message.ToString().ToString());
                }
            }
            return(obj2);
        }
        public void Refresh()
        {
            if (LoadTask == null || LoadTask.IsCompleted)
            {
                Task.Factory.StartNew(() =>
                {
                    var today     = WakaAnalyzer.Today.Career();   //获取当天时长
                    var last7days = WakaAnalyzer.Recent7.Career(); //获取最近7天时长
                    var avg       = last7days / 7;                 //获取7日平均

                    var todayFormat     = DateTimeTool.ToHMS(today);
                    var last7daysFormat = DateTimeTool.ToHMS(last7days);
                    var avgFormat       = DateTimeTool.ToHMS(avg);

                    double increase = today * 100 / (last7days / 7);

                    App.Current.Dispatcher.Invoke((Action)(() =>
                    {
                        GaugeValue = (int)(increase > 100 ? 100 : increase);
                        TodayTimeContent = $"今天 {todayFormat.Item1} 小时 {todayFormat.Item2} 分钟";
                        IncreaseContent = increase >= 100 ? $"{(int)increase}% +" : $"{100 - (int)increase}% -";
                        DailyAverageContent = $"7日 平均 {avgFormat.Item1} 小时 {avgFormat.Item2} 分钟";
                    }));
                });
            }
        }
Example #3
0
        //套餐日期 一開始先全抓
        public static List <PkgDateforEcModel> getProdPkgDate(PackageModel pkg, string lang, string currency, Dictionary <string, string> uikey, out string allCanUseDate)
        {
            List <PkgDateforEcModel> pkgDateList = new List <PkgDateforEcModel>();
            string allCanUseDateTemp             = "";

            //要判斷是否是0000
            PkgSaleDateModel sale_dates = pkg.sale_dates;

            foreach (SaleDt s in sale_dates.saleDt)
            {
                string   pkgOid = s.pkg_no.ToString();
                DateTime day    = DateTimeTool.yyyyMMdd2DateTime(s.sale_day);
                //string day = s.sale_day.ToString();

                //先建立ProductPkgDateModel ,有新的就加
                string[] pkgid = pkgOid.Split(",");
                foreach (string id in pkgid)
                {
                    var result = pkgDateList.Where(x => x.pkgOid.ToString() == id);

                    if (result.Count() > 0)
                    {
                        foreach (PkgDateforEcModel pd in result)
                        {
                            pd.day = pd.day + day.ToString("yyyy-MM-dd") + ",";
                        }
                    }
                    else
                    {
                        PkgDateforEcModel pd = new PkgDateforEcModel();
                        pd.pkgOid = id;
                        pd.day    = day.ToString("yyyy-MM-dd") + ",";
                        pkgDateList.Add(pd);
                    }
                }
                allCanUseDateTemp = allCanUseDateTemp + day.ToString("yyyy-MM-dd") + ",";
            }

            //去最後逗號
            foreach (PkgDateforEcModel pkgDate in pkgDateList)
            {
                if (pkgDate.day.Length != 0)
                {
                    pkgDate.day = pkgDate.day.Substring(0, pkgDate.day.Length - 1);
                }
            }

            allCanUseDate = allCanUseDateTemp.Length > 0 ? allCanUseDateTemp.Substring(0, allCanUseDateTemp.Length - 1) : allCanUseDateTemp;

            return(pkgDateList);
        }
Example #4
0
 public void Refresh()
 {
     if (LoadTask == null || LoadTask.IsCompleted)
     {
         Task.Factory.StartNew(() =>
         {
             //获取编程总时长
             var CareerTime = DateTimeTool.ToHMS(WakaAnalyzer.All.Career());
             //统计当月总时长
             var MonthCareerTime = DateTimeTool.ToHMS(WakaAnalyzer.Month.Career(DateTime.Now.Year, DateTime.Now.Month));
             //获取当天时长
             var TodayCareerTime = DateTimeTool.ToHMS(WakaAnalyzer.Today.Career());
             App.Current.Dispatcher.Invoke((Action)(() =>
             {
                 LBCareer.Content = $"总计:{CareerTime.Item1} 小时 {CareerTime.Item2} 分钟";
                 LBMonthCareer.Content = $"本月:{MonthCareerTime.Item1} 小时 {MonthCareerTime.Item2} 分钟";
                 LBTodayCareer.Content = $"当天:{TodayCareerTime.Item1} 小时 {TodayCareerTime.Item2} 分钟";
             }));
         });
     }
 }
Example #5
0
        //套餐日期
        public static String getPkgEventDate(PkgEventsModel pkgEvent, string inPkgOi, int?bookintQty)
        {
            //event 要有位控且位控>=訂購數
            string dayTemp = "";

            foreach (Event e in pkgEvent.events)
            {
                string[] times = e.event_times.Split(",");

                foreach (string s in times)
                {
                    int      qty = Convert.ToInt32(s.Split("_")[2]);
                    DateTime day = DateTimeTool.yyyyMMdd2DateTime(e.day);
                    if (qty >= bookintQty)
                    {
                        dayTemp = dayTemp + day.ToString("yyyy-MM-dd") + ",";
                    }
                    break;
                }
            }

            dayTemp = dayTemp.Substring(0, dayTemp.Length - 1);
            return(dayTemp);
        }
Example #6
0
 /// <summary>
 /// Returns the first day of the week that the specified date
 /// is in.
 /// </summary>
 public static DateTime GetFirstDayOfWeek(DateTime dayInWeek, CultureInfo cultureInfo)
 {
     return(DateTimeTool.GetFirstDayOfWeek(dayInWeek, cultureInfo));
 }
Example #7
0
 /// <summary>
 /// Returns the first day of the week that the specified
 /// date is in using the current culture.
 /// </summary>
 public static DateTime GetFirstDayOfWeek(DateTime dayInWeek)
 {
     return(DateTimeTool.GetFirstDayOfWeek(dayInWeek));
 }
Example #8
0
        //組出booking 頁右邊顯示的內容
        public static BookingShowProdModel setBookingShowProd(ProductModel prod, PkgDetailModel pkg, confirmPkgInfo confirm, string currency, PkgEventsModel pkgEvent, ProdTitleModel prodTitle)
        {
            BookingShowProdModel prodShow = new BookingShowProdModel();

            prodShow.prodOid   = prod.prod_no.ToString();
            prodShow.prodName  = prod.prod_name;
            prodShow.currency  = currency;
            prodShow.sDate     = DateTimeTool.yyyy_mm_dd(confirm.selDate);
            prodShow.price1Qty = confirm.price1Qty;
            prodShow.price2Qty = confirm.price2Qty;
            prodShow.price3Qty = confirm.price3Qty;
            prodShow.price4Qty = confirm.price4Qty;
            prodShow.price1    = pkg.price1;
            prodShow.price2    = pkg.price2;
            prodShow.price3    = pkg.price3;
            prodShow.price4    = pkg.price4;
            prodShow.eventOid  = confirm.pkgEvent;
            if (prod.img_list.Count > 0)
            {
                prodShow.photoUrl = Website.Instance.Configuration["kkUrl:imgUrl"].ToString() + prod.img_list[0].img_kkday_url;
            }

            prodShow.isRank      = pkg.is_unit_pirce == "RANK" ? true : false;
            prodShow.pkgOid      = pkg.pkg_no;
            prodShow.pkgName     = pkg.pkg_name;
            prodShow.totoalPrice = (prodShow.price1Qty * prodShow.price1) + (prodShow.price2Qty * prodShow.price2) +
                                   (prodShow.price3Qty * prodShow.price3) + (prodShow.price4Qty * prodShow.price4);

            prodShow.unitText = pkg.unit_txt;

            if (pkgEvent != null)
            {
                var eTemp = pkgEvent.events.Where(x => x.day.Equals(confirm.selDate));


                foreach (Event e in eTemp)
                {
                    string[] times = e.event_times.Split(",");

                    foreach (string s in times)
                    {
                        string id = s.Split("_")[0];
                        if (id.Equals(confirm.pkgEvent))
                        {
                            prodShow.eventTime = s.Split("_")[1];
                            break;
                        }
                    }
                }
            }

            //設定回覆確試時間
            if (prod.confirm_order_time == 0)
            {
                prodShow.confirm_order_time = prodTitle.common_imm_confirm;
            }
            else
            {
                prodShow.confirm_order_time = prodTitle.booking_step3_check_confirm_hour.Replace("%d", prod.confirm_order_time.ToString());
            }

            return(prodShow);
        }
Example #9
0
        // GET: /<controller>/
        public IActionResult Index(string guid)
        {
            try
            {
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                string ip = httpContextAccessor.HttpContext.Request.HttpContext.Connection.RemoteIpAddress.ToString().Replace("::1", "127.0.0.1");

                //取挖字
                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);// RedisHelper.getuiKey(fakeContact.lang);
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

                if (guid == null)
                {
                    throw new Exception(title.common_data_error);
                }

                confirmPkgInfo confirm = JsonConvert.DeserializeObject <confirmPkgInfo>(RedisHelper.getRedis("bid:ec:confirm:" + guid));
                if (confirm == null)
                {
                    throw new Exception(title.common_data_error);
                }

                //從 api取
                ProductModuleModel module = ProductRepostory.getProdModule(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, confirm.pkgOid, title);
                ProductModel       prod   = ProductRepostory.getProdDtl(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, title);
                PackageModel       pkgs   = ProductRepostory.getProdPkg(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, title);

                if (prod.result != "0000")
                {
                    Website.Instance.logger.Debug($"booking_index_getProdDtl_err:prodOid->{confirm.prodOid} ,msg-> {prod.result_msg}");
                    throw new Exception(title.result_code_9990);
                }
                if (pkgs.result != "0000")
                {
                    Website.Instance.logger.Debug($"booking_index_getProdPkg_err:prodOid->{confirm.prodOid},pkgOid ->{confirm.pkgOid} ,msg-> {prod.result_msg}");
                    throw new Exception(title.result_code_9990);
                }

                string         flightInfoType = "";
                string         sendInfoType   = "";
                PkgDetailModel pkg            = null;
                PkgEventsModel pkgEvent       = null;
                CusAgeRange    cusAgeRange    = null;
                string         isEvent        = "N";
                string         isHl           = "N";
                var            pkgsTemp       = pkgs.pkgs.Where(x => x.pkg_no == confirm.pkgOid).ToList();
                if (pkgsTemp.Count() > 0)
                {
                    foreach (PkgDetailModel p in pkgsTemp)
                    {
                        pkg            = p;
                        flightInfoType = p.module_setting.flight_info_type.value;
                        sendInfoType   = p.module_setting.send_info_type.value;
                        cusAgeRange    = BookingRepostory.getCusAgeRange(confirm, p);

                        isEvent = p.is_event;
                        isHl    = p.is_hl;
                    }
                }
                else
                {
                    //丟錯誤頁
                    Website.Instance.logger.Debug($"booking_index_err:商編->{confirm.prodOid}即有pkgs找不到對應的pkgoid->{ confirm.pkgOid}");
                    throw new Exception(title.common_data_error);
                }

                //如果有event 但沒有傳 event id ,就error
                if (isEvent == "Y" && string.IsNullOrEmpty(confirm.pkgEvent))
                {
                    throw new Exception(title.common_data_error);
                }

                if (isEvent == "Y")
                {
                    pkgEvent = ApiHelper.getPkgEvent(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, confirm.pkgOid, title);
                }

                //pmgw
                PmchLstResponse pmchRes = ApiHelper.getPaymentListRes(prod.countries, prod.prod_no.ToString(), DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"),
                                                                      DateTimeTool.yyyyMMdd2DateTime(confirm.selDate).ToString("yyyy-MM-dd"), DateTimeTool.yyyyMMdd2DateTime(confirm.selDate).ToString("yyyy-MM-dd"), UserData.COUNRTY_CODE, UserData.LOCALE,
                                                                      prod.prod_type, ip, prod.prod_hander, UserData.CURRENCY, title);

                Pmgw pmgw = null;
                if (UserData.CURRENCY == "TWD")
                {
                    pmgw = pmchRes.pmchlist.Where(x => x.acctdocReceiveMethod == "ONLINE_CITI" && x.pmchCode == "B2D_CITI_TWD").FirstOrDefault();
                }
                else
                {
                    pmgw = pmchRes.pmchlist.Where(x => x.acctdocReceiveMethod == "ONLINE_HK_ADYEN").FirstOrDefault();
                }
                //必須要設定人數
                //var cusData = BookingRepostory.getCusDdate();
                int totalCus = 0;
                if (module.module_cust_data != null)
                {
                    if (module.module_cust_data.is_require == true)
                    {
                        totalCus = (module.module_cust_data.cus_type == "01") ? 1 : Convert.ToInt32(confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty);
                    }
                }

                //滿足國家
                List <Country> country    = prod.countries;
                string         nationName = "";
                if (country.Count > 0)
                {
                    nationName = country[0].name;
                }

                //將dataModel原型 以json str 帶到前台的hidden
                DataModel dm = DataSettingRepostory.getDefaultDataModel(totalCus, guid);
                dm.guidNo = guid;
                String dataModelStr = JsonConvert.SerializeObject(dm);
                //dm.travelerData[0].meal.mealType
                ViewData["dataModelStr"] = dataModelStr;

                VenueInfo venue = module.module_venue_info;
                if (venue == null)
                {
                    venue = new VenueInfo(); venue.is_require = false;
                }
                RentCar rentCar = module.module_rent_car;
                if (rentCar == null)
                {
                    rentCar = new RentCar(); rentCar.is_require = false;
                }
                ViewData["confirmPkgInfo"] = confirm;
                ViewData["contactInfo"]    = UserData;
                ViewData["cusData"]        = module.module_cust_data;
                ViewData["guide"]          = module.module_guide_lang_list;
                ViewData["wifi"]           = module.module_sim_wifi;
                ViewData["exchange"]       = module.module_exchange_location_list;
                ViewData["flightInfo"]     = module.module_flight_info;
                ViewData["venue"]          = venue;                                    // module.module_venue_info;
                ViewData["useDate"]        = DateTimeTool.yyyy_mm_dd(confirm.selDate); //DateTimeTool.yyyy_mm_dd();
                ViewData["rentCar"]        = rentCar;                                  // module.module_rent_car;
                ViewData["carPsgr"]        = module.module_car_pasgr;                  //車輛資料
                ViewData["sendData"]       = module.module_send_data;
                ViewData["contactData"]    = module.module_contact_data;
                ViewData["nationName"]     = nationName;

                ViewData["guid"]           = guid;
                ViewData["prodTitle"]      = title;
                ViewData["totalCus"]       = totalCus;
                ViewData["mainCat"]        = prod.prod_type;
                ViewData["flightInfoType"] = flightInfoType;
                ViewData["sendInfoType"]   = sendInfoType;
                ViewData["CutOfDay"]       = prod.before_order_day;
                ViewData["cusAgeRange"]    = cusAgeRange;
                BookingShowProdModel show = BookingRepostory.setBookingShowProd(prod, pkg, confirm, UserData.CURRENCY, pkgEvent, title);
                ViewData["prodShow"] = show;

                ViewData["isEvent"]       = isEvent;                                                                                                                                                                            //
                ViewData["isHl"]          = isHl;                                                                                                                                                                               //如果是N就不用做
                ViewData["pkgCanUseDate"] = (isHl == "Y" && isEvent == "Y") ? BookingRepostory.getPkgEventDate(pkgEvent, confirm.pkgOid, (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty)) : ""; //要把這個套餐可以用的日期全抓出來
                ViewData["pmgw"]          = pmgw;

                //放到session
                TempData["prod_" + guid]          = JsonConvert.SerializeObject(prod);
                TempData["pkgEvent_" + guid]      = (isHl == "Y" && isEvent == "Y") ? JsonConvert.SerializeObject(pkgEvent) : "";
                TempData["module_" + guid]        = JsonConvert.SerializeObject(module);
                TempData["confirm_" + guid]       = JsonConvert.SerializeObject(confirm);
                TempData["ProdTitleKeep_" + guid] = JsonConvert.SerializeObject(title);
                TempData["pkg_" + guid]           = JsonConvert.SerializeObject(pkg);
                TempData["pkgsDiscRule_" + guid]  = JsonConvert.SerializeObject(pkgs.discount_rule);
                TempData["prodShow_" + guid]      = JsonConvert.SerializeObject(show);
                TempData["pmgw_" + guid]          = JsonConvert.SerializeObject(pmgw);

                return(View());
            }
            catch (Exception ex)
            {
                ViewData["errMsg"] = ex.Message.ToString();
                Website.Instance.logger.Debug($"booking_index_err:{ex.Message.ToString()}");
                //導到錯誤頁
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Invalid_Common
                }));
            }
        }
        public void Refresh()
        {
            int year = DateTime.Now.Year;

            //if (CBYear.SelectedValue != null )
            //{
            //    year = (int)CBYear.SelectedValue;
            //}

            if (LoadTask == null || LoadTask.IsCompleted)
            {
                LoadTask = Task.Factory.StartNew(() =>
                {
                    var data = WakaAnalyzer.Year.MonthlyColumn(year);
                    if (ListTool.HasElements(data))
                    {
                        List <string> lb = new List <string>();
                        for (int i = 1; i <= 12; i++)
                        {
                            lb.Add($"{i}月");
                        }
                        App.Current.Dispatcher.Invoke((Action)(() =>
                        {
                            Labels = lb.ToArray();
                        }));

                        App.Current.Dispatcher.Invoke(() =>
                        {
                            Formatter = value =>
                            {
                                if (value > 0)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    var time         = DateTimeTool.ToHMS(value);
                                    if (time.Item1 > 0)
                                    {
                                        sb.Append($"{time.Item1} 小时");
                                    }
                                    if (time.Item2 > 0)
                                    {
                                        sb.Append($" {time.Item2} 分钟");
                                    }
                                    return(sb.ToString());
                                }
                                return(null);
                            };
                        });

                        SeriesCollection = new SeriesCollection();
                        string title     = $"{data.FirstOrDefault().Item1.Year} 年";
                        double[] values  = data.OrderBy(y => y.Item1).Select(y => y.Item2).ToArray();

                        App.Current.Dispatcher.Invoke(() =>
                        {
                            SeriesCollection.Add(
                                new ColumnSeries
                            {
                                Title  = title,
                                Values = new ChartValues <double>(values)
                            });
                        });
                    }
                });
            }
        }
        public void Refresh()
        {
            int year = DateTime.Now.Year;
            int month = DateTime.Now.Month;
            if (CBYear.SelectedValue != null && CBMonth.SelectedValue != null)
            {
                year = (int)CBYear.SelectedValue;
                month = (int)CBMonth.SelectedValue;
            }

            if (LoadTask == null || LoadTask.IsCompleted)
                LoadTask = Task.Factory.StartNew(() =>
                {
                    var datas = WakaAnalyzer.Month.Report(year, month);
                    if (ListTool.HasElements(datas))
                    {
                        var first = datas.FirstOrDefault();
                        if (first != null && ListTool.HasElements(first.Item2))
                        {
                            List<DateTime> dt = first.Item2.OrderBy(x => x.Item1).Select(x => x.Item1).ToList();
                            List<string> lb = new List<string>();
                            dt.ForEach(x =>
                            {
                                lb.Add(x.ToString("dd日"));
                            });
                            var career = WakaAnalyzer.Month.Career(year, month);
                            var careerFmt = DateTimeTool.ToHMS(career);
                            var avgFmt = DateTimeTool.ToHMS(career / DateTool.MonthDays(year, month));
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                Labels = lb.ToArray();
                                TimeDesc = $"{year} 年 {month} 月,共计:{careerFmt.Item1} 时 {careerFmt.Item2} 分,日均:{avgFmt.Item1} 时 {avgFmt.Item2} 分";
                            }));
                        }

                        App.Current.Dispatcher.Invoke(() =>
                        {
                            Formatter = value =>
                            {
                                if (value > 0)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    var time = DateTimeTool.ToHMS(value);
                                    if (time.Item1 > 0) sb.Append($"{time.Item1} 小时");
                                    if (time.Item2 > 0) sb.Append($" {time.Item2} 分钟");
                                    return sb.ToString();
                                }
                                return null;
                            };
                        });

                        SeriesCollection = new SeriesCollection();
                        datas.ForEach(x =>
                        {
                            string title = x.Item1;
                            double[] values = x.Item2.OrderBy(y => y.Item1).Select(y => y.Item2).ToArray();

                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                SeriesCollection.Add(
                                    new StackedColumnSeries
                                    {
                                        Title = title,
                                        Values = new ChartValues<double>(values),
                                        StackMode = StackMode.Values
                                    });
                            }));
                        });
                    }
                });
        }
Example #12
0
        private IEnumerable <ProjectHour> GetTableData(IEnumerable <VaultKey> vaultGuids, VaultServer server,
                                                       DateTime?beginDate = null, DateTime?deadline = null, int showingType = 1)
        {
            var vaultInfo    = _workHourService.GetHourInfo(vaultGuids, server, beginDate, deadline);
            var projHourList = new List <ProjectHour>();

            foreach (ProjectHourInfo pInfo in vaultInfo)
            {
                var dbTotalBudget     = pInfo.TotalBudget;
                var dbPersonalBudgets = pInfo.PersonalBudgets;
                var dbHourLogs        = pInfo.HourLogs;

                if (beginDate == null)
                {
                    beginDate = dbTotalBudget.BeginDate;
                }
                if (deadline == null)
                {
                    deadline = dbTotalBudget.Deadline;
                }
                var projHour = new ProjectHour()
                {
                    ProjName = dbTotalBudget.ProjectName
                               //,BudgetHours = dbTotalBudget.TotalHours
                    , TimeSpans = new List <string>()
                };
                double tHoursBuget  = 0.0;
                double tHoursActual = 0.0;
                var    userList     = new List <UserHour>();
                var    timeSpans    = DateTimeTool.GetTimespanList(beginDate.GetValueOrDefault(),
                                                                   deadline.GetValueOrDefault(), showingType).ToList();
                foreach (TimeArea span in timeSpans)
                {
                    projHour.TimeSpans.Add(span.Title);
                }

                foreach (PersonalBudget b in dbPersonalBudgets)
                {
                    var userHour = new UserHour
                    {
                        UserName = b.MemberName
                    };
                    var uLogs = GetUserLogs(b.VaultGuid, b.UserID, dbHourLogs);

                    var bHours   = new List <UnitHour>();
                    var aHours   = new List <UnitHour>();
                    var mBudgets = Convert2MonthBudgets(b.HoursDetail);
                    foreach (TimeArea t in timeSpans)
                    {
                        var bUnit = GetBudgetUnit(t, mBudgets);
                        var aUnit = GetActualUnit(t, uLogs);
                        bHours.Add(bUnit);
                        aHours.Add(aUnit);
                    }
                    userHour.BudgetHours = bHours;
                    userHour.ActualHours = aHours;

                    tHoursBuget  += userHour.BudgetTotal;
                    tHoursActual += userHour.ActualTotal;

                    userList.Add(userHour);
                }
                projHour.UserList    = userList;
                projHour.BudgetHours = tHoursBuget;
                projHour.ActualHours = tHoursActual;
                projHourList.Add(projHour);
            }
            return(projHourList);
        }
Example #13
0
File: DbStru.cs Project: ikvm/test
        private StringBuilder method_4(string string_1, ArrayList arrayList_0)
        {
            string        str      = this.connectionConfig_0.getDbType();
            ArrayList     list     = new ArrayList();
            StringBuilder builder  = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();

            for (int i = 0; i < arrayList_0.Count; i++)
            {
                FieldInfo info = (FieldInfo)arrayList_0[(i)];
                string    str6 = info.realType.ToUpper();
                if ((((str == "sqlserver") && (str6 != "TEXT")) && ((str6 != "NTEXT") && (str6 != "BINARY"))) && ((str6 != "VARBINARY") && (str6 != "IMAGE")))
                {
                    builder2.Append(info.name);
                    builder2.Append(",");
                    list.Add(str6);
                }
                if ((((str == "oracle") && (str6 != "LONG RAW")) && ((str6 != "BLOB") && (str6 != "CLOB"))) && (str6 != "LONG"))
                {
                    builder2.Append(info.name);
                    builder2.Append(",");
                    list.Add(str6);
                }
            }
            if (builder2.Length > 0)
            {
                builder2.Remove(builder2.Length - 1, 1);
            }
            if (builder2.Length != 0)
            {
                string strSql = "select " + builder2.ToString() + " from " + string_1;
                try
                {
                    IDataReader rs = this.dboperator_0.exeSql(strSql);
                    while (rs.Read())
                    {
                        StringBuilder builder3 = new StringBuilder();
                        for (int j = 0; j < list.Count; j++)
                        {
                            string str3     = "";
                            string str4     = "";
                            object dateTime = null;
                            string str5     = (string)list[(j)];
                            switch (str5)
                            {
                            case "CHAR":
                            case "NCHAR":
                            case "NVARCHAR":
                            case "VARCHAR":
                            case "NVARCHAR2":
                            case "VARCHAR2":
                                str3     = "'";
                                str4     = "'";
                                dateTime = SQLTool.getStr(rs, j, this.string_0);
                                break;
                            }
                            if ((str == "sqlserver") && ((str5 == "DATETIME") || (str5 == "SMALLDATETIME")))
                            {
                                dateTime = rs.GetDateTime(j);
                                dateTime = DateTimeTool.formatTimestamp((DateTime)dateTime);
                                str3     = "'";
                                str4     = "'";
                            }
                            if ((str == "oracle") && (str5 == "DATE"))
                            {
                                dateTime = rs.GetDateTime(j);
                                dateTime = DateTimeTool.formatTimestamp((DateTime)dateTime);
                                str3     = "to_date('";
                                str4     = "','yyyy-mm-dd hh24:mi:ss')";
                            }
                            if (dateTime == null)
                            {
                                dateTime = rs.GetString(j);
                            }
                            builder3.Append(str3);
                            builder3.Append(dateTime);
                            builder3.Append(str4);
                            if (j < (list.Count - 1))
                            {
                                builder3.Append(",");
                            }
                        }
                        builder.Append("INSERT INTO " + string_1 + " (");
                        builder.Append(builder2);
                        builder.Append(") values (");
                        builder.Append(builder3);
                        builder.Append(");\r\n");
                    }
                    rs.Close();
                }
                catch (Exception exception)
                {
                    Logger.error(exception);
                }
                return(builder);
            }
            return(builder);
        }
        public void Refresh()
        {
            if (LoadTask == null || LoadTask.IsCompleted)
            {
                LoadTask = Task.Factory.StartNew(() =>
                {
                    var datas = WakaAnalyzer.Recent7.Report();
                    if (ListTool.HasElements(datas))
                    {
                        var first = datas.FirstOrDefault();
                        if (first != null && ListTool.HasElements(first.Item2))
                        {
                            List <DateTime> dt = first.Item2.OrderBy(x => x.Item1).Select(x => x.Item1).ToList();
                            List <string> lb   = new List <string>();
                            dt.ForEach(x =>
                            {
                                lb.Add(x.ToString("MM月dd日"));
                            });
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                Labels = lb.ToArray();
                            }));
                        }

                        App.Current.Dispatcher.Invoke(() =>
                        {
                            Formatter = value =>
                            {
                                if (value > 0)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    var time         = DateTimeTool.ToHMS(value);
                                    if (time.Item1 > 0)
                                    {
                                        sb.Append($"{time.Item1} 小时");
                                    }
                                    if (time.Item2 > 0)
                                    {
                                        sb.Append($" {time.Item2} 分钟");
                                    }
                                    return(sb.ToString());
                                }
                                return(null);
                            };
                        });

                        SeriesCollection = new SeriesCollection();
                        datas.ForEach(x =>
                        {
                            string title    = x.Item1;
                            double[] values = x.Item2.OrderBy(y => y.Item1).Select(y => y.Item2).ToArray();

                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                SeriesCollection.Add(
                                    new StackedColumnSeries
                                {
                                    Title = title,
                                    Values = new ChartValues <double>(values),
                                    StackMode = StackMode.Values
                                });
                            }));
                        });
                    }
                });
            }
        }
Example #15
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            var fmt = DateTimeTool.ToHMS(SleepTime++ *1000);

            label3.Text = $"计时:{fmt.Item1}:{fmt.Item2}:{fmt.Item3}";
        }