本文整理汇总了C#中System.Data.DataColumnChangeEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataColumnChangeEventArgs类的具体用法?C# DataColumnChangeEventArgs怎么用?C# DataColumnChangeEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataColumnChangeEventArgs类属于System.Data命名空间,在下文中一共展示了DataColumnChangeEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateColumn
void ValidateColumn(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.Equals(this.patientidColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || ((int)e.ProposedValue < 0))
{
throw new ArgumentException(string.Format("{0} kan inte vara null eller negativt.", e.Column.ColumnName), e.Column.ColumnName);
}
}
if (e.Column.Equals(this.startdatetimeColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || (((DateTime)e.ProposedValue).Year == DateTime.MinValue.Year) || (((DateTime)e.ProposedValue).Year == DateTime.MaxValue.Year))
{
throw new ArgumentException(string.Format("{0} är inte ett giltigt datum.", e.Column.ColumnName), "frikortsdatum");
}
}
if (e.Column.Equals(this.titleColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || ((string)e.ProposedValue).Length == 0)
{
throw new ArgumentException(string.Format("{0} kan inte vara null eller tom.", e.Column.ColumnName), e.Column.ColumnName);
}
}
}
示例2: custTable_ColumnChanging
private void custTable_ColumnChanging(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.ColumnName.ToUpper() == "MIN" && e.ProposedValue is int && (int)e.ProposedValue < 0)
{
throw new ApplicationException("Min must be >= 0");
}
}
示例3: VerifyUnitData
/// <summary>
/// todoComment
/// </summary>
/// <param name="e"></param>
/// <param name="AMainDS"></param>
/// <param name="AVerificationResult"></param>
/// <returns></returns>
public static Boolean VerifyUnitData(DataColumnChangeEventArgs e, PartnerEditTDS AMainDS, out TVerificationResult AVerificationResult)
{
Boolean ReturnValue;
AVerificationResult = null;
if (e.Column.ColumnName == PUnitTable.GetUnitNameDBName())
{
VerifyUnitNameChange(e, AMainDS, out AVerificationResult);
}
// any verification errors?
if (AVerificationResult == null)
{
ReturnValue = true;
}
else
{
ReturnValue = false;
// MessageBox.Show('VerifyUnitData: There was an error!');
}
return ReturnValue;
}
示例4: OnColumnChanging
protected override void OnColumnChanging(DataColumnChangeEventArgs e)
{
if (mCanWrite)
{
(e.Row as DataRowEx).OnRowChanged();
}
base.OnColumnChanging(e);
}
示例5: OnColumnChanging
protected override void OnColumnChanging(DataColumnChangeEventArgs e)
{
if (e.Column.ColumnName == "Age")
{
if ((int)e.ProposedValue < 0 || (int)e.ProposedValue > 100)
{
e.Row.SetColumnError("Age", "나이는 0 ~ 100 사이여야 합니다.");
}
else
{
e.Row.SetColumnError("Age", "");
}
}
}
示例6: tblPeople_ColumnChanging
//* 컬럼 에러 설정
void tblPeople_ColumnChanging(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.ColumnName == "Age")
{
if ((int)e.ProposedValue < 0 || (int)e.ProposedValue > 100)
{
e.Row.SetColumnError("Age", "나이는 0 ~ 100 사이여야 합니다.");
}
else
{
e.Row.SetColumnError("Age", "");
}
}
}
示例7: VerifySubscriptionData
/// <summary>
/// todoComment
/// </summary>
/// <param name="e"></param>
/// <param name="AVerificationResultCollection"></param>
/// <param name="AVerificationResult"></param>
/// <param name="FDataColumnComparedTo"></param>
/// <returns></returns>
public static Boolean VerifySubscriptionData(DataColumnChangeEventArgs e,
TVerificationResultCollection AVerificationResultCollection,
out TVerificationResult AVerificationResult,
out DataColumn FDataColumnComparedTo)
{
Boolean ReturnValue;
AVerificationResult = null;
DataColumn FDataColumnComparedTo2 = null;
if ((e.Column.ColumnName == PSubscriptionTable.GetDateCancelledDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetExpiryDateDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetDateNoticeSentDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetStartDateDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetSubscriptionRenewalDateDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetFirstIssueDBName()) || (e.Column.ColumnName == PSubscriptionTable.GetLastIssueDBName()))
{
VerifySubscriptionDates(e, AVerificationResultCollection, out AVerificationResult, out FDataColumnComparedTo2);
}
FDataColumnComparedTo = FDataColumnComparedTo2;
// if (e.Column.Ordinal = (e.Column.Table as PPartnerLocationTable).ColumnEmailAddress.Ordinal) then
// begin
// VerifyEMailAddress(e, AVerificationResult);
// end;
if ((e.Column.ColumnName == PSubscriptionTable.GetPublicationCopiesDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetNumberIssuesReceivedDBName())
|| (e.Column.ColumnName == PSubscriptionTable.GetNumberComplimentaryDBName()))
{
VerifyInteger(e, out AVerificationResult);
}
// any verification errors?
if (AVerificationResult == null)
{
ReturnValue = true;
}
else
{
ReturnValue = false;
}
return ReturnValue;
}
示例8: BranchTable_ColumnChanged
static void BranchTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.ColumnName == "Push" && (bool)e.ProposedValue)
{
e.Row["Force"] = false;
e.Row["Delete"] = false;
}
if (e.Column.ColumnName == "Force" && (bool)e.ProposedValue)
{
e.Row["Push"] = false;
e.Row["Delete"] = false;
}
if (e.Column.ColumnName == "Delete" && (bool)e.ProposedValue)
{
e.Row["Push"] = false;
e.Row["Force"] = false;
}
}
示例9: ValidateColumn
void ValidateColumn(object sender, DataColumnChangeEventArgs e)
{
if(e.Column.Equals(this.UnitPriceColumn))
{
if(!Convert.IsDBNull(e.ProposedValue) && (decimal)e.ProposedValue < 0)
{
throw new ArgumentException("UnitPrice cannot be less than zero", "UnitPrice");
}
}
else if (e.Column.Equals(this.UnitsInStockColumn) ||
e.Column.Equals(this.UnitsOnOrderColumn) ||
e.Column.Equals(this.ReorderLevelColumn))
{
if (!Convert.IsDBNull(e.ProposedValue) && (short)e.ProposedValue < 0)
{
throw new ArgumentException(string.Format("{0} cannot be less than zero", e.Column.ColumnName), e.Column.ColumnName);
}
}
}
示例10: ReceiptDetailColumn_Changing
private void ReceiptDetailColumn_Changing(object sender, DataColumnChangeEventArgs e)
{
if (e.Column == mDataSet.ReceiptDetail.PricePurchaseColumn)
{
// MessageBox.Show(e.ProposedValue.ToString());
}
if (e.Column == mDataSet.ReceiptDetail.QuantityColumn)
{
MDataSet.RemainsRow remainsRow = (e.Row as MDataSet.ReceiptDetailRow).RemainsRow;
if (((e.Row as MDataSet.ReceiptDetailRow).Quantity - remainsRow.QuantityRemains) > ((decimal)e.ProposedValue))
{
MessageBox.Show("Товара уже продано больше!");
e.ProposedValue = (e.Row as MDataSet.ReceiptDetailRow).Quantity;
}
else
remainsRow.QuantityRemains += (decimal)e.ProposedValue - (e.Row as MDataSet.ReceiptDetailRow).Quantity;
}
}
示例11: VerifyPartnerLocationData
/// <summary>
/// todoComment
/// </summary>
/// <param name="e"></param>
/// <param name="AVerificationResultCollection"></param>
/// <param name="AVerificationResult"></param>
/// <returns></returns>
public static Boolean VerifyPartnerLocationData(DataColumnChangeEventArgs e,
TVerificationResultCollection AVerificationResultCollection,
out TVerificationResult AVerificationResult)
{
Boolean ReturnValue;
AVerificationResult = null;
// MessageBox.Show('Verifying DataRow...');
if ((e.Column.ColumnName == PPartnerLocationTable.GetDateEffectiveDBName())
|| (e.Column.ColumnName == PPartnerLocationTable.GetDateGoodUntilDBName()))
{
VerifyDates(e, AVerificationResultCollection, out AVerificationResult);
}
if (e.Column.Ordinal == ((PPartnerLocationTable)e.Column.Table).ColumnEmailAddress.Ordinal)
{
VerifyEmailAddress(e, out AVerificationResult);
}
if (e.Column.Ordinal == ((PPartnerLocationTable)e.Column.Table).ColumnLocationType.Ordinal)
{
VerifyLocationType(e, out AVerificationResult);
}
// any verification errors?
if (AVerificationResult == null)
{
ReturnValue = true;
}
else
{
ReturnValue = false;
// MessageBox.Show('VerifyPartnerLocationData: There was an error!');
}
return ReturnValue;
}
示例12: ValidateColumn
void ValidateColumn(object sender, DataColumnChangeEventArgs e)
{
if (e.Column.Equals(this.personnumberColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || ((string)e.ProposedValue).Length == 0)
{
throw new ArgumentException(string.Format("{0} kan inte vara null eller tom.", e.Column.ColumnName), "personnumret");
}
}
if (e.Column.Equals(this.freecarddateColumn))
{
if (!Convert.IsDBNull(e.ProposedValue))
{
if (((DateTime.Parse((string)e.ProposedValue)).Year == DateTime.MinValue.Year) || ((DateTime.Parse((string)e.ProposedValue)).Year == DateTime.MaxValue.Year))
{
throw new ArgumentException(string.Format("{0} är inte ett giltigt datum.", e.Column.ColumnName), e.Column.ColumnName);
}
}
}
if (e.Column.Equals(this.surnameColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || ((string)e.ProposedValue).Length == 0)
{
throw new ArgumentException(string.Format("{0} kan inte vara null eller tom.", e.Column.ColumnName), "efternamnet");
}
}
if (e.Column.Equals(this.firstnameColumn))
{
if (Convert.IsDBNull(e.ProposedValue) || ((string)e.ProposedValue).Length == 0)
{
throw new ArgumentException(string.Format("{0} kan inte vara null eller tom.", e.Column.ColumnName), "efternamnet");
}
}
}
示例13: myReceiptMasterTable_ColumnChanged
private void myReceiptMasterTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
{
if (IsColumnChangedDisable())
return;
if (System.String.Compare(e.Column.ColumnName, "strDiscountCode", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "DiscountAmt", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "mVoucherAmount", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "mNettAmount", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "mGSTAmount", true) == 0)
{
DisableColumnChanged();
try
{
RecalculateAll();
}
finally
{
EnableColumnChanged();
}
}
else if (System.String.Compare(e.Column.ColumnName, "nSalesPersonID", true) == 0)
{
DisableColumnChanged();
try
{
TblEmployee employee = new TblEmployee();
employee.NEmployeeID = ACMS.Convert.ToInt32(myReceiptMasterTable.Rows[0]["nSalesPersonID"]);
employee.SelectOne();
if (employee.StrEmployeeName.IsNull)
e.Row["strSalesPersonName"] = DBNull.Value;
else
e.Row["strSalesPersonName"] = employee.StrEmployeeName.Value;
}
finally
{
EnableColumnChanged();
}
}
else if (System.String.Compare(e.Column.ColumnName, "nTherapistID", true) == 0)
{
DisableColumnChanged();
try
{
TblEmployee employee = new TblEmployee();
employee.NEmployeeID = ACMS.Convert.ToInt32(myReceiptMasterTable.Rows[0]["nTherapistID"]);
employee.SelectOne();
if (employee.StrEmployeeName.IsNull)
e.Row["strTherapistName"] = DBNull.Value;
else
e.Row["strTherapistName"] = employee.StrEmployeeName.Value;
}
finally
{
EnableColumnChanged();
}
}
else if (System.String.Compare(e.Column.ColumnName, "strReceiptNo", true) == 0)
{
ChangeReceipNo();
}
}
示例14: myReceiptItemsTable_ColumnChanged
private void myReceiptItemsTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
{
if (IsColumnChangedDisable())
return;
connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
connection = new SqlConnection(connectionString);
if (System.String.Compare(e.Column.ColumnName, "strDiscountCode", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "mUnitPrice", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "nQuantity", true) == 0 ||
System.String.Compare(e.Column.ColumnName, "DiscountAmt", true) == 0 )
{
DisableColumnChanged();
//BeginGridUpdate();
try
{
if (myCategoryID != 11 && myCategoryID != 12)
{
if (ACMS.Convert.ToInt32(e.Row["nQuantity"]) < 0)
{
e.Row["nQuantity"] = 0;
}
}
else
{
string strSQL = "SELECT nQty from tblSCStockRecon where strProductCode='" + e.Row["strCode"] + "' AND strBranchCode='" + myBranchCode + "' ";
DataSet _ds = new DataSet();
SqlHelper.FillDataset(connection, CommandType.StoredProcedure, "UP_GETDATA", _ds, new string[] { "table" }, new SqlParameter("@strSQL", strSQL));
if (_ds.Tables["table"].Rows.Count > 0 && e.Row["nQuantity"].ToString() != "")
{
if (Convert.ToInt16(e.Row["nQuantity"]) > Convert.ToInt16(_ds.Tables["table"].Rows[0]["nQty"]))
{
MessageBox.Show("Quantity entered greater than stock quantity ( " + _ds.Tables["table"].Rows[0]["nQty"].ToString() + " )", "Warning", MessageBoxButtons.OK);
e.Row["nQuantity"] = Convert.ToInt16(_ds.Tables["table"].Rows[0]["nQty"]);
return;
}
}
_ds.Dispose();
}
CalculateSubTotal(e.Row);
RecalculateAll();
}
finally
{
//EndGridUpdate();
EnableColumnChanged();
}
}
else if (System.String.Compare(e.Column.ColumnName, "StrReferenceNo", true) == 0)
{
StrReferenceNo = e.Row["StrReferenceNo"].ToString();
}
}
示例15: m_dtShiftSetting_ColumnChanged
private void m_dtShiftSetting_ColumnChanged(object sender, DataColumnChangeEventArgs e)
{
DirtyData = true;
}