Provides data for the ColumnChanging event.
Наследование: System.EventArgs
Пример #1
0
 /// <summary>
 /// Shared function subscribing to select tables for trunnckating an text colmn to the max
 /// allowed for that column.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ColumnChanging(object sender, System.Data.DataColumnChangeEventArgs e)
 {
     if (e.Column.DataType.Name.Equals("String") && (e.ProposedValue as string).Length > e.Column.MaxLength)
     {
         e.ProposedValue = (e.ProposedValue as string).Substring(0, e.Column.MaxLength);
     }
 }
 private void CustomerAccounts_ColumnChanging(System.Object sender, System.Data.DataColumnChangeEventArgs e)
 {
     // ----- Some columns have special business rules.
     if (e.Column.ColumnName == "AnnualFee")
     {
         // ----- Annual fee may not be negative.
         if (DBNull.Value.Equals(e.ProposedValue) == false)
         {
             if ((decimal)e.ProposedValue < 0m)
             {
                 e.Row.SetColumnError(e.Column, "Annual fee may not be negative.");
             }
         }
     }
     else if (e.Column.ColumnName == "StartDate")
     {
         // ----- Start date must be on or before today.
         if (DBNull.Value.Equals(e.ProposedValue) == false)
         {
             if (((DateTime)e.ProposedValue).Date > DateTime.Today)
             {
                 e.Row.SetColumnError(e.Column, "Start date must occur on or before today.");
             }
         }
     }
 }
Пример #3
0
            //private void CheckAlias(devRow row)
            //{
            //    if (DBNull.Value.Equals(aliasColumn) || aliasColumn.)
            //}

            /// <summary>
            /// Do column's value validation here.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void DevDataTable_ColumnChangedEvent(object sender, System.Data.DataColumnChangeEventArgs e)
            {
                devRow row = e.Row as devRow;

                if (e.Column.ColumnName == tyColumn.ColumnName)
                {
                    CheckType(row);
                }
                if (e.Column.ColumnName == roColumn.ColumnName)
                {
                    CheckAddress(row);
                }
                if (e.Column.ColumnName == ipColumn.ColumnName)
                {
                    CheckIP(row);
                }
                if (e.Column.ColumnName == idColumn.ColumnName)
                {
                    CheckIPCamID(row);
                }
                if (e.Column.ColumnName == pwColumn.ColumnName)
                {
                    CheckIPCamPassword(row);
                }
            }
Пример #4
0
 private void myDetailTable_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
 {
     if (myDetailTableChangedUpdate != null)
     {
         myDetailTableChangedUpdate();
     }
     if (e.Column.ColumnName != "nManagerID")
     {
         e.Row.BeginEdit();
         e.Row["nManagerID"] = mynManagerID;
         e.Row.EndEdit();
     }
     if (e.Column.ColumnName == "dtTime")
     {
         DeleteDetailRowChangeEvent();
         e.Row.BeginEdit();
         DateTime date    = Convert.ToDateTime(e.Row["dtDate"]);
         DateTime time    = Convert.ToDateTime(e.Row["dtTime"]);
         DateTime newDate = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, time.Second,
                                         time.Millisecond);
         e.Row["dtTime"] = newDate;
         e.Row.EndEdit();
         AddDetailRowChangeEvent();
     }
 }
        /// <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;
        }
        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);
                }
            }
        }
Пример #7
0
 private void MantChanged(System.Data.DataColumnChangeEventArgs e)
 {
     foreach (DevExpress.XtraGrid.Columns.GridColumn gcol in _gv.Columns)
     {
         if (gcol.Caption.Contains("HT") && e.Row[e.Column.ColumnName].ToString().Trim() == "VND")
         {
             gcol.Visible = false;
         }
         if (gcol.Caption.Contains("HT") && e.Row[e.Column.ColumnName].ToString().Trim() != "VND")
         {
             gcol.Visible = true;
         }
     }
     foreach (LayoutControlItem l in lo)
     {
         if (l.Text.Contains("HT") && e.Row[e.Column.ColumnName].ToString().Trim() == "VND")
         {
             l.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         }
         if (l.Text.Contains("HT") && e.Row[e.Column.ColumnName].ToString().Trim() != "VND")
         {
             l.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         }
     }
     _gc.Refresh();
 }
		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");
			}
		}
