New Posts New Posts RSS Feed: how to use 10 overload of VerifierEngine.Execute
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

how to use 10 overload of VerifierEngine.Execute

 Post Reply Post Reply
Author
bahramchobin View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 10
Post Options Post Options   Quote bahramchobin Quote  Post ReplyReply Direct Link To This Post Topic: how to use 10 overload of VerifierEngine.Execute
    Posted: 12-Dec-2009 at 2:35am
hi ,  thx GregD  i solve this problem with  this code:



        mPersMgr.VerifierEngine.AddVerifier(get1());
        mPersMgr.VerifierEngine.AddVerifier(get2());
        if(condition)
           mPersMgr.VerifierEngine.AddVerifier(get3());
 
        VerifierResultCollection results =
          mPersMgr.VerifierEngine.Execute(DetailInEdit);//1 overload


Back to Top
bahramchobin View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 10
Post Options Post Options   Quote bahramchobin Quote  Post ReplyReply Direct Link To This Post Posted: 11-Dec-2009 at 10:46pm

i use verifierEngine.Execute(1 overload ) and no error but i need 2 getverifier methode
in entity

    [VerifierProvider]
    public static IEnumerable<Verifier> GetVerifiers1(Object pVerifierProviderContext)
    {

        List<Verifier> verifiers = new List<Verifier>();

        verifiers.Add(Get1());
        verifiers.Add(Get2());
        return verifiers;
    }
    public static IEnumerable<Verifier> GetVerifiers2(Object pVerifierProviderContext)
    {

        List<Verifier> verifiers = new List<Verifier>();

        verifiers.Add(Get3());
        return verifiers;
    }



stack trace of error prior post :
System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="IdeaBlade.Verification"
  StackTrace:
       at IdeaBlade.Verification.Verifier.Execute(Object pItemToVerify, TriggerContext pTriggerContext, VerifierContext pVerifierContext)
       at IdeaBlade.Verification.VerifierEngine.ExecuteCollection(IEnumerable`1 pVerifiers, VerifierExecutionModes pModes, Object pItemToVerify, TriggerContext pTriggerContext, VerifierContext pVerifierContext)
       at IdeaBlade.Verification.VerifierEngine.Execute(Object pInstance, IEnumerable`1 pVerifiers, VerifierContext pVerifierContext)
       at Salary.frmKarkardMabani.DisplayVerificationResultsForCurrentMaliatJadvalDetail(KarkardDetailTB DetailInEdit) in E:\samansystem\projects\SmallBussinesAccounting\HumanResource\Salary\frmKarkardMabani.cs:line 764
       at Salary.frmKarkardMabani.dgvList_CellValuePushed(Object sender, DataGridViewCellValueEventArgs e) in E:\samansystem\projects\SmallBussinesAccounting\HumanResource\Salary\frmKarkardMabani.cs:line 614
       at System.Windows.Forms.DataGridView.OnCellValuePushed(DataGridViewCellValueEventArgs e)
       at System.Windows.Forms.DataGridView.OnCellValuePushed(Int32 columnIndex, Int32 rowIndex, Object value)
       at System.Windows.Forms.DataGridViewCell.SetValue(Int32 rowIndex, Object value)
       at System.Windows.Forms.DataGridView.PushFormattedValue(DataGridViewCell& dataGridViewCurrentCell, Object formattedValue, Exception& exception)
       at System.Windows.Forms.DataGridView.CommitEdit(DataGridViewCell& dataGridViewCurrentCell, DataGridViewDataErrorContexts context, DataGridViewValidateCellInternal validateCell, Boolean fireCellLeave, Boolean fireCellEnter, Boolean fireRowLeave, Boolean fireRowEnter, Boolean fireLeave)
       at System.Windows.Forms.DataGridView.CommitEdit(DataGridViewDataErrorContexts context, Boolean forCurrentCellChange, Boolean forCurrentRowChange)
       at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown)
       at System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
       at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.DataGridView.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at Salary.frmKarkardList.tsmiEdit_Click(Object sender, EventArgs e) in E:\samansystem\projects\SmallBussinesAccounting\HumanResource\Salary\frmKarkardList.cs:line 160
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at HumanResource.frmMain.tsmiKarkard_Click(Object sender, EventArgs e) in E:\samansystem\projects\SmallBussinesAccounting\HumanResource\HumanResource\frmMain.cs:line 61
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at HumanResource.Program.Main() in E:\samansystem\projects\SmallBussinesAccounting\HumanResource\HumanResource\Program.cs:line 23
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:






Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 11-Dec-2009 at 3:29pm
Which object is null in the statement that gives the error?
Back to Top
bahramchobin View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 10
Post Options Post Options   Quote bahramchobin Quote  Post ReplyReply Direct Link To This Post Posted: 11-Dec-2009 at 12:55pm
i do this code :

        List<Verifier> verifiers = new List<Verifier>();
        verifiers.Add(GetPersonelUniqVerifier());
        VerifierContext pVerifierContext=new VerifierContext(VerifierOnErrorMode.Continue, ?) ;//I put null
VerifierResultCollection results =
          mPersMgr.VerifierEngine.Execute(DetailInEdit, verifiers, pVerifierContext);//10 overload

then run and tis error :
{"Object reference not set to an instance of an object."}
how to use 10 overload of how to use 10 overload of VerifierEngine.Execute



    public static Verifier GetPersonelUniqVerifier()
    {
        // ToDo: localize description
        string description = "کد پرسنلی نباید تکراری باشد.";
        DelegateVerifier<KarkardDetailTB> v =
          new DelegateVerifier<KarkardDetailTB>(description, PersonelUniqVerifierCondition);
        v.AddTriggers(Descriptors.MazayaID.Name);
        v.ExecutionModes = VerifierExecutionModes.InstanceAndOnPostsetTriggers;
        return v;
    }
    public static VerifierResult PersonelUniqVerifierCondition(
      KarkardDetailTB pMjd, TriggerContext pTriggerContext, VerifierContext pVerifierContext)
    {

        if (pTriggerContext != null &&
            // We are not checking the proposed value because don't expect to call it preset
          pTriggerContext.Timing == TriggerTiming.Preset)
        {
            throw new VerifierException("BornBeforeHired verifier not implemented for Preset");
        }
        if (pMjd.PersonID == KarkardDetailTB.GetPersonelID(pMjd.PersonID.Value,pMjd.KarkardID.Value))
            if (pMjd.Id != KarkardDetailTB.GetID(pMjd.PersonID.Value,0, false, pMjd.KarkardID.Value, KarkardTypeEnumTB.Mabani().EnumValue))
                return new VerifierResult(false);
        return new VerifierResult(true);
    }

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down