private void EnvelopeDataTable_ColumnChanged(object sender, DataColumnChangeEventArgs e) { if (stayOut) { return; } stayOut = true; EnvelopeRow thisRow = e.Row as EnvelopeRow; string tmp; int maxLen; if (e.Column.ColumnName == "name") { tmp = e.ProposedValue as string; maxLen = this.nameColumn.MaxLength; if (tmp.Length > maxLen) { thisRow.name = tmp.Substring(0, maxLen); } } stayOut = false; }
public int myImportEnvelope(string name) { // Check to see if the envelope is already in the map and table. int id; if (name.StartsWith("[")) { name = name.Substring(1, name.Length - 2); } if (string.IsNullOrEmpty(name)) { return(SpclEnvelope.NOENVELOPE); } if (this.envelopeMap.TryGetValue(name, out id)) { return(id); } // else create a new account row. EnvelopeRow newEnvelope = this.Envelope.NewEnvelopeRow(); newEnvelope.name = name; newEnvelope.groupID = SpclEnvelopeGroup.NULL; newEnvelope.closed = false; this.Envelope.AddEnvelopeRow(newEnvelope); this.envelopeMap.Add(name, newEnvelope.id); return(newEnvelope.id); }
///////////////////////// // Internal Events private void EnvelopeDataTable_TableNewRow(object sender, System.Data.DataTableNewRowEventArgs e) { stayOut = true; EnvelopeRow envelopeRow = e.Row as EnvelopeRow; envelopeRow.id = this.newID++; envelopeRow.name = "New Envelope"; envelopeRow.groupID = SpclEnvelope.NULL; envelopeRow.closed = false; stayOut = false; }