private void FillChartInhabitants(string title, Func <ModelData.RegionData, float> dataToExtract)
        {
            var dateFrom = FromDate?.Invoke() ?? DateTime.Today;
            var dateTo   = ToDate?.Invoke() ?? DateTime.Today;
            var top      = Top?.Invoke()?.value ?? 5;
            var data     = DataExtractorRegion.FillRangeDataInhabitants(dateFrom, dateTo, top, dataToExtract);

            Title = dateFrom.Date == dateTo.Date
                    ? $"{title} {dateFrom.Date.ToShortDateString()}"
                    : $"{title} {Properties.Resources.BetweenDate} {dateFrom.Date:dd/MM/yy} {Properties.Resources.And} {dateTo.Date:dd/MM/yy}";

            Func <ChartPoint, string> labelPoint = chartPoint =>
                                                   string.Format("{0}", chartPoint.Y.ToString("#,##0.##"));

            var series = new SeriesCollection();

            foreach (var region in data)
            {
                series.Add(
                    new PieSeries()
                {
                    Title  = region.lbl,
                    Values = new ChartValues <float> {
                        region.value
                    },
                    DataLabels = true,
                    LabelPoint = labelPoint
                });
            }

            this.chart.Series         = series;
            this.chart.LegendLocation = LegendLocation.Right;
        }
示例#2
0
        public override int GetHashCode()
        {
            int hashCode1 = FromDate == null ? 0 : FromDate.GetHashCode();
            int hashCode2 = ToDate == null ? 0 : ToDate.GetHashCode();

            return(hashCode1 ^ hashCode2);
        }
示例#3
0
        /// <summary>
        /// 解析活动时间
        /// </summary>
        public bool ParseActivityTime(string ZhouMoChongZhiTime)
        {
            // <!--Mu周末充值时间,开启时间,终止时间,1至7代表周一至周日-->
            // <Param Name="ZhouMoChongZhiTime" Value="6,00:00:00|7,23:59:59"/>
            string[] TimeActivity = ZhouMoChongZhiTime.Split('|');
            if (TimeActivity == null || TimeActivity.Length != 2)
            {
                return(false);
            }

            string[] DataBeginSplit = TimeActivity[0].Split(',');
            string[] DataEndSplit   = TimeActivity[1].Split(',');

            if (DataBeginSplit == null || DataEndSplit == null || DataBeginSplit.Length != 2 || DataEndSplit.Length != 2)
            {
                return(false);
            }

            //
            FromDate = DataBeginSplit[0] + ',' + DataBeginSplit[1];
            ToDate   = DataEndSplit[0] + ',' + DataEndSplit[1];

            // 删空格 防止填错
            FromDate.Trim();
            ToDate.Trim();

            return(true);
        }
示例#4
0
        private void ButtonPrint_OnClick(object sender, RoutedEventArgs e)
        {
            if (Logs.Count == 0)
            {
                MessageBox.Show("No Data.");
                return;
            }

            var myPicturePath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            var fileName      = string.Format("{0}.jpg", Guid.NewGuid().ToString());
            var filePath      = System.IO.Path.Combine(myPicturePath, fileName);

            Chart.ExportToImage(filePath);

            string itemName = Logs[0].Item.ItemName;

            var export = new LogExport()
            {
                ItemName  = itemName,
                StartDate = FromDate.ToString(),
                EndDate   = ToDate.ToString(),
                Graph     = string.Format("File://{0}", filePath),
                HashValue = ConcatedHash,
                Min       = Min.ToString(),
                Max       = Max.ToString()
            };

            WindowReport1 windowReport1 = new WindowReport1();

            windowReport1.Export = export;
            windowReport1.ShowDialog();

            // clean junk
            File.Delete(filePath);
        }
示例#5
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            LoadAuthentication(context);

            if (EnvelopeIDs.Get(context) != null)
            {
                Query["envelope_ids"] = EnvelopeIDs.Get(context).Replace(" ", "");
            }

            if (FromDate.Get(context) != DateTime.MinValue)
            {
                Query["from_date"] = FromDate.Get(context).ToString("s", System.Globalization.CultureInfo.InvariantCulture) + "Z";
                Console.WriteLine("From Date: " + Query["from_date"]);
            }
            if (ToDate.Get(context) != DateTime.MinValue)
            {
                Query["to_date"] = ToDate.Get(context).ToString("s", System.Globalization.CultureInfo.InvariantCulture) + "Z";
                Console.WriteLine("To Date: " + Query["to_date"]);
            }

            if (FromToStatus.ToString() != null && FromToStatus.ToString() != "Any")
            {
                Query["from_to_status"] = FromToStatus.ToString();
            }
            if (Status.Get(context) != null)
            {
                Query["status"] = Status.Get(context).Replace(" ", "");
            }


            GetEnvelopesDelegate = new Action(_ListEnvelopes);
            return(GetEnvelopesDelegate.BeginInvoke(callback, state));
        }
示例#6
0
        public bool IsValid()
        {
            var oErrors = new List <string>();

            if (ToDate <= FromDate)
            {
                oErrors.Add("Period final date is less than period start date in " +
                            FromDate.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture) + " and " +
                            ToDate.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture) + "."
                            );
            }             // if

            if (string.IsNullOrWhiteSpace(Period))
            {
                Period = ToDate.ToString("MM yy", CultureInfo.InvariantCulture);
            }

            if (DueDate < ToDate)
            {
                DueDate = ToDate.AddMonths(1).AddDays(7);
            }

            if ((BoxData == null) || (BoxData.Count < 1))
            {
                oErrors.Add("No box data specified.");
            }

            Errors = oErrors.ToArray();
            return(Errors.Length == 0);
        } // IsValid
示例#7
0
        public override string ToString()
        {
            string formatString = "yyyy-MM-dd HH:mm";

            return("from " + FromDate.DayOfWeek.ToString() + " " + FromDate.ToString(formatString) +
                   " to " + ToDate.DayOfWeek.ToString() + " " + ToDate.ToString(formatString));
        }
示例#8
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (FromDate.AsDateTime() > ToDate.AsDateTime())
            {
                yield return(new ValidationResult(ReportInputParametersResources.FromDateBeforeToDate, new[] { "FromDate" }));
            }

            if (string.IsNullOrEmpty(SelectedTextField) || SelectedTextField != "-1")
            {
                if (string.IsNullOrEmpty(SelectedTextField))
                {
                    yield return
                        (new ValidationResult(ReportInputParametersResources.TextFieldRequired, new[] { "SelectedTextField" }));
                }

                if (!string.IsNullOrEmpty(SelectedTextField) && string.IsNullOrEmpty(SelectedOperator))
                {
                    yield return
                        (new ValidationResult(ReportInputParametersResources.TextFieldOperatorRequired, new[] { "SelectedOperator" }));
                }

                if (!string.IsNullOrEmpty(SelectedTextField) && string.IsNullOrEmpty(TextSearch))
                {
                    yield return
                        (new ValidationResult(ReportInputParametersResources.TextSearchRequired, new[] { "TextSearch" }));
                }
            }
        }
示例#9
0
        private void FormInit()
        {
            this.esiTitle.Text = $@"{FromDate.ToShortDateString()} - {ToDate.ToShortDateString()}  [{AccountInfo}] - [{StockCode} - {StockName}] ";

            if (LoginInfo.CurrentUser.IsAdmin)
            {
                //实际受益人
                var dealers = _accountService.GetAccountOperatorsByAccountId(AccountId);
                this.luBeneficiary.Initialize(dealers, "Code", "Name", showHeader: false, showFooter: false);

                //交易类别
                var tradeTypes = this._dictionaryService.GetDictionaryInfoByTypeId((int)EnumLibrary.DictionaryType.TradeType)
                                 .Select(x => new ComboBoxItemModel
                {
                    Text  = x.Name,
                    Value = x.Code.ToString(),
                }).ToList();
                this.cbTradeType.Initialize(tradeTypes);
            }
            else
            {
                lcgLeft.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                lcgRight.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }

            this.btnCopy.Enabled     = false;
            this.btnDelete_L.Enabled = false;
            this.btnDelete_R.Enabled = false;

            this.gridView1.SetLayout(showAutoFilterRow: false, showCheckBoxRowSelect: LoginInfo.CurrentUser.IsAdmin, rowIndicatorWidth: 40);
            this.gridView2.SetLayout(showAutoFilterRow: false, showCheckBoxRowSelect: LoginInfo.CurrentUser.IsAdmin, rowIndicatorWidth: 40);
        }