Пример #9
0
 protected override void OnColumnChanging(DataColumnChangeEventArgs e)
 {
     if (mCanWrite)
     {
         (e.Row as DataRowEx).OnRowChanged();
     }
     base.OnColumnChanging(e);
 }
Пример #10
0
        private void CurrentSet_ColumnChanging(object sender, System.Data.DataColumnChangeEventArgs e)
        {
            try
            {
                int    rowPos        = dataGrid1.CurrentCell.RowNumber;
                string currentNumber = e.ProposedValue as string;

                int number = Int32.Parse(currentNumber);
                if ((number < 1) || (number > 9))
                {
                    string errorMessage = "Number should be between 1 and 9";
                    e.Row.SetColumnError(e.Column, errorMessage);
                }
                else
                {
                    int  col           = e.Column.Ordinal;
                    bool answerChanged = _newGame.CheckForAnswerChange(rowPos, col, number);

                    if (answerChanged)
                    {
                        e.ProposedValue = e.Row[e.Column];
                    }
                    else if (_newGame.CheckForDuplicate(rowPos, col, number))
                    {
                        e.Row.SetColumnError(e.Column, "Number is Duplicate");
                        e.Row.AcceptChanges();
                    }
                    else
                    {
                        DataColumn[] columns = e.Row.GetColumnsInError();
                        if (columns.Length == 1)
                        {
                            if (e.Column.Ordinal == columns[0].Ordinal)
                            {
                                e.Row.ClearErrors();
                            }
                        }
                        else
                        {
                            foreach (DataColumn column in columns)
                            {
                                if (e.Column.Ordinal == column.Ordinal)
                                {
                                    e.Row.SetColumnError(e.Column, "");
                                }
                            }
                        }

                        bool answerComplete = IsSolutionComplete();
                    }
                }
            }
            catch (Exception ex)
            {
                e.Row.SetColumnError(e.Column, "Enter valid Number between 1 & 9");
            }
        }
Пример #11
0
 protected override void OnColumnChanging(System.Data.DataColumnChangeEventArgs e)
 {
     //Debug.WriteLine(e.Column.ColumnName);
     //DataRow r = e.Row;
     //r[this.UserModifierColumn.ColumnName] = "plamend";
     //r[this.ApplicationColumn.ColumnName] = 1;
     //r[this.ApplicationColumn.ColumnName] = 1;
     //Debug.WriteLine(e.ProposedValue.ToString());
     base.OnColumnChanging(e);
 }
 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", "");
         }
     }
 }
        private void TableChanged(object sender, System.Data.DataColumnChangeEventArgs e)
        {
            string errors = Program.StoreDB.ValidateProduct(e.Row);

            if (errors == "")
            {
                errFlag = false;
            }
            else
            {
                errFlag = true;
            }
            lblStatus.Text = errors;
        }
Пример #14
0
 //* 컬럼 에러 설정
 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", "");
         }
     }
 }
Пример #15
0
        /// <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;
        }
Пример #16
0
        public static void CheckRowColumn(DataRowChangeEventArgs e, DataColumnChangeEventHandler columnChecker)
        {
            if (e.Action == System.Data.DataRowAction.Add || e.Action == System.Data.DataRowAction.Change)
            {
                if (e.Row.RowState != System.Data.DataRowState.Deleted)
                {
                    DataColumn currentcol          = null;
                    DataColumnChangeEventArgs args = null;

                    foreach (System.Data.DataColumn col in e.Row.Table.Columns)
                    {
                        currentcol = col;
                        args       = new System.Data.DataColumnChangeEventArgs(e.Row, currentcol, e.Row[currentcol]);
                        columnChecker(null, args);
                    }
                }
            }
        }
Пример #17
0
 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;
     }
 }
 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);
         }
     }
 }
Пример #19
0
        /// <include file='doc\DataRow.uex' path='docs/doc[@for="DataRow.this2"]/*' />
        /// <devdoc>
        ///    <para>Gets or sets
        ///       the data stored in the specified <see cref='System.Data.DataColumn'/>.</para>
        /// </devdoc>
        public object this[DataColumn column] {
            get {
                return(this[column, DataRowVersion.Default]);
            }
            set {
                CheckColumn(column);

#if DEBUG
                if (CompModSwitches.Data_ColumnChange.TraceVerbose)
                {
                    Debug.WriteLine("Data_ColumnDataChange - rowID: " + (rowID) + ", columnName: " + column.ColumnName + ", value: <" + Convert.ToString(value) + ">");
                }
#endif
                if (inChangingEvent)
                {
                    throw ExceptionBuilder.EditInRowChanging();
                }

                // allow users to tailor the proposed value, or throw an exception.
                // note we intentionally do not try/catch this event.
                DataColumnChangeEventArgs e = new DataColumnChangeEventArgs(this, column, value);
                Table.RaiseColumnChanging(this, e);

                // Check null
                if (e.ProposedValue == null && column.DataType != typeof(String))
                {
                    throw ExceptionBuilder.CannotSetToNull(column);
                }

                bool immediate = (tempRecord == -1);
                if (immediate)
                {
                    BeginEdit(); // for now force the update.  let's try to improve this later.
                }
                column[GetProposedRecordNo()] = e.ProposedValue;
                Table.RaiseColumnChanged(this, e);

                if (immediate)
                {
                    EndEdit();
                }
            }
        }
Пример #20
0
        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;
            }
        }
Пример #21
0
        /// <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;
        }
        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");
                }
            }
        }
Пример #23
0
 void current_session_game_prize_matrix_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
 {
     if (e.Row.RowState == DataRowState.Detached)
     {
         return;
     }
     if (e.Column.ColumnName == "Row DataRow")
     {
         foreach (DataGridViewRow drv in this.Rows)
         {
             DataRow row = e.ProposedValue as DataRow;
             if (row == e.Row)
             {
                 drv.HeaderCell.ValueType = typeof(string);
                 drv.HeaderCell.Value     = e.Row["Row Header"];
                 break;
             }
         }
     }
     if (e.Column.ColumnName == "Row Header")
     {
         foreach (DataGridViewRow drv in this.Rows)
         {
             if (drv.DataGridView.Columns.Contains("Row DataRow"))
             {
                 DataRow row = drv.Cells["Row DataRow"].Value as DataRow;
                 if (row == e.Row)
                 {
                     drv.HeaderCell.ValueType = typeof(string);
                     drv.HeaderCell.Value     = e.Row["Row Header"];
                     break;
                 }
             }
         }
     }
 }
Пример #24
0
 protected internal virtual void OnColumnChanging(DataColumnChangeEventArgs e) {
     // intentionally allow exceptions to bubble up.  We haven't committed anything yet.
     Debug.Assert(e != null, "e should not be null");
     if (onColumnChangingDelegate != null) {
         Bid.Trace("<ds.DataTable.OnColumnChanging|INFO> %d#\n", ObjectID);
         onColumnChangingDelegate(this, e);
     }
 }
Пример #25
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnAnyDataColumnChanging(System.Object sender, DataColumnChangeEventArgs e)
        {
            if (!FNoAutoEnableOfSaving)
            {
//TLogging.Log("Column_Changing Event: Column=" + e.Column.ColumnName +
//                "; Column content=" + e.Row[e.Column.ColumnName].ToString() +
//                "; " + e.ProposedValue.ToString());
                SetChangedFlag();
            }
        }
Пример #26
0
		internal void RaiseOnColumnChanging (DataColumnChangeEventArgs e)
		{
			OnColumnChanging(e);
		}
