/// <summary> /// Provides the description of the model settings for summary (GetFullSummary) /// </summary> /// <param name="formatForParentControl">Use full verbose description</param> /// <returns></returns> public override string ModelSummary(bool formatForParentControl) { string html = ""; html += "\n<div class=\"filter\">"; html += "Perform between "; if (StartMonth == 0) { html += "<span class=\"errorlink\">NOT SET</span>"; } else { html += "<span class=\"setvalueextra\">"; html += StartMonth.ToString() + "</span>"; } html += " and <span class=\"setvalueextra\">"; if (EndMonth == 0) { html += "<span class=\"errorlink\">NOT SET</span>"; } else { html += "<span class=\"setvalueextra\">"; html += EndMonth.ToString() + "</span>"; } html += "</div>"; if (!this.Enabled) { html += " - DISABLED!"; } return(html); }
/// <summary> /// Provides the description of the model settings for summary (GetFullSummary) /// </summary> /// <param name="formatForParentControl">Use full verbose description</param> /// <returns></returns> public override string ModelSummary(bool formatForParentControl) { using (StringWriter htmlWriter = new StringWriter()) { htmlWriter.Write("\r\n<div class=\"filter\">"); htmlWriter.Write("Perform between "); if (StartMonth == 0) { htmlWriter.Write("<span class=\"errorlink\">NOT SET</span>"); } else { htmlWriter.Write("<span class=\"setvalueextra\">"); htmlWriter.Write(StartMonth.ToString() + "</span>"); } htmlWriter.Write(" and <span class=\"setvalueextra\">"); if (EndMonth == 0) { htmlWriter.Write("<span class=\"errorlink\">NOT SET</span>"); } else { htmlWriter.Write("<span class=\"setvalueextra\">"); htmlWriter.Write(EndMonth.ToString() + "</span>"); } htmlWriter.Write("</div>"); if (!this.Enabled) { htmlWriter.Write(" - DISABLED!"); } return(htmlWriter.ToString()); } }
public void InitializeDdlSettingWindow(Ddl ddl) { InitializeComponent(); DdlNameTextBox.Text = ddl.Name; DdlPriority.Value = ddl.Priority; InitializeStartTime(ddl.StartTime); ChineseCheckbox.IsChecked = ddl.IsChineseCalender; InitializeEndTime(ddl.EndTime); var format = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern; if (format == "M/d/yyyy") { StartMonth.SetValue(Grid.ColumnProperty, 0); StartDay.SetValue(Grid.ColumnProperty, 1); StartYear.SetValue(Grid.ColumnProperty, 2); EndMonth.SetValue(Grid.ColumnProperty, 0); EndDay.SetValue(Grid.ColumnProperty, 1); EndYear.SetValue(Grid.ColumnProperty, 2); } else if (format == "d/M/yyyy") { StartDay.SetValue(Grid.ColumnProperty, 0); StartMonth.SetValue(Grid.ColumnProperty, 1); StartYear.SetValue(Grid.ColumnProperty, 2); EndDay.SetValue(Grid.ColumnProperty, 0); EndMonth.SetValue(Grid.ColumnProperty, 1); EndYear.SetValue(Grid.ColumnProperty, 2); } LoopCheckbox.IsChecked = ddl.IsLoop; if (ddl.IsLoop) { InitializeLoopinterval(ddl.LoopInterval); } NoticeCheckbox.IsChecked = (ddl.Inform[0] == '1'); WindowCheckbox.IsChecked = (ddl.Inform[1] == '1'); SoundCheckbox.IsChecked = (ddl.Inform[2] == '1'); RemindCheckbox.IsChecked = ddl.IsRemind != -1; if (ddl.IsRemind != -1) { InitializeRemind(ddl.RemindInterval, ddl.RemindTime); } if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name != "zh-CN") { ChineseCheckbox.Visibility = Visibility.Hidden; ChineseCheckbox.IsEnabled = false; } }
public override int GetHashCode() { int hash = 1; if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Applicant.Length != 0) { hash ^= Applicant.GetHashCode(); } if (CompanyName.Length != 0) { hash ^= CompanyName.GetHashCode(); } if (CountryCode.Length != 0) { hash ^= CountryCode.GetHashCode(); } if (Location.Length != 0) { hash ^= Location.GetHashCode(); } if (JobTitle.Length != 0) { hash ^= JobTitle.GetHashCode(); } if (JobDescription.Length != 0) { hash ^= JobDescription.GetHashCode(); } if (StartMonth != 0) { hash ^= StartMonth.GetHashCode(); } if (StartYear != 0) { hash ^= StartYear.GetHashCode(); } if (EndMonth != 0) { hash ^= EndMonth.GetHashCode(); } if (EndYear != 0) { hash ^= EndYear.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public SetIntendedShipmentInfoForNotification ToRequest(Guid notificationId) { DateTime startDate; SystemTime.TryParse(StartYear.GetValueOrDefault(), StartMonth.GetValueOrDefault(), StartDay.GetValueOrDefault(), out startDate); DateTime endDate; SystemTime.TryParse(EndYear.GetValueOrDefault(), EndMonth.GetValueOrDefault(), EndDay.GetValueOrDefault(), out endDate); return(new SetIntendedShipmentInfoForNotification( notificationId, int.Parse(NumberOfShipments, NumberStyles.AllowThousands), Convert.ToDecimal(Quantity), Units.GetValueOrDefault(), startDate, endDate)); }
public override int GetHashCode() { int hash = 1; if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Applicant.Length != 0) { hash ^= Applicant.GetHashCode(); } if (Skill.Length != 0) { hash ^= Skill.GetHashCode(); } if (SkillLevel.Length != 0) { hash ^= SkillLevel.GetHashCode(); } if (StartMonth != 0) { hash ^= StartMonth.GetHashCode(); } if (StartYear != 0) { hash ^= StartYear.GetHashCode(); } if (EndMonth != 0) { hash ^= EndMonth.GetHashCode(); } if (EndYear != 0) { hash ^= EndYear.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { DateTime startDate; bool isValidStartDate = SystemTime.TryParse(StartYear.GetValueOrDefault(), StartMonth.GetValueOrDefault(), StartDay.GetValueOrDefault(), out startDate); if (!isValidStartDate) { yield return(new ValidationResult(IndexResources.FromValid, new[] { "StartDay" })); } DateTime endDate; bool isValidEndDate = SystemTime.TryParse(EndYear.GetValueOrDefault(), EndMonth.GetValueOrDefault(), EndDay.GetValueOrDefault(), out endDate); if (!isValidEndDate) { yield return(new ValidationResult(IndexResources.ToValid, new[] { "EndDay" })); } if (!(isValidStartDate && isValidEndDate)) { // Stop further validation if either date is not a valid date yield break; } if (startDate > endDate) { yield return(new ValidationResult(IndexResources.FromDateAfterToDate, new[] { "StartYear" })); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (!IsNumberOfShipmentsValid()) { yield return(new ValidationResult(ShipmentResources.NumberOfShipmentsValid, new[] { "NumberOfShipments" })); } if (!IsQuantityValid() && Units.HasValue) { yield return(new ValidationResult(string.Format(ShipmentResources.DecimalPlacesValid, ShipmentQuantityUnitsMetadata.Precision[Units.Value]), new[] { "Quantity" })); } DateTime startDate; bool isValidStartDate = SystemTime.TryParse(StartYear.GetValueOrDefault(), StartMonth.GetValueOrDefault(), StartDay.GetValueOrDefault(), out startDate); if (!isValidStartDate) { yield return(new ValidationResult(ShipmentResources.FirstDepartureValid, new[] { "StartDay" })); } DateTime endDate; bool isValidEndDate = SystemTime.TryParse(EndYear.GetValueOrDefault(), EndMonth.GetValueOrDefault(), EndDay.GetValueOrDefault(), out endDate); if (!isValidEndDate) { yield return(new ValidationResult(ShipmentResources.LastDepartureValid, new[] { "EndDay" })); } if (!(isValidStartDate && isValidEndDate)) { // Stop further validation if either date is not a valid date yield break; } if (startDate < SystemTime.Now.Date && Status == NotificationStatus.NotSubmitted) { yield return(new ValidationResult(ShipmentResources.FirstDeparturePastDate, new[] { "StartDay" })); } if (startDate > endDate) { yield return(new ValidationResult(ShipmentResources.FirstDepartureBeforeLastDate, new[] { "StartYear" })); } var monthPeriodLength = IsPreconsentedRecoveryFacility ? 36 : 12; if (endDate >= startDate.AddMonths(monthPeriodLength)) { yield return(new ValidationResult(string.Format(ShipmentResources.DepartureDateRange, monthPeriodLength), new[] { "EndYear" })); } }
protected override IEnumerable <ShopProfitEntity> SearchData() { var oids = OrganizationArray.Select(o => o.ID).ToArray(); var organizations = OrganizationArray.ToArray(); int by = BeginMonth.Year, bm = BeginMonth.Month, ey = EndMonth.Year, em = EndMonth.Month; var endMonth = EndMonth.AddMonths(1); var lp = VMGlobal.DistributionQuery.LinqOP; var retailData = lp.Search <BillRetail>(o => o.CreateTime >= BeginMonth && o.CreateTime < endMonth); var targets = lp.Search <RetailMonthTaget>(o => oids.Contains(o.OrganizationID) && o.Year >= by && o.Month >= bm && o.Year <= ey && o.Month <= em).ToArray(); var expenses = lp.Search <ShopExpense>(o => o.OccurDate >= BeginMonth && o.OccurDate < endMonth && oids.Contains(o.OrganizationID)).ToArray(); if (IsShowShopHasExpensesOnly) { var sids = expenses.Select(o => o.OrganizationID).Intersect(oids).ToArray(); retailData = retailData.Where(o => sids.Contains(o.OrganizationID)); organizations = organizations.Where(o => sids.Contains(o.ID)).ToArray(); } else { retailData = retailData.Where(o => oids.Contains(o.OrganizationID)); } var retails = retailData.Select(o => new { OrganizationID = o.OrganizationID, RetailID = o.ID, QuaRetail = o.Quantity, MoneyRetail = o.CostMoney, RetailTime = o.CreateTime }).ToList(); if (IsShowShopHasRetailOnly) { var rids = retails.Select(o => o.OrganizationID); expenses = expenses.Where(o => rids.Contains(o.OrganizationID)).ToArray(); organizations = organizations.Where(o => rids.Contains(o.ID)).ToArray(); } var rbillIDs = retails.Select(o => o.RetailID).ToArray(); var rDetailData = lp.Search <BillRetailDetails>(o => rbillIDs.Contains(o.BillID)); var productData = lp.GetDataContext <ViewProduct>(); var rDetailQuery = from rDetail in rDetailData from product in productData where rDetail.ProductID == product.ProductID select new { RetailID = rDetail.BillID, rDetail.Price, rDetail.ProductID, rDetail.Quantity, product.BYQID, product.CostPrice }; var rDetails = rDetailQuery.ToList(); List <ShopProfitEntity> result = new List <ShopProfitEntity>(); foreach (var organization in organizations) { var ryms = retails.Where(o => o.OrganizationID == organization.ID).Select(o => new DateTime(o.RetailTime.Year, o.RetailTime.Month, 1)).Distinct(); var eyms = expenses.Where(o => o.OrganizationID == organization.ID).Select(o => new DateTime(o.OccurDate.Year, o.OccurDate.Month, 1)).Distinct(); var yms = ryms.Union(eyms); foreach (var ym in yms) { ShopProfitEntity entity = new ShopProfitEntity { OrganizationID = organization.ID, OrganizationName = organization.Name, YearMonth = ym.ToString("yyyy-MM") }; var target = targets.FirstOrDefault(o => o.OrganizationID == organization.ID && ym.Year == o.Year && ym.Month == o.Month); if (target != null) { entity.MonthTarget = target.SaleTaget; } var tempRetails = retails.Where(o => o.OrganizationID == organization.ID && ym.Year == o.RetailTime.Year && ym.Month == o.RetailTime.Month); entity.SaleQuantity = tempRetails.Sum(o => o.QuaRetail); entity.SaleMoney = tempRetails.Sum(o => o.MoneyRetail); var tempRDetails = rDetails.Where(o => tempRetails.Select(r => r.RetailID).Contains(o.RetailID)); entity.OriginalPrice = tempRDetails.Sum(o => o.Quantity * o.Price); if (VMGlobal.CurrentUser.OrganizationID == 1) { entity.CostPrice = tempRDetails.Sum(o => o.Quantity * o.CostPrice); } else { entity.CostPrice = tempRDetails.Sum(o => o.Quantity * (_fpHelper.GetFloatPrice(OrganizationListVM.CurrentOrganization.ParentID, o.BYQID, o.Price) * _cdhelper.GetDiscount(o.BYQID, VMGlobal.CurrentUser.OrganizationID) * 0.01M)); } // var expense = expenses.FirstOrDefault(o => o.OrganizationID == organization.ID && ym.Year == o.Year && ym.Month == o.Month); // if (expense != null) // { // entity.AdvertisingFee = expense.AdvertisingFee; // entity.BaseCost = expense.BaseCost; // entity.Bonus = expense.Bonus; // entity.ElectricCharge = expense.ElectricCharge; // entity.ExpressCharge = expense.ExpressCharge; // entity.ManagerCost = expense.ManagerCost; // entity.OrganizationID = expense.OrganizationID; // entity.OtherCost = expense.OtherCost; // entity.RenovationCost = expense.RenovationCost; // entity.Rent = expense.Rent; // entity.Salary = expense.Salary; // entity.SocialSecurityCharge = expense.SocialSecurityCharge; // entity.TelephoneCharge = expense.TelephoneCharge; // } result.Add(entity); } } TableData = this.TransferToTable(result, expenses); return(result); }
void ReleaseDesignerOutlets() { if (DatePickerBar != null) { DatePickerBar.Dispose(); DatePickerBar = null; } if (DatePickerVacation != null) { DatePickerVacation.Dispose(); DatePickerVacation = null; } if (DateToolBar != null) { DateToolBar.Dispose(); DateToolBar = null; } if (DoneButton != null) { DoneButton.Dispose(); DoneButton = null; } if (EndDay != null) { EndDay.Dispose(); EndDay = null; } if (EndMonth != null) { EndMonth.Dispose(); EndMonth = null; } if (EndYear != null) { EndYear.Dispose(); EndYear = null; } if (Page != null) { Page.Dispose(); Page = null; } if (PageImage != null) { PageImage.Dispose(); PageImage = null; } if (StartDay != null) { StartDay.Dispose(); StartDay = null; } if (StartMonth != null) { StartMonth.Dispose(); StartMonth = null; } if (StartYear != null) { StartYear.Dispose(); StartYear = null; } if (StatusSegment != null) { StatusSegment.Dispose(); StatusSegment = null; } if (TypeImageView != null) { TypeImageView.Dispose(); TypeImageView = null; } if (TypeText != null) { TypeText.Dispose(); TypeText = null; } if (DatePickerToolbar != null) { DatePickerToolbar.Dispose(); DatePickerToolbar = null; } }
public override int GetHashCode() { unchecked { return(((StartMonth != null ? StartMonth.GetHashCode() : 0) * 397) ^ (EndMonth != null ? EndMonth.GetHashCode() : 0)); } }
public string GetFullMonthNameAndYear() { return(string.Format("{0} to {1}", StartMonth.GetFullMonthNameAndYear(), EndMonth.GetFullMonthNameAndYear())); }