示例#10
0
        private void DisplayReport(DataTable dt)
        {
            string fromDate = ((DateTime)dtbFrom.DateValue).ToString("dd/MM/yyyy");
            string toDate   = ToDate.ToString("dd/MM/yyyy");

            string periode = String.Format("Periode {0} s/d {1}", fromDate, toDate);

            //construct parameter
            List <ReportParameter> rptParams = new List <ReportParameter>();

            rptParams.Add(new ReportParameter("Periode", periode));
            rptParams.Add(new ReportParameter("UserName", SecurityManager.UserName));
            rptParams.Add(new ReportParameter("KodeCabang", GlobalVar.CabangID));
            rptParams.Add(new ReportParameter("NamaToko", this.namaToko));
            rptParams.Add(new ReportParameter("AlamatToko", this.alamatToko));
            rptParams.Add(new ReportParameter("Kota", this.kotaToko));
            rptParams.Add(new ReportParameter("IdWil", this.wilID));
            rptParams.Add(new ReportParameter("KodeToko", this.kodeToko));
            rptParams.Add(new ReportParameter("Kelompok", string.Empty));

            frmReportViewer ifrmReport = new frmReportViewer("SIP.rptProgresSKUToko.rdlc", rptParams, dt, "dsProgresSKUToko_Data");

            ifrmReport.Text = "Report";
            ifrmReport.Show();
        }