Пример #27
0
 /// <summary>
 ///     Eventhandler for the datatable of strings
 /// </summary>
 private void stringsTable_ColumnChanging(object sender, DataColumnChangeEventArgs e)
 {
     if (e.Column == e.Column.Table.Columns["Key"])
     {
         DataRow[] foundRows = e.Column.Table.Select("Key='" + e.ProposedValue + "'");
         if (foundRows.Count() > 1
             || (foundRows.Count() == 1 && foundRows[0] != e.Row))
         {
             e.Row["Error"] = true;
             throw new DuplicateNameException(e.Row["Key"].ToString());
         }
         this.Dirty = true;
     }
 }
Пример #28
0
        private void myReceiptPaymentTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
        {
            if (IsColumnChangedDisable())
                return;

            if (System.String.Compare(e.Column.ColumnName, "mAmount", true) == 0)
            {
                DisableColumnChanged();
                //BeginGridUpdate();

                try
                {
                    CalculateOutStanding();
                }
                finally
                {
                    //EndGridUpdate();
                    EnableColumnChanged();
                }
            }
        }
Пример #29
0
        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();
            }
        }
Пример #30
0
 public object this[DataColumn column]
 {
     get
     {
         this.CheckColumn(column);
         int defaultRecord = this.GetDefaultRecord();
         return(column[defaultRecord]);
     }
     set
     {
         this.CheckColumn(column);
         if (this.inChangingEvent)
         {
             throw ExceptionBuilder.EditInRowChanging();
         }
         if ((-1L != this.rowID) && column.ReadOnly)
         {
             throw ExceptionBuilder.ReadOnly(column.ColumnName);
         }
         DataColumnChangeEventArgs e = null;
         if (this._table.NeedColumnChangeEvents)
         {
             e = new DataColumnChangeEventArgs(this, column, value);
             this._table.OnColumnChanging(e);
         }
         if (column.Table != this._table)
         {
             throw ExceptionBuilder.ColumnNotInTheTable(column.ColumnName, this._table.TableName);
         }
         if ((-1L != this.rowID) && column.ReadOnly)
         {
             throw ExceptionBuilder.ReadOnly(column.ColumnName);
         }
         object obj2 = (e != null) ? e.ProposedValue : value;
         if (obj2 == null)
         {
             if (column.IsValueType)
             {
                 throw ExceptionBuilder.CannotSetToNull(column);
             }
             obj2 = DBNull.Value;
         }
         bool flag = this.BeginEditInternal();
         try
         {
             int proposedRecordNo = this.GetProposedRecordNo();
             column[proposedRecordNo] = obj2;
         }
         catch (Exception exception)
         {
             if (ADP.IsCatchableOrSecurityExceptionType(exception) && flag)
             {
                 this.CancelEdit();
             }
             throw;
         }
         this.LastChangedColumn = column;
         if (e != null)
         {
             this._table.OnColumnChanged(e);
         }
         if (flag)
         {
             this.EndEdit();
         }
     }
 }
