示例#1
0
        private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
        {
            //Event handler for data entry row updated
            try {
                //There is no selected row when updating- at a cell level
                string vendorID = "", operatorName = "";
                int    equipmentID = 0;
                switch (e.Row.Band.Key)
                {
                case "DriverEquipmentTable":
                    vendorID     = e.Row.Cells["FinanceVendorID"].Value.ToString();
                    operatorName = e.Row.Cells["OperatorName"].Value.ToString();
                    equipmentID  = Convert.ToInt32(e.Row.Cells["EquipmentID"].Value.ToString());
                    break;
                }

                //Add new or update existing terminal configuration
                if (vendorID.Length > 0 && operatorName.Length > 0 && equipmentID > 0)
                {
                    if (e.Row.IsAddRow)
                    {
                        FinanceGateway.CreateDriverEquipment(vendorID, operatorName, equipmentID);
                    }
                    else
                    {
                        FinanceGateway.UpdateDriverEquipment(vendorID, operatorName, equipmentID);
                    }
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex) { reportError(ex); }
        }