示例#11
0
        /// <summary>
        /// 检查是否在活动持续时间内
        /// </summary>
        public override bool InActivityTime()
        {
            if (string.IsNullOrEmpty(FromDate) || string.IsNullOrEmpty(ToDate))
            {
                return(false);
            }

            int NowDayOfWeek = (int)TimeUtil.NowDateTime().DayOfWeek;

            string[] DataBeginSplit = FromDate.Split(',');
            string[] DataEndSplit   = ToDate.Split(',');

            // 将DayOfWeek 0~6 转换成 1~7
            if (DayOfWeek.Sunday == (DayOfWeek)NowDayOfWeek)
            {
                NowDayOfWeek = 7;
            }

            int BeginDayOfWeek = Convert.ToInt32(DataBeginSplit[0]);
            int EndDayOfWeek   = Convert.ToInt32(DataEndSplit[0]);

            if (NowDayOfWeek < BeginDayOfWeek)
            {
                return(false);
            }
            else if (NowDayOfWeek > EndDayOfWeek)
            {
                return(false);
            }

            string nowTime = TimeUtil.NowDateTime().ToString("HH:mm:ss");

            // 比较时分秒
            if (BeginDayOfWeek == EndDayOfWeek)
            {
                if (nowTime.CompareTo(DataBeginSplit[1]) > 0 && nowTime.CompareTo(DataEndSplit[1]) < 0)
                {
                    return(true);
                }
            }
            else if (NowDayOfWeek == BeginDayOfWeek)
            {
                if (nowTime.CompareTo(DataBeginSplit[1]) > 0)
                {
                    return(true);
                }
            }
            else if (NowDayOfWeek == EndDayOfWeek)
            {
                if (nowTime.CompareTo(DataEndSplit[1]) < 0)
                {
                    return(true);
                }
            }

            // NowDayOfWeek > BeginDayOfWeek && NowDayOfWeek < EndDayOfWeek && BeginDayOfWeek != EndDayOfWeek
            return(true);
        }
        public JsonResult GetHolidayList()
        {
            int      totalRow = 0;
            string   fromDate = Request.QueryString["fromDate"];
            string   toDate   = Request.QueryString["toDate"];
            DateTime FromDate;
            DateTime ToDate;

            if (string.IsNullOrWhiteSpace(fromDate))
            {
                var a = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
                FromDate = DateTime.ParseExact(a, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            else
            {
                FromDate = DateTime.ParseExact(fromDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            if (string.IsNullOrWhiteSpace(toDate))
            {
                ToDate = DateTime.ParseExact(DateTime.Now.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            else
            {
                ToDate = DateTime.ParseExact(toDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            var page   = GetPagingMessage(Request.QueryString);
            int result = DateTime.Compare(ToDate, FromDate);

            if (result < 0)
            {
                return(Json(new
                {
                    status = false,
                    mess = "Ngày bắt đầu không thể lớn hơn ngày kết thúc.",
                }, JsonRequestBehavior.AllowGet));
            }

            var regulationTime = _iplHoliday.ListHolidayAllPaging(FromDate, ToDate, page.PageIndex, page.PageSize, ref totalRow);

            ViewBag.FromDate = FromDate.ToString("yyyy-MM-dd");
            ViewBag.ToDate   = ToDate.ToString("yyyy-MM-dd");
            if (regulationTime != null && regulationTime.Count() > 0)
            {
                return(Json(new
                {
                    status = true,
                    rows = regulationTime.ToList(),
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = false,
                    mess = "Không tìm thấy dữ liệu.",
                }, JsonRequestBehavior.AllowGet));
            }
        }
 public override string ToString()
 {
     return(Name.ToString() + "\n" +
            "Id".PadRight(15) + Id + "\n" +
            "Site Id".PadRight(15) + SiteId + "\n" +
            "Check-in".PadRight(15) + FromDate.ToShortDateString() + "\n" +
            "Check-out".PadRight(15) + ToDate.ToShortDateString() + "\n" +
            "Creation Date".PadRight(15) + CreateDate + "\n");
 }
示例#14
0
        public void SetUp()
        {
            _database = GetSampleDb();

            var defItem = _database.GetItem(TestingConstants.ToDate.DefinitionId);

            _log     = new DefaultLogger();
            _sut     = new ToDate(defItem, _log);
            _dataMap = Substitute.For <IDataMap>();
        }
示例#15
0
        /// <summary>
        /// Valids the data.
        /// </summary>
        /// <returns></returns>
        protected override bool ValidData()
        {
            //if (cboActivityID.SelectedIndex == 1)
            //{
            //  //  grdLookUpBudgetItemID.Enabled = false;
            //    if ( grdLookUpWaitBudgetSourceID.EditValue == null)
            //    {

            //        XtraMessageBox.Show("Ban chua chon khoan thu",
            //                ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            //        grdLookUpWaitBudgetSourceID.Focus();
            //        return false;
            //    }

            //}
            //if (cboActivityID.SelectedIndex == 2)
            //{
            //    if (grdLookUpWaitBudgetSourceID.EditValue == null)
            //    {
            //        XtraMessageBox.Show("Ban chua chon quy ",
            //               ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            //        grdLookUpWaitBudgetSourceID.Focus();
            //        return false;
            //    }
            //}
            if (string.IsNullOrEmpty(CapitalAllocateCode))
            {
                XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmptyCapitalAllocateCode"),
                                    ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCapitalAllocateCode.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(BudgetSourceCode))
            {
                XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmptyCapitalAllocateByBudgetSourceCode"),
                                    ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                grdLookUpBudgetSourceID.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(FromDate.ToString()))
            {
                XtraMessageBox.Show("Bạn chưa nhập ngày bắt đầu áp dụng chỉ tiêu", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtFromDate.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(ToDate.ToString()))
            {
                XtraMessageBox.Show("Bạn chưa nhập ngày kết thúc áp dụng chỉ tiêu", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtToDate.Focus();

                return(false);
            }
            return(true);
        }
示例#16
0
        public void ToDate_Test()
        {
            var function = new ToDate
            {
                Format = "MMddyyyy",
            };

            var result = function.Evaluate("09011995");

            Assert.AreEqual(new DateTime(1995, 9, 1), result);
        }
 //Search and Filter methods
 public void EnterCustomDateRange(DateTime fromDateValue, DateTime toDateValue)
 {
     DateRange.SelectByText("Custom", "DateRange");
     //Save the from date for use in assertions
     ScenarioContext.Current["FromDateValue"] = fromDateValue.ToShortDateString();
     ScenarioContext.Current["ToDateValue"]   = toDateValue.ToShortDateString();
     //Enter this date in the from date field
     FromDate.EnterTextWithJS(fromDateValue.ToString("MM-dd-yyyy"), "From Date");
     ToDate.EnterTextWithJS(toDateValue.ToString("MM-dd-yyyy"), "To Date");
     driver.RobustWait();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ToDate          = DateTime.Now.AddDays(-DaysCount);
         FromDate        = DateTime.Now;
         txtfrmdate.Text = ToDate.ToString("MM/dd/yyyy");
         txttodate.Text  = FromDate.ToString("MM/dd/yyyy");
         BindConsignmentGrid();
     }
 }
示例#19
0
        public Dasa3Parts(Horoscope _h, DasaEntry _de, ToDate _td)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            td = _td;
            de = _de;
            h  = _h;
            this.repopulate();
        }
示例#20
0
 public override string ToString()
 {
     return("Reservation confirmation #" + ReservationId.ToString()
            + " is for " + Name.PadRight(7)
            + " \n at " + ParkName + " park and at "
            + CampgroundName + " campground (#" + CampgroundId
            + ") at site #" + SiteId.ToString().PadRight(3)
            + "\n from " + FromDate.ToString("D")
            + " to " + ToDate.ToString("D")
            + " and was created on " + CreateDate.ToString("D")
            + "\n Total Cost is of stay: " + String.Format("{0:C2}", ((ToDate - FromDate).Days * DailyFee)));
 }
示例#21
0
        private string GenerateSQL()
        {
            StringBuilder sb = new StringBuilder();

            //sb.Append(SQLCommands.AllJobs);
            sb.Append(" WHERE CustomerName Like '%" + CustomerName + "%'");
            sb.Append(" AND DocketNo Like '%" + PrismNo + "%'");
            sb.Append(" AND JobStatusId = 3");
            sb.Append(" AND JobCompletedDate >=#" + FromDate.ToString("dd MMM yyyy") + "#");
            sb.Append(" AND JobCompletedDate <=#" + ToDate.ToString("dd MMM yyyy") + "#");
            sb.Append(" ORDER BY " + SortColumnName + " " + SortOrder);
            return(sb.ToString());
        }
示例#22
0
        // 从db获取我的活动信息, 包括每个充值档次达成的天数
        // 以及每个档次达成的天数的每一天的领奖情况
        private List <_AwardInfo> _GetMyActInfoFromDB(GameClient client)
        {
            if (client == null)
            {
                return(null);
            }
            if (!InActivityTime() && !InAwardTime())
            {
                return(null);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(client.ClientData.RoleID);
            sb.Append(':').Append(client.ClientData.ZoneID);
            sb.Append(':').Append(FromDate.Replace(':', '$'));
            sb.Append(':').Append(ToDate.Replace(':', '$'));
            sb.Append(':');
            foreach (var cl in chargeLvlList)
            {
                sb.Append(cl.Id).Append('_');
            }

            string[] dbRet = Global.ExecuteDBCmd((int)TCPGameServerCmds.CMD_DB_QUERY_JIERI_LIANXU_CHARGE, sb.ToString(), client.ServerId);
            if (dbRet == null || dbRet.Length != 2)
            {
                return(null);
            }

            int[] eachDayChargeArr             = _ParseEachDayCharge(dbRet[0]);
            Dictionary <int, int> awardFlagDic = _ParseAwardFlagOfEachLvl(dbRet[1]);

            List <_AwardInfo> result = new List <_AwardInfo>();

            foreach (var cl in chargeLvlList)
            {
                // 计算出来每个充值档次连续充值达成的天数以及领奖信息
                _AwardInfo ai = new _AwardInfo();
                ai.LianXuDay = _CalcLianXuChargeDay(eachDayChargeArr, cl.NeedCharge);
                ai.AwardId   = cl.Id;
                ai.AwardFlag = 0;
                if (awardFlagDic.ContainsKey(cl.Id))
                {
                    ai.AwardFlag = awardFlagDic[cl.Id];
                }

                result.Add(ai);
            }

            return(result);
        }
示例#23
0
        private void PrintDasa(IDasa id, bool bGraha)
        {
            Brush     b      = Brushes.Black;
            ArrayList alDasa = id.Dasa(0);
            ToDate    td     = new ToDate(h.baseUT, 360, 0, h);

            int num_entries_per_line = 6;
            int entry_width          = width / 6;

            g.ResetTransform();
            g.TranslateTransform(left, top);
            g.DrawString(id.Description(), f_u, b, 0, 0);
            top += f.Height * 2;

            foreach (DasaEntry de in alDasa)
            {
                g.ResetTransform();
                g.TranslateTransform(left, top);
                string s = "";
                if (bGraha)
                {
                    s = de.graha.ToString();
                }
                else
                {
                    s = de.zodiacHouse.ToString();
                }

                g.DrawString(s, f, b, 0, 0);
                ArrayList alAntar = id.AntarDasa(de);
                for (int j = 0;
                     j < (int)Math.Ceiling((double)alAntar.Count / (double)num_entries_per_line);
                     j++)
                {
                    g.ResetTransform();
                    g.TranslateTransform(left, top);
                    for (int i = 0; i < num_entries_per_line; i++)
                    {
                        if (j * num_entries_per_line + i >= alAntar.Count)
                        {
                            continue;
                        }
                        DasaEntry deAntar = (DasaEntry)alAntar[j * num_entries_per_line + i];
                        s = this.GetDasaString(td, deAntar, bGraha);
                        g.DrawString(s, f_fix_s, b, (i + 1) * entry_width - (float)(entry_width * .5), 0);
                    }
                    top += f_fix_s.Height;
                }
                top += 5;
            }
        }
        private void CheckTimeRange(PerformanceReportType reportType)
        {
            int maxTimerange;

            if (int.TryParse(AppSettings.Get("MobileApi", String.Format("{0}MaxTimeInterval", reportType), false), out maxTimerange))
            {
                var daysDiff = ToDate.Subtract(FromDate).TotalDays;
                if (maxTimerange > 0 && maxTimerange < daysDiff)
                {
                    throw new MobileApiException(String.Format("Invalid date parameters, max time interval allowed for report '{1}' is {0} days. To exceed please change in configuration.", maxTimerange, reportType),
                                                 String.Format("Incorrect Time Selection: Maximum time period for this report is {0} days.", maxTimerange));
                }
            }
        }
        /// <summary>
        /// Implements the execution of <see cref="GetPurchaseReportCommand" />
        /// </summary>
        private async void GetPurchaseReportCommand_Execute(object obj)
        {
            try
            {
                IsReportLoaded    = false;
                IsReportNotLoaded = true;
                PurchaseReportVms = new List <PurchaseReportVm>();
                CrystalReportsViewer ReportViewer = (CrystalReportsViewer)obj;

                data = await Task.Run(async() => await GetPurchaseReport());

                await Task.FromResult(0).ContinueWith(b =>
                {
                    PurchaseReportVms = data.Select(

                        a => new PurchaseReportVm
                    {
                        Beverage       = a.Beverage.Name,
                        PurchaseDate   = a.PurchaseDate,
                        Metric         = a.Metric.ToString(),
                        Quantity       = a.Quantity,
                        UnitPrice      = a.UnitPrice,
                        FromDate       = FromDate.ToLongDateString(),
                        ToDate         = ToDate.ToLongDateString(),
                        Rate           = a.Rate,
                        MetricQuantity = a.MetricQuantity,
                        LineTotalAmout = a.Quantity * a.UnitPrice,
                        //Supplier=a.Supplier.SupplierName
                    }).ToList();
                });

                await System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                                                                (ThreadStart) delegate

                {
                    IsReportLoaded    = true;
                    IsReportNotLoaded = false;
                    if (PurchaseReportVms.Count < 1)
                    {
                        MessageBox.Show("No Report");
                        return;
                    }
                    report.SetDataSource(PurchaseReportVms);
                    ReportViewer.ViewerCore.ReportSource = report;
                });
            }catch (Exception ex)
            {
                throw ex;
            }
        }
示例#26
0
        private string GenerateSQL()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(SQLCommands.AllJobs);
            sb.Append(" WHERE CustomerName Like '%" + CustomerName + "%'");
            sb.Append(" AND Programmer Like '%" + DeveloperName + "%'");
            sb.Append(" AND CampaignManager Like '%" + CampaignManagerName + "%'");
            sb.Append(" AND JobStatusId = 3");
            sb.Append(" AND JobCompletedDate >=#" + FromDate.ToString("dd MMM yyyy") + "#");
            sb.Append(" AND JobCompletedDate <=#" + ToDate.ToString("dd MMM yyyy") + "#");
            sb.Append(" ORDER BY " + SortColumnName + " " + SortOrder);
            return(sb.ToString());
        }
示例#27
0
 public IList <KeyValuePair <string, string> > GetValues()
 {
     return(new List <KeyValuePair <string, string> >()
     {
         new KeyValuePair <string, string>("Invoice Id", InvoiceId),
         new KeyValuePair <string, string>("Customer Code", CustomerCode),
         new KeyValuePair <string, string>("Name", Name),
         new KeyValuePair <string, string>("From Date", FromDate.ToString()),
         new KeyValuePair <string, string>("To Date", ToDate.ToString()),
         new KeyValuePair <string, string>("Invoice Value", InvoiceValue.ToString()),
         new KeyValuePair <string, string>("Created User", CreatedUser),
         new KeyValuePair <string, string>("Created Date", CreatedDate),
         new KeyValuePair <string, string>("Last Updated User", LuUser),
         new KeyValuePair <string, string>("Last Updated Date", LuDate)
     });
 }
示例#28
0
        private string GetDasaString(ToDate td, DasaEntry deAntar, bool bGraha)
        {
            string s;

            if (bGraha)
            {
                s = string.Format("{0} {1}", Body.toShortString(deAntar.graha),
                                  td.AddYears(deAntar.startUT).ToDateString());
            }
            else
            {
                s = string.Format("{0} {1}", ZodiacHouse.ToShortString(deAntar.zodiacHouse),
                                  td.AddYears(deAntar.startUT).ToDateString());
            }
            return(s);
        }
示例#29
0
        private async void GetTimeTable(int weekChange)
        {
            IsBusy = true;
            OnPropertyChangedModel(nameof(IsBusy));

            FromDate  = FromDate.AddDays(weekChange);
            ToDate    = ToDate.AddDays(weekChange);
            TimeTable = await _model.GetTimeTable(cookerID, FromDate);

            OnPropertyChangedModel(nameof(TimeTable));
            OnPropertyChangedModel(nameof(FromDate));
            OnPropertyChangedModel(nameof(ToDate));

            IsBusy = false;
            OnPropertyChangedModel(nameof(IsBusy));
        }
        private void FillChartCasesSwab()
        {
            var dateFrom = FromDate?.Invoke() ?? DateTime.Today;
            var dateTo   = ToDate?.Invoke() ?? DateTime.Today;
            var top      = Top?.Invoke()?.value ?? 5;
            var title    = Properties.Resources.RelationshipCasesSwabs;

            var swab  = DataExtractorRegion.FillRangeData(dateFrom, dateTo, 100, p => p.nuovi_tamponi).OrderBy(p => p.lbl);
            var cases = DataExtractorRegion.FillRangeData(dateFrom, dateTo, 100, p => p.nuovi_positivi).OrderBy(p => p.lbl);

            var data = cases.Zip(swab, (c, s) => new ReturnData()
            {
                lbl   = c.lbl,
                data  = c.data,
                value = c.value / s.value
            })
                       .OrderByDescending(o => o.value)
                       .Take(top)
                       .ToList();


            var Title = dateFrom.Date == dateTo.Date
                ? $"{title} {dateFrom.Date.ToShortDateString()}"
                : $"{title} {Properties.Resources.BetweenDate} {dateFrom.Date.ToString("dd/MM/yy")} {{Properties.Resources.And}} {dateTo.Date.ToString("dd/MM/yy")}";

            Func <ChartPoint, string> labelPoint = chartPoint =>
                                                   string.Format("{0}", chartPoint.Y.ToString("P2"));

            var series = new SeriesCollection();

            foreach (var region in data)
            {
                series.Add(
                    new PieSeries()
                {
                    Title  = region.lbl,
                    Values = new ChartValues <float> {
                        region.value
                    },
                    DataLabels = true,
                    LabelPoint = labelPoint
                });
            }

            this.chart.Series         = series;
            this.chart.LegendLocation = LegendLocation.Right;
        }