Пример #31
0
        void CusData_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
        {
            switch (e.Column.Table.TableName.ToLower())
            {
            case "dmvt":
            {
                string mtgroup = "";

                string subgroup = "";
                string type     = "";
                string standard = "";
                string grade    = "";
                string material = "";

                List <string> lst = new List <string>()
                {
                    "mtgroup", "subgroup", "type", "standard", "grade", "material", "numcode"
                };
                if (lst.Contains(e.Column.ColumnName.ToLower()))
                {
                    foreach (CDTGridLookUpEdit g in _glist)
                    {
                        if (g.Data.DsData.Tables[0].PrimaryKey.Length == 0)
                        {
                            g.Data.DsData.Tables[0].PrimaryKey = new DataColumn[] { g.Data.DsData.Tables[0].Columns[g.Data.DrTable["pk"].ToString()] };
                        }
                        DataRow dr;

                        switch (g.fieldName.ToLower())
                        {
                        case "mtgroup":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["mtgroup"].ToString());
                            if (dr != null)
                            {
                                mtgroup = dr["NhomVTCode"].ToString();
                            }
                            break;

                        case "subgroup":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["subgroup"].ToString());
                            if (dr != null)
                            {
                                subgroup = dr["NhomSubCode"].ToString();
                            }
                            break;

                        case "type":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["type"].ToString());
                            if (dr != null)
                            {
                                type = dr["typecode"].ToString();
                            }
                            break;

                        case "standard":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["standard"].ToString());
                            if (dr != null)
                            {
                                standard = dr["Stancode"].ToString();
                            }
                            break;

                        case "grade":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["grade"].ToString());
                            if (dr != null)
                            {
                                grade = dr["GradeName"].ToString();
                            }
                            break;

                        case "material":
                            dr = g.Data.DsData.Tables[0].Rows.Find(e.Row["material"].ToString());
                            if (dr != null)
                            {
                                material = dr["MaterialCode"].ToString();
                            }
                            break;
                        }
                    }
                    e.Row["TenVT"] = mtgroup + subgroup + type + material + standard + grade;

                    string numcode = "";
                    if (e.Row["Numcode"] != DBNull.Value)
                    {
                        numcode = e.Row["Numcode"].ToString();
                    }
                    string tenvt = "";
                    if (e.Row["TenVT"] != DBNull.Value)
                    {
                        tenvt = e.Row["TenVT"].ToString();
                    }
                    e.Row["MaVT"] = tenvt + numcode;
                    e.Row.EndEdit();
                }
            }
            break;
            }
            //ValidMtID(e);
        }
 private void SettingColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
 {
     Console.WriteLine(e);
 }
Пример #33
0
        // These index storing and rowView preservation must be done
        // before the actual row value is changed; thus we can't use
        // RowChanging which accepts "already modified" DataRow.

        private void OnColumnChanged(object sender, DataColumnChangeEventArgs args)
        {               /* not used */
                        //UpdateIndex(true);
        }
Пример #34
0
        void CusData_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
        {
            //Kiem tra theo ten truong
            switch (e.Column.ColumnName.ToLower())
            {
            case "mant":
                MantChanged(e);
                break;

            case "dalayhd":
                // DalayHDChange(e);
                break;

            case "hanhtrinh":
                // DalayHDChange(e);
                break;
            }
            switch (e.Column.Table.TableName.ToLower())
            {
            case "dmkh":
                if (e.Column.ColumnName.ToLower() == "makh" && _data.DrCurrentMaster != null && _data.DrCurrentMaster.RowState == DataRowState.Added)
                {
                    if (_data.DrCurrentMaster["MaKH"].ToString().Trim().Length == 10 || _data.DrCurrentMaster["MaKH"].ToString().Trim().Length == 13 || _data.DrCurrentMaster["MaKH"].ToString().Trim().Length == 14)
                    {
                        publicKH kh = getKH(_data.DrCurrentMaster["MaKH"].ToString().Trim());
                        if (kh != null)
                        {
                            _data.DrCurrentMaster["TenKH"] = kh.TenCty; _data.DrCurrentMaster["Diachi"] = kh.Diachi; _data.DrCurrentMaster["MST"] = kh.MST;
                            _data.DrCurrentMaster.EndEdit();
                        }
                    }
                }
                if (e.Column.ColumnName.ToLower() == "mst" && _data.DrCurrentMaster != null)
                {
                    if (e.Row["MST"] != DBNull.Value && !isMST(e.Row["MST"].ToString()))
                    {
                        e.Row.SetColumnError("MST", "Mã số thuế không đúnng");
                    }
                }
                break;

            case "mt35":    //Khải Hoàng
                if (_data.DrCurrentMaster != null && e.Column.ColumnName.ToLower() == "layhd")
                {
                    AplaiGia();
                }

                break;

            case "mt38":    //Khải Hoàng
                if (e.Column.ColumnName.ToLower() == "maxe")
                {
                    UpdateDT38(e);
                }
                if (e.Column.ColumnName.ToLower() == "chondon")
                {
                    List <DataRow> ldr = _data.LstDrCurrentDetails.FindAll(x => x.RowState == DataRowState.Added);
                    if (bool.Parse(e.Row["ChonDon"].ToString()) && ldr.Count == 0)
                    {
                        InsertAll_Donhang(e);
                    }
                }
                break;

            case "mt29":    //Piriou
                if (e.Column.ColumnName.ToLower() == "po_no")
                {
                    Updatedt29PoNo(e);
                }
                if (e.Column.ColumnName.ToLower() == "etadate")
                {
                    Updatedt29ETA(e);
                }
                if (e.Column.ColumnName.ToLower() == "puric")
                {
                    Updatedt29PurIC(e);
                }
                break;

            case "mt2a":    //Piriou
                if (e.Column.ColumnName.ToLower() == "ngaycan")
                {
                    Updatedt2ANgayCan(e);
                }
                break;
                //case "mt28"://Piriou
                //    if (e.Column.ColumnName.ToLower() == "ngayct" && e.Row.RowState==DataRowState.Added)
                //    {
                //        e.Row["NgayCT"] =DateTime.Parse(Config.GetValue("NgayHethong").ToString());
                //        e.Row.EndEdit();
                //    }
                //    if (e.Column.ColumnName.ToLower() == "revbom" && e.Row.RowState == DataRowState.Added)
                //    {
                //        e.Row["RevBOM"] ="0";
                //        e.Row.EndEdit();
                //    }

                //    break;
            }
            //ValidMtID(e);
        }
