예제 #1
0
        private void grvRules_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                DB.GLX_BulkEntryRule rule = (DB.GLX_BulkEntryRule)grvRules.GetRow(e.FocusedRowHandle);

                if (rule != null)
                {
                    BindingSourceRule.DataSource = rule;

                    filRule.DataBindings.Clear();
                    filRule.DataBindings.Add("FilterString", BindingSourceRule.DataSource, "EntryRule");

                    ddlAction.SelectedIndex = rule.EntryAction == "Y" ? 1 : 0;

                    pnlRuleDetail.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Adds a new Bulk Entry Rule
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddRule_Click(object sender, EventArgs e)
 {
     try
     {
         grvRules.BeginUpdate();
         grvRules.BeginDataUpdate();
         DB.GLX_BulkEntryRule rule = BL.GLX.GLX_BulkEntryRule.New;
         rule.Name        = String.Format("New Rule #{0}", (BindingSourceRules.DataSource as List <DB.GLX_BulkEntryRule>).Count + 1);
         rule.EntryRule   = "";
         rule.EntityId    = (Int64)ddlAccount.EditValue;
         rule.EntryAction = "N";
         rule.Priority    = (Int16)(BindingSourceRules.DataSource as List <DB.GLX_BulkEntryRule>).Count;
         BindingSourceRules.Add(rule);
         grvRules.RefreshData();
         grvRules.EndDataUpdate();
         grvRules.EndUpdate();
     }
     catch (Exception ex)
     {
         DataContext.EntitySystemContext.RejectChanges();
         DataContext.EntityAccountingContext.RejectChanges();
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Moves selected Rules priority down by one and reorders rules.
        /// </summary>
        /// <remarks>Created: Werner Scheffer 07/03/2012</remarks>
        private void btnDown_Click(object sender, EventArgs e)
        {
            try
            {
                //SWITCH PRIORITY
                DB.GLX_BulkEntryRule selectedRule = (DB.GLX_BulkEntryRule)grvRules.GetRow(grvRules.GetSelectedRows()[0]);
                DB.GLX_BulkEntryRule nextRule     = (DB.GLX_BulkEntryRule)grvRules.GetRow(grvRules.GetSelectedRows()[0] + 1);

                if (nextRule == null)
                {
                    return;
                }

                nextRule.Priority     = selectedRule.Priority;
                selectedRule.Priority = (Int16)(nextRule.Priority - 1);

                //SWITCH ROW POSITION

                DevExpress.XtraGrid.Views.Grid.GridView view = grvRules;

                view.GridControl.Focus();

                int index = view.FocusedRowHandle;

                if (index >= view.DataRowCount - 1)
                {
                    return;
                }

                //  view.BeginSort();
                try
                {
                    view.ClearSorting();
                    view.Columns[colPriority.FieldName].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
                }
                finally
                {
                    //      view.EndSort();
                }

                view.FocusedRowHandle = index + 1;
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
예제 #4
0
        internal static String Save(DB.GLX_BulkEntryRule entry, DataContext dataContext)
        {
            try
            {
                if (dataContext.EntityAccountingContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached)
                {
                    dataContext.EntityAccountingContext.GLX_BulkEntryRule.Add(entry);
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                return(dataContext.PackageValidationException());
            }

            return("Success");
        }
예제 #5
0
        /// <summary>
        /// Moves selected Rules priority up by one and reorders rules.
        /// </summary>
        /// <remarks>Created: Werner Scheffer 07/03/2012</remarks>
        private void btnUp_Click(object sender, EventArgs e)
        {
            try
            {
                //SWITCH PRIORITY
                DB.GLX_BulkEntryRule selectedRule = (DB.GLX_BulkEntryRule)grvRules.GetRow(grvRules.GetSelectedRows()[0]);
                DB.GLX_BulkEntryRule previousRule = (DB.GLX_BulkEntryRule)grvRules.GetRow(grvRules.GetSelectedRows()[0] - 1);

                if (previousRule == null)
                {
                    return;
                }

                previousRule.Priority = selectedRule.Priority;
                selectedRule.Priority = (Int16)(previousRule.Priority - 1);

                //SWITCH ROW POSITION

                DevExpress.XtraGrid.Views.Grid.GridView view = grvRules;

                view.GridControl.Focus();

                int index = view.FocusedRowHandle;

                if (index <= 0)
                {
                    return;
                }


                view.ClearSorting();
                view.Columns[colRulePriority.FieldName].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;


                //view.FocusedRowHandle = index - 1;
                //  view.FocusedRowHandle--;
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
예제 #6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                DB.GLX_BulkEntryRule rule = BL.GLX.GLX_BulkEntryRule.New;
                rule.Name        = String.Format("New Rule #{0}", rules.Count + 1);
                rule.EntryRule   = "";
                rule.EntityId    = (Int64)ddlAccount.EditValue;
                rule.EntryAction = ddlAction.SelectedIndex == 0 ? "N" : "Y";
                rule.Priority    = (Int16)rules.Count;
                //DataContext.EntityContext.SaveChanges();

                BindRules(Convert.ToInt64(ddlAccount.EditValue));
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }