private bool PreDeleteManual(PPublicationCostRow ARowToDelete, ref string ADeletionQuestion) { ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); ADeletionQuestion += String.Format("{0}{0}({1} {2}, {3} {4})", Environment.NewLine, lblDetailPublicationCode.Text, cmbDetailPublicationCode.GetSelectedString(), lblDetailDateEffective.Text, dtpDetailDateEffective.Date.Value.ToString("dd-MMM-yyyy").ToUpper()); return(true); }
private void NewRowManual(ref PPublicationCostRow ARow) { // Deal with primary key. It is combination of a code and a effective date // Start by finding a code that does not have today's date Type DataTableType; // Load Data PPublicationTable allPublications = new PPublicationTable(); DataTable CacheDT = TDataCache.GetCacheableDataTableFromCache("PublicationList", String.Empty, null, out DataTableType); allPublications.Merge(CacheDT); bool bFound = false; for (int i = 0; i < allPublications.Rows.Count; i++) { string tryCode = allPublications.Rows[i][0].ToString(); if (FMainDS.PPublicationCost.Rows.Find(new object[] { tryCode, DateTime.Today }) == null) { ARow.PublicationCode = tryCode; bFound = true; break; } } if (!bFound) { // use the first Publication and the first unused date string tryCode = allPublications.Rows[0][0].ToString(); for (int i = 1;; i++) { DateTime tryDate = DateTime.Today.AddDays(i); if (FMainDS.PPublicationCost.Rows.Find(new object[] { tryCode, tryDate }) == null) { ARow.PublicationCode = tryCode; ARow.DateEffective = tryDate; break; } } } if (FPreviouslySelectedDetailRow == null) { ARow.CurrencyCode = FLedgerBaseCurrency; } else { ARow.CurrencyCode = FPreviouslySelectedDetailRow.CurrencyCode; } }
private bool PreDeleteManual(PPublicationCostRow ARowToDelete, ref string ADeletionQuestion) { ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); ADeletionQuestion += String.Format("{0}{0}({1} {2}, {3} {4})", Environment.NewLine, lblDetailPublicationCode.Text, cmbDetailPublicationCode.GetSelectedString(), lblDetailDateEffective.Text, dtpDetailDateEffective.Date.Value.ToString("dd-MMM-yyyy").ToUpper()); return true; }