Пример #35
0
        void CusData_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
        {
            //Kiem tra theo ten truong
            switch (e.Column.ColumnName.ToLower())
            {
            case "mant":
                MantChanged(e);
                break;

            case "dalayhd":
                // DalayHDChange(e);
                break;

            case "hanhtrinh":
                // DalayHDChange(e);
                break;
            }
            switch (e.Column.Table.TableName.ToLower())
            {
            case "mt35":    //Khải Hoàng
                if (_data.DrCurrentMaster != null && e.Column.ColumnName.ToLower() == "layhd")
                {
                    AplaiGia();
                }

                break;

            case "mt38":    //Khải Hoàng
                if (e.Column.ColumnName.ToLower() == "maxe")
                {
                    UpdateDT38(e);
                }
                if (e.Column.ColumnName.ToLower() == "chondon")
                {
                    List <DataRow> ldr = _data.LstDrCurrentDetails.FindAll(x => x.RowState == DataRowState.Added);
                    if (bool.Parse(e.Row["ChonDon"].ToString()) && ldr.Count == 0)
                    {
                        InsertAll_Donhang(e);
                    }
                }
                break;

            case "mt29":    //Piriou
                if (e.Column.ColumnName.ToLower() == "po_no")
                {
                    Updatedt29PoNo(e);
                }
                if (e.Column.ColumnName.ToLower() == "etadate")
                {
                    Updatedt29ETA(e);
                }
                if (e.Column.ColumnName.ToLower() == "PurIC")
                {
                    Updatedt29PurIC(e);
                }
                break;

            case "mt2a":    //Piriou
                if (e.Column.ColumnName.ToLower() == "ngaycan")
                {
                    Updatedt2ANgayCan(e);
                }
                break;
            }
            //ValidMtID(e);
        }
Пример #36
0
 private void m_dtShiftSetting_ColumnChanged(object sender, DataColumnChangeEventArgs e)
 {
     DirtyData = true;
 }
Пример #37
0
 private void geotiff_ColumnChanging(object sender, System.Data.DataColumnChangeEventArgs e)
 {
 }
 private void dlgPropSQLNonQuery_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)
 {
 }
Пример #39
0
 private void TableChanged(object sender, System.Data.DataColumnChangeEventArgs e)
 {
     lblStatus.Text  = "Detected change. Column " + e.Column.ColumnName;
     lblStatus.Text += " updated to " + e.ProposedValue.ToString() + ".";
 }
Пример #40
0
        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();
            }
        }
Пример #41
0
		void ColumnChanging (object sender, DataColumnChangeEventArgs e)
		{
			_eventsFired.Add (new EventInfo ("ColumnChanging", e));
		}
Пример #42
0
 /// <summary>
 ///     Eventhandler for the datatable of strings
 /// </summary>
 private void stringsTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
 {
     if (e.Column != e.Column.Table.Columns["Error"])
     {
         this.Dirty = true;
         this.EvaluateRow(e.Row);
     }
 }
