Example #1
0
        private void ultraGrid1_BeforeExitEditMode(object sender, Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e)
        {
            UltraGridCell activeCell = ((UltraGrid)sender).ActiveCell;

            if (activeCell == null)
            {
                return;
            }
            if (activeCell.IsDataCell && activeCell.Column.Key == "FoodCostDiscount")
            {
                decimal value = cellValue(activeCell.Text);
                activeCell.Value = value / 100m;
            }
        }
Example #2
0
 /// <summary>
 /// fpSpread의 Change 이벤트는 UltraGrid의 BeforeExitEditMode 또는 AfterExitEditMode 이벤트로 대체됩니다.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void uniGrid1_BeforeExitEditMode(object sender, Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e)
 {
 }
Example #3
0
        protected internal override void UltraGrid_BeforeExitEditMode(object sender, Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e)
        {
            string        colName = "";
            string        dbValue;
            UltraGridCell ugcell    = null;
            DataRowView   drvActive = null;
            DataRow       drActive;

            try
            {
                //if (IsInGridButtonClick == true)        //避免驗證時又觸發事件(目前作用時機為PICK開窗時會造成...)
                //    return;
                if (IsInSaveCancle == true || IsInCRUDIni == true)
                {
                    return;
                }
                if (IsInFormLoading == true)
                {
                    return;
                }

                //if (FormEditMode == YREditType.查詢 || FormEditMode == YREditType.NA)
                //    return;

                WfCleanBottomMsg();
                IsInItemchecking = true;
                IsItemchkValid   = true;
                ugcell           = (sender as UltraGrid).ActiveCell;
                colName          = ugcell.Column.Key;
                drvActive        = (System.Data.DataRowView)ugcell.Row.ListObject;
                if (drvActive == null)
                {
                    return;
                }

                (sender as UltraGrid).UpdateData();
                drActive = drvActive.Row;
                dbValue  = GlobalFn.isNullRet(drActive[colName], "");

                if (!ugcell.Value.Equals(OldValue))
                {
                    //WfSetBllTransaction();
                    var itemCheckInfo = new ItemCheckInfo();
                    itemCheckInfo.Row    = drActive;
                    itemCheckInfo.Value  = ugcell.Value;
                    itemCheckInfo.Column = colName;
                    if (WfItemCheck(sender, itemCheckInfo) == false)
                    {
                        e.Cancel       = true;
                        IsItemchkValid = false;

                        if (ugcell.Column.Style == Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList)
                        {
                            ugcell.Value = ugcell.OriginalValue;    //null 問題
                        }
                        else
                        {
                            if (OldValue == DBNull.Value)
                            {
                                if (ugcell.Column.DataType.Name.ToLower() == "string")
                                {
                                    ugcell.Value = null;
                                }
                                else//數字會被歸類為system.decimal使用null 會無法還原,但用Dbnull.value 畫面會殘留值
                                {
                                    ugcell.Value = DBNull.Value;
                                }
                                //styleresolved
                            }
                            //ugcell.Value = DBNull.Value;
                            else
                            {
                                ugcell.Value = OldValue;
                            }
                            ugcell.SelectAll();
                        }
                    }
                    else
                    {
                        IsChanged = true;
                    }
                    (sender as UltraGrid).UpdateData();
                }
            }
            catch (Exception ex)
            {
                e.Cancel       = true;
                IsItemchkValid = false;
                ugcell.Value   = OldValue;
                WfShowErrorMsg(ex.ToString());
            }
            finally
            {
                //IsInButtonClick = false;
                IsInItemchecking = false;
            }
        }