public override void VerifySettings() { base.VerifySettings(); this.ThrowIfClassIsPresent("k-grid-rtl", Exceptions.Rtl); if (!IsClientBinding && Scrollable.Enabled && Scrollable.Virtual) { throw new NotSupportedException(Exceptions.CannotUseVirtualScrollWithServerBinding); } if (AutoBind.HasValue) { if (!IsClientBinding || (IsClientBinding && DataSource.Data != null)) { throw new NotSupportedException(Exceptions.CannotSetAutoBindIfBoundDuringInitialization); } } if (Columns.Any(c => c.Locked) && !IsClientBinding) { throw new NotSupportedException(Exceptions.CannotUseLockedColumnsAndServerBinding); } if (IsClientBinding) { if (Columns.OfType <IGridTemplateColumn <T> >().Where(c => c.Template != null && string.IsNullOrEmpty(c.ClientTemplate)).Any()) { throw new NotSupportedException(Exceptions.CannotUseTemplatesInAjaxOrWebService); } if (DetailTemplate != null && DetailTemplate.HasValue() && string.IsNullOrEmpty(ClientDetailTemplateId)) { throw new NotSupportedException(Exceptions.CannotUseTemplatesInAjaxOrWebService); } if (Columns.Any(c => c.Locked)) { if (DetailTemplate != null && DetailTemplate.HasValue() || ClientDetailTemplateId.HasValue()) { throw new NotSupportedException(Exceptions.CannotUseDetailTemplateAndLockedColumns); } if (ClientRowTemplate.HasValue() || RowTemplate != null && RowTemplate.HasValue()) { throw new NotSupportedException(Exceptions.CannotUseRowTemplateAndLockedColumns); } } if (Columns.OfType <IGridActionColumn>().Any(c => c.Commands.OfType <GridCustomActionCommand <T> >().Any(command => command.HasValue()))) { throw new NotSupportedException(Exceptions.CustomCommandRoutesWithAjaxBinding); } } if (!DataKeys.Any() && (Editable.Enabled || (Selectable.Enabled && !IsClientBinding))) { throw new NotSupportedException(Exceptions.DataKeysEmpty); } if (Editable.Enabled) { if (DataSource.Type != DataSourceType.Custom) { if (HasCommandOfType <GridEditActionCommand>()) { if (!DataSource.Transport.Update.HasValue()) { throw new NotSupportedException(Exceptions.EditCommandRequiresUpdate); } } if (HasCommandOfType <GridDestroyActionCommand>()) { if (!DataSource.Transport.Destroy.HasValue() && Editable.Mode != GridEditMode.InCell) { throw new NotSupportedException(Exceptions.DeleteCommandRequiresDelete); } } if (HasCommandOfType <GridToolBarCreateCommand <T> >()) { if (!DataSource.Transport.Create.HasValue() && Editable.Mode != GridEditMode.InCell) { throw new NotSupportedException(Exceptions.InsertCommandRequiresInsert); } } } if (HasCommandOfType <GridToolBarSaveCommand <T> >()) { if (Editable.Mode != GridEditMode.InCell) { throw new NotSupportedException(Exceptions.BatchUpdatesRequireInCellMode); } if (DataSource.Type != DataSourceType.Custom) { if (!DataSource.Transport.Update.HasValue()) { throw new NotSupportedException(Exceptions.BatchUpdatesRequireUpdate); } } } if (Editable.Mode == GridEditMode.InCell) { if (!IsClientBinding) { throw new NotSupportedException(Exceptions.InCellModeNotSupportedInServerBinding); } if (ClientRowTemplate.HasValue() || ClientAltRowTemplate.HasValue() || RowTemplate.HasValue()) { throw new NotSupportedException(Exceptions.InCellModeNotSupportedWithRowTemplate); } } if (typeof(T) == typeof(System.Data.DataRowView) && Editable.Mode == GridEditMode.InLine && Columns.OfType <IGridBoundColumn>().Where(c => c.EditorTemplateName.HasValue()).Any()) { throw new NotSupportedException(Exceptions.DataTableInLineEditingWithCustomEditorTemplates); } if (typeof(T) == typeof(System.Data.DataRowView) && Editable.Mode == GridEditMode.PopUp && !Editable.TemplateName.HasValue()) { throw new NotSupportedException(Exceptions.DataTablePopUpTemplate); } } }
public override void ViewDidLoad() { var scrollView = new UIScrollView() { BackgroundColor = UIColor.White, ShowsHorizontalScrollIndicator = false, AutoresizingMask = UIViewAutoresizing.FlexibleHeight, }; View = scrollView; scrollView.TranslatesAutoresizingMaskIntoConstraints = true; base.ViewDidLoad(); // ios7 layout if (RespondsToSelector(new Selector("edgesForExtendedLayout"))) { EdgesForExtendedLayout = UIRectEdge.None; } var _forceTheWidthView = new UIView() { BackgroundColor = UIColor.Clear }; Add(_forceTheWidthView); var fNameLabel = new UILabel { Text = "First" }; Add(fNameLabel); var sNameLabel = new UILabel { Text = "Last" }; Add(sNameLabel); var numberLabel = new UILabel { Text = "#" }; Add(numberLabel); var streetLabel = new UILabel { Text = "Street" }; Add(streetLabel); var townLabel = new UILabel { Text = "Town" }; Add(townLabel); var zipLabel = new UILabel { Text = "Zip" }; Add(zipLabel); var fNameField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(fNameField); var sNameField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(sNameField); var numberField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(numberField); var streetField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(streetField); var townField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(townField); var zipField = new UITextField() { BackgroundColor = UIColor.LightGray, BorderStyle = UITextBorderStyle.RoundedRect }; Add(zipField); _debugLabel = new UILabel() { BackgroundColor = UIColor.White, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap }; Add(_debugLabel); var set = this.CreateBindingSet <FormGridView, FormGridViewModel>(); set.Bind(fNameField).To(vm => vm.FirstName); set.Bind(sNameField).To(vm => vm.LastName); set.Bind(numberField).To(vm => vm.Number); set.Bind(streetField).To(vm => vm.Street); set.Bind(townField).To(vm => vm.Town); set.Bind(zipField).To(vm => vm.Zip); set.Bind(_debugLabel).To("FirstName + ' ' + LastName + ', ' + Number + ' ' + Street + ' ' + Town + ' ' + Zip"); set.Apply(); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); var rowSet = new RowSetTemplate() { TopMargin = 10f, BottomMargin = 20f, VInterspacing = 10f }; var equalWeightRowTemplate = new RowTemplate() { HInterspacing = 12f, LeftMargin = 6f, RightMargin = 24f }; var addressRowTemplate = new RowTemplate() { HInterspacing = 12f, LeftMargin = 6f, RightMargin = 24f }; addressRowTemplate.ColumnWeight(0, 0.3f); var townAndZipRowTemplate = new RowTemplate() { HInterspacing = 12f, LeftMargin = 6f, RightMargin = 24f }; townAndZipRowTemplate.ColumnWidth(1, 120f); View.AddConstraints( rowSet.Generate(View, new Row(equalWeightRowTemplate, _forceTheWidthView), new Row(equalWeightRowTemplate, fNameLabel, sNameLabel), new Row(equalWeightRowTemplate, fNameField, sNameField), new Row(addressRowTemplate, numberLabel, streetLabel), new Row(addressRowTemplate, numberField, streetField), new Row(townAndZipRowTemplate, townLabel, zipLabel), new Row(townAndZipRowTemplate, townField, zipField), new Row(equalWeightRowTemplate, _debugLabel) )); View.AddConstraints(_forceTheWidthView.Width().EqualTo().WidthOf(View).Minus(30f)); }
/// <summary> /// Format the letter for the donor with all the gifts /// /// Can also used for a single receipt. /// </summary> /// <returns>One or more html documents, each in its own body tag, for printing with the HTML printer</returns> private static string FormatLetter(Int64 ADonorKey, string ADonorName, DataTable ADonations, string ABaseCurrency, string AHTMLTemplate, string ALedgerCountryCode, TDBTransaction ATransaction) { // get details of the donor, and best address PLocationTable Location; PPartnerLocationTable PartnerLocation; string CountryName; string EmailAddress; if (!TAddressTools.GetBestAddress(ADonorKey, out Location, out PartnerLocation, out CountryName, out EmailAddress, ATransaction)) { return(""); } bool TaxDeductiblePercentageEnabled = Convert.ToBoolean( TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, "FALSE")); string msg = AHTMLTemplate; if (ADonorName.Contains(",")) { msg = msg.Replace("#TITLE", Calculations.FormatShortName(ADonorName, eShortNameFormat.eOnlyTitle)); } else { // organisations have no title msg = msg.Replace("#TITLE", ""); } msg = msg.Replace("#NAME", Calculations.FormatShortName(ADonorName, eShortNameFormat.eReverseWithoutTitle)); msg = msg.Replace("#STREETNAME", GetStringOrEmpty(Location[0].StreetName)); msg = msg.Replace("#LOCATION", GetStringOrEmpty(Location[0].Locality)); msg = msg.Replace("#ADDRESS3", GetStringOrEmpty(Location[0].Address3)); msg = msg.Replace("#BUILDING1", GetStringOrEmpty(Location[0].Building1)); msg = msg.Replace("#BUILDING2", GetStringOrEmpty(Location[0].Building2)); msg = msg.Replace("#CITY", GetStringOrEmpty(Location[0].City)); msg = msg.Replace("#POSTALCODE", GetStringOrEmpty(Location[0].PostalCode)); msg = msg.Replace("#DATE", DateTime.Now.ToString("d. MMMM yyyy")); // according to German Post, there is no country code in front of the post code // if country code is same for the address of the recipient and this office, then COUNTRYNAME is cleared if (GetStringOrEmpty(Location[0].CountryCode) != ALedgerCountryCode) { msg = msg.Replace("#COUNTRYNAME", CountryName); } else { msg = msg.Replace("#COUNTRYNAME", ""); } // recognise detail lines automatically string RowTemplate; msg = TPrinterHtml.GetTableRow(msg, "#AMOUNT", out RowTemplate); string OrigRowTemplate = RowTemplate; string rowTexts = ""; decimal sum = 0; decimal sumTaxDeduct = 0; decimal sumNonDeduct = 0; decimal prevAmount = 0.0M; decimal prevAmountTaxDeduct = 0.0M; decimal prevAmountNonDeduct = 0.0M; string prevCurrency = String.Empty; string prevCommentOne = String.Empty; string prevAccountDesc = String.Empty; string prevCostCentreDesc = String.Empty; string prevgifttype = string.Empty; DateTime prevDateEntered = DateTime.MaxValue; foreach (DataRow rowGifts in ADonations.Rows) { DateTime dateEntered = Convert.ToDateTime(rowGifts["DateEntered"]); decimal amount = Convert.ToDecimal(rowGifts["TransactionAmount"]); decimal taxDeductibleAmount = 0; decimal nonDeductibleAmount = 0; string currency = rowGifts["Currency"].ToString(); string commentOne = rowGifts["CommentOne"].ToString(); string accountDesc = rowGifts["AccountDesc"].ToString(); string costcentreDesc = rowGifts["CostCentreDesc"].ToString(); string gifttype = rowGifts["GiftType"].ToString(); RowTemplate = OrigRowTemplate; sum += Convert.ToDecimal(rowGifts["AmountInBaseCurrency"]); if (TaxDeductiblePercentageEnabled) { taxDeductibleAmount = Convert.ToDecimal(rowGifts["TaxDeductibleAmount"]); nonDeductibleAmount = Convert.ToDecimal(rowGifts["NonDeductibleAmount"]); sumTaxDeduct += Convert.ToDecimal(rowGifts["TaxDeductibleAmountBase"]); sumNonDeduct += Convert.ToDecimal(rowGifts["NonDeductibleAmountBase"]); } // can we sum up donations on the same date, or do we need to print each detail with the account description? if (RowTemplate.Contains("#COMMENTONE") || RowTemplate.Contains("#ACCOUNTDESC") || RowTemplate.Contains("#COSTCENTREDESC")) { if (gifttype == MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT); } else if (gifttype == MFinanceConstants.GIFT_TYPE_GIFT) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND); } rowTexts += RowTemplate. Replace("#DONATIONDATE", dateEntered.ToString("dd.MM.yyyy")). Replace("#AMOUNTCURRENCY", currency). Replace("#AMOUNT", StringHelper.FormatUsingCurrencyCode(amount, currency)). Replace("#TAXDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(taxDeductibleAmount, currency)). Replace("#TAXNONDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(nonDeductibleAmount, currency)). Replace("#COMMENTONE", commentOne). Replace("#ACCOUNTDESC", accountDesc). Replace("#COSTCENTREDESC", costcentreDesc); } else { if ((dateEntered != prevDateEntered) && (prevDateEntered != DateTime.MaxValue)) { if (prevgifttype == MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT); } else if (prevgifttype == MFinanceConstants.GIFT_TYPE_GIFT) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND); } rowTexts += RowTemplate. Replace("#DONATIONDATE", prevDateEntered.ToString("dd.MM.yyyy")). Replace("#AMOUNTCURRENCY", prevCurrency). Replace("#AMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmount, prevCurrency)). Replace("#TAXDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmountTaxDeduct, prevCurrency)). Replace("#TAXNONDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmountNonDeduct, prevCurrency)). Replace("#COMMENTONE", prevCommentOne). Replace("#ACCOUNTDESC", prevAccountDesc). Replace("#COSTCENTREDESC", prevCostCentreDesc); prevAmount = amount; if (TaxDeductiblePercentageEnabled) { prevAmountTaxDeduct = taxDeductibleAmount; prevAmountNonDeduct = nonDeductibleAmount; } } else { prevAmount += amount; if (TaxDeductiblePercentageEnabled) { prevAmountTaxDeduct += taxDeductibleAmount; prevAmountNonDeduct += nonDeductibleAmount; } } prevCurrency = currency; prevDateEntered = dateEntered; prevCommentOne = commentOne; prevAccountDesc = accountDesc; prevCostCentreDesc = costcentreDesc; prevgifttype = gifttype; } } if (prevDateEntered != DateTime.MaxValue) { RowTemplate = OrigRowTemplate; if (prevgifttype == MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT); } else if (prevgifttype == MFinanceConstants.GIFT_TYPE_GIFT) { RowTemplate = TPrinterHtml.RemoveDivWithClass(RowTemplate, MFinanceConstants.GIFT_TYPE_GIFT_IN_KIND); } rowTexts += RowTemplate. Replace("#DONATIONDATE", prevDateEntered.ToString("dd.MM.yyyy")). Replace("#AMOUNTCURRENCY", prevCurrency). Replace("#AMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmount, prevCurrency)). Replace("#TAXDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmountTaxDeduct, prevCurrency)). Replace("#TAXNONDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(prevAmountNonDeduct, prevCurrency)). Replace("#COMMENTONE", prevCommentOne). Replace("#ACCOUNTDESC", prevAccountDesc). Replace("#COSTCENTREDESC", prevCostCentreDesc); prevAmount = 0.0M; if (TaxDeductiblePercentageEnabled) { prevAmountTaxDeduct = 0.0M; prevAmountNonDeduct = 0.0M; } } msg = msg.Replace("#OVERALLAMOUNTCURRENCY", ABaseCurrency). Replace("#OVERALLAMOUNT", StringHelper.FormatUsingCurrencyCode(sum, ABaseCurrency)). Replace("#OVERALLTAXDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(sumTaxDeduct, ABaseCurrency)). Replace("#OVERALLTAXNONDEDUCTAMOUNT", StringHelper.FormatUsingCurrencyCode(sumNonDeduct, ABaseCurrency)); if ((ADonations.Rows.Count == 1) && msg.Contains("#DONATIONDATE")) { // this is a receipt for just one gift msg = msg.Replace("#DONATIONDATE", Convert.ToDateTime(ADonations.Rows[0]["DateEntered"]).ToString("dd.MM.yyyy")); } // TODO allow other currencies. use a_currency table, and base currency msg = msg.Replace("#TOTALAMOUNTINWORDS", NumberToWords.AmountToWords(sum, "Euro", "Cent")). Replace("#TOTALTAXDEDUCTAMOUNTINWORDS", NumberToWords.AmountToWords(sumTaxDeduct, "Euro", "Cent")). Replace("#TOTALTAXNONDEDUCTAMOUNTINWORDS", NumberToWords.AmountToWords(sumNonDeduct, "Euro", "Cent")); return(msg.Replace("#ROWTEMPLATE", rowTexts)); }
public async Task DeleteAsync(RowTemplate rowTemplate) { _context.RowTemplates.Update(rowTemplate); await _context.SaveChangesAsync(); }
public async Task AddAsync(RowTemplate rowTemplate) { await _context.RowTemplates.AddAsync(rowTemplate); await _context.SaveChangesAsync(); }
public override void VerifySettings() { base.VerifySettings(); this.ThrowIfClassIsPresent("t-grid-rtl", TextResource.Rtl); if (Ajax.Enabled && WebService.Enabled) { throw new NotSupportedException(TextResource.CannotUseAjaxAndWebServiceAtTheSameTime); } if (IsClientBinding) { if (Columns.OfType <IGridTemplateColumn <T> >().Where(c => c.Template != null && string.IsNullOrEmpty(c.ClientTemplate)).Any()) { throw new NotSupportedException(TextResource.CannotUseTemplatesInAjaxOrWebService); } if (DetailView != null && DetailView.Template.HasValue() && !DetailView.ClientTemplate.HasValue()) { throw new NotSupportedException(TextResource.CannotUseTemplatesInAjaxOrWebService); } } if (Paging.PageOnScroll) { if (!Paging.Enabled) { throw new NotSupportedException(TextResource.PagingMustBeEnabledToUsePageOnScroll); } if (!Scrolling.Enabled) { throw new NotSupportedException(TextResource.ScrollingMustBeEnabledToUsePageOnScroll); } if (!IsClientBinding) { throw new NotSupportedException(TextResource.CannotUsePageOnScrollWithServerBinding); } } if (WebService.Enabled && string.IsNullOrEmpty(WebService.Select.Url)) { throw new ArgumentException(TextResource.WebServiceUrlRequired); } if (!DataKeys.Any() && (Editing.Enabled || (Selection.Enabled && !IsClientBinding))) { throw new NotSupportedException(TextResource.DataKeysEmpty); } if (Editing.Enabled) { if (HasCommandOfType <GridEditActionCommand>()) { if (!CurrrentBinding.Update.HasValue()) { throw new NotSupportedException(TextResource.EditCommandRequiresUpdate); } } if (HasCommandOfType <GridDeleteActionCommand>()) { if (!CurrrentBinding.Delete.HasValue() && Editing.Mode != GridEditMode.InCell) { throw new NotSupportedException(TextResource.DeleteCommandRequiresDelete); } } if (HasCommandOfType <GridToolBarInsertCommand <T> >()) { if (!CurrrentBinding.Insert.HasValue() && Editing.Mode != GridEditMode.InCell) { throw new NotSupportedException(TextResource.InsertCommandRequiresInsert); } } if (HasCommandOfType <GridToolBarSubmitChangesCommand <T> >()) { if (Editing.Mode != GridEditMode.InCell) { throw new NotSupportedException(TextResource.BatchUpdatesRequireInCellMode); } if (!CurrrentBinding.Update.HasValue()) { throw new NotSupportedException(TextResource.BatchUpdatesRequireUpdate); } } #if MVC2 || MVC3 if (Editing.Mode == GridEditMode.InCell) { if (!Ajax.Enabled && !WebService.Enabled) { throw new NotSupportedException(TextResource.InCellModeNotSupportedInServerBinding); } if (ClientRowTemplate.HasValue() || RowTemplate.HasValue()) { throw new NotSupportedException(TextResource.InCellModeNotSupportedWithRowTemplate); } } if (typeof(T) == typeof(System.Data.DataRowView) && Editing.Mode == GridEditMode.InLine && Columns.OfType <IGridBoundColumn>().Where(c => c.EditorTemplateName.HasValue()).Any()) { throw new NotSupportedException(TextResource.DataTableInLineEditingWithCustomEditorTemplates); } #endif } }
/// <summary> /// Inserts an ortheme-row. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnRowInsert_ort(object sender, EventArgs e) { string pos; int p1; if (Rows.Count != 1) { if (_r == Rows.Count - 1) // is last (ie. default) row { pos = Table.Rows[_r - 1][0].ToString(); p1 = 1; } else { pos = Table.Rows[_r][0].ToString(); p1 = 0; } int posSeparator = pos.IndexOf('.'); pos = pos.Substring(0, posSeparator); p1 += Int32.Parse(pos); } else // has only a default row { p1 = 0; } var row = RowTemplate.Clone() as DataGridViewRow; // insert row in DataGridView -> row.CreateCells(this, String.Empty, String.Empty, String.Empty); Rows.Insert(_r, row); Rows[_r].HeaderCell.Value = p1 + ".0"; DataRow dr = Table.NewRow(); // insert row in the DataTable -> dr[0] = p1 + ".0"; for (int i = 1; i != Table.Columns.Count; ++i) { dr[i] = String.Empty; } Table.Rows.InsertAt(dr, _r); if (_sil) { _sil = false; Rows[_r].Cells[0].Value = Table.Rows[_r][1] = StaticData.SIL; } for (++_r; _r != Table.Rows.Count; ++_r) // advance the post-insert rows -> { if (Utility.isWordstart(pos = Table.Rows[_r][0].ToString())) { ++p1; } int posSeparator = pos.IndexOf('.'); pos = pos.Substring(posSeparator); Rows[_r].HeaderCell.Value = // in DataGridView Table.Rows[_r][0] = p1 + pos; // in the DataTable } }