Пример #43
0
 private void CustomerAccounts_ColumnChanging(System.Object sender, System.Data.DataColumnChangeEventArgs e)
 {
     // ----- Some columns have special business rules.
 }
Пример #44
0
		/// <summary>
		/// Raises the ColumnChanging event.
		/// </summary>
		protected virtual void OnColumnChanging (DataColumnChangeEventArgs e)
		{
			if (null != ColumnChanging)
				ColumnChanging (this, e);
		}
		private void OnColumnChanging_Handler (Object sender, DataColumnChangeEventArgs e)
		{
			DataTable dt = (DataTable)sender;
			if ((e.Column.Equals(dt.Columns["Value"])) && (e.Row.Equals(dt.Rows[0])) && (e.ProposedValue.Equals("NewValue"))) {
				EventValues = true;
			} else {
				EventValues = false;
			}
			EventRaised = true;
		}
Пример #46
0
		internal void ChangingDataColumn (DataRow dr, DataColumn dc, object pv)
		{
			DataColumnChangeEventArgs e = new DataColumnChangeEventArgs (dr, dc, pv);
			OnColumnChanging (e);
		}
Пример #47
0
		// These index storing and rowView preservation must be done
		// before the actual row value is changed; thus we can't use
		// RowChanging which accepts "already modified" DataRow.

		private void OnColumnChanged(object sender, DataColumnChangeEventArgs args)
		{	/* not used */
			//UpdateIndex(true);
		}
Пример #48
0
        /// <summary>
        /// Calls the <see cref="M:DataRow.SetColumnError(DataColumn, String)" /> Method of a
        /// DataRow's Column to the  <see cref="TVerificationResult.ResultText" /> Property
        /// of the passed in <see cref="TVerificationResult" />.
        /// </summary>
        /// <param name="AEventArgs">An instance of DataColumnChangeEventArgs.</param>
        /// <param name="AVerificationResultEntry"><see cref="TVerificationResult" /> which has
        /// its <see cref="TVerificationResult.ResultText" /> Property set.</param>
        /// <param name="AControlName">Name of the Control to which the <see cref="TVerificationResult" />
        /// is related.</param>
        /// <param name="AResetValue">Set this to true to retain the
        /// <see cref="DataColumnChangeEventArgs.ProposedValue" />.</param>
        public static void SetColumnErrorText(DataColumnChangeEventArgs AEventArgs,
            TVerificationResult AVerificationResultEntry,
            String AControlName,
            Boolean AResetValue)
        {
            object PreviousProposedValue = AEventArgs.ProposedValue;

            AEventArgs.Row.SetColumnError(AEventArgs.Column,
                AVerificationResultEntry.ResultText + "//[[" + AControlName + "]]");

            /*
             * SetColumnError automatically resets the value of the DataColumn.
             * Therefore we need to re-assign it again if we don't want to reset the value.
             */
            if (!AResetValue)
            {
                //            MessageBox.Show("SetColumnErrorText: Before resetting the value: " + AEventArgs.ProposedValue.ToString());
                AEventArgs.ProposedValue = PreviousProposedValue;
                //            MessageBox.Show("SetColumnErrorText: After resetting the value: " + AEventArgs.ProposedValue.ToString());
            }
        }
Пример #49
0
	private void Column_Changed( object sender, DataColumnChangeEventArgs e )
	{
		_EventTriggered = true;
	}
Пример #50
0
 protected internal virtual void OnColumnChanged(DataColumnChangeEventArgs e) {
     Debug.Assert(e != null, "e should not be null");
     if (onColumnChangedDelegate != null) {
         Bid.Trace("<ds.DataTable.OnColumnChanged|INFO> %d#\n", ObjectID);
         onColumnChangedDelegate(this, e);
     }
 }
Пример #51
0
 void dtShiftDetail_ColumnChanged(object sender, DataColumnChangeEventArgs e)
 {
     DirtyData = true;
 }