示例#1
0
        public static AjaxRtnJsonData ActionWrap(dlgMethod1 dlg)
        {
            //string strRtn = string.Empty;

            AjaxRtnJsonData RtnJsonData = new AjaxRtnJsonData();

            try
            {
                //WebLogHelper.WriteLog("ActionWrap start ");
                //WebLogHelper.WriteLog("debug", context.Request.Cookies["UserIDFileCheck"].Value.ToString());

                //if (context.Request.Cookies["UserIDFileCheck"] == null
                //|| string.IsNullOrEmpty(context.Request.Cookies["UserIDFileCheck"]))
                //{

                //    throw new BusinessExcption() { Value = "Token已过期!" };

                //}

                RtnJsonData.ResultData = dlg();

                //WebLogHelper.WriteLog("ActionWrap end ");
            }
            catch (BusinessException ex)
            {
                RtnJsonData.ErrCode = "1";
                RtnJsonData.Status  = "false";
                RtnJsonData.ErrMsg  = ex.Message;
                //string typeName = this.GetType().ToString();//当类名用
                //string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                //string methodName = context.Request.Form["Action"];
                //ex.Source = typeName + "." + methodName + "->" + ex.Source;
                //WebLogHelper.WriteLog("","BusinessExcption=>" + ex.ToString());
                //WebLogHelper.WriteLog("","ex.Source=>" + ex.Source);
            }
            catch (DBOperatorException ex)
            {
                RtnJsonData.ErrCode = "2";
                RtnJsonData.Status  = "false";
                RtnJsonData.ErrMsg  = ex.Message;
                //string typeName = this.GetType().ToString();//当类名用
                //string methodName = context.Request.Form["Action"];
                //ex.Source = typeName + "." + methodName + "->" + ex.Source;
                //WebLogHelper.WriteLog("HandlerDBOperatorException", "DBOperatorException=>" + ex.ToString());
                //WebLogHelper.WriteLog("HandlerDBOperatorException", "ex.Source=>" + ex.Source);
            }
            catch (Exception ex)
            {
                RtnJsonData.ErrCode = "3";
                RtnJsonData.Status  = "false";
                RtnJsonData.ErrMsg  = "系统异常!" + ex.Message;
                //string typeName = this.GetType().ToString();//当类名用
                //string methodName = context.Request.Form["Action"];
                //ex.Source = typeName + "." + methodName + "->" + ex.Source;
                //WebLogHelper.WriteLog("HandlerException", "Exception=>" + ex.ToString());
                //WebLogHelper.WriteLog("HandlerException", "ex.Source=>" + ex.Source);
            }

            return(RtnJsonData);
        }
 public Boolean runTest()
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc="123_er";
   Console.Out.Write( s_strClassMethod );
   Console.Out.Write( ": " );
   Console.Out.Write( s_strTFPath + s_strTFName );
   Console.Out.Write( ": " );
   Console.Out.Write( s_strDtTmVer );
   Console.Out.WriteLine( " runTest started..." );
   Delegate dlg1;
   Delegate dlg2;
   dlgMethod1 MyMethod1;
   dlgMethod1 MyMethod2;
   try
     {
     Co3871op_ComparisonOperators Co3871 = new Co3871op_ComparisonOperators();
     MyMethod1 = new dlgMethod1(Co3871.Co3871_1);
     MyMethod2 = new dlgMethod1(Co3871.Co3871_1);
     iCountTestcases++;
     if(MyMethod1!=MyMethod2){
     iCountErrors++;
     Console.WriteLine("Err_753cds! op_GreaterThan giving problems here");
     }
     dlg1 = new dlgMethod1(Co3871.Co3871_1);
     dlg2 = new dlgMethod1(Co3871.Co3871_1);
     iCountTestcases++;
     if(dlg1!=dlg2){
     iCountErrors++;
     Console.WriteLine("Err_653fcd! op_GreaterThan giving problems here");
     }
     dlg1 = new dlgMethod1(Co3871.Co3871_1);
     dlg2 = new dlgMethod1(Co3871.Co3871_2);
     iCountTestcases++;
     if(dlg1==dlg2){
     iCountErrors++;
     Console.WriteLine("Err_9345dxs! op_GreaterThan giving problems here");
     }
     dlg1 = new dlgMethod1(Co3871.Co3871_1);
     dlg2 = new dlgMethod2(Co3871.Co3871_3);
     iCountTestcases++;
     if(dlg1==dlg2){
     iCountErrors++;
     Console.WriteLine("Err_105xds! op_GreaterThan giving problems here");
     }
     }
   catch (Exception exc_general)
     {
     ++iCountErrors;
     Console.WriteLine( s_strTFAbbrev +"Error Err_8888yyy!  strLoc=="+ strLoc +" ,exc_general=="+ exc_general );
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
    public Boolean runTest()
    {
        int    iCountErrors    = 0;
        int    iCountTestcases = 0;
        String strLoc          = "123_er";

        Console.Out.Write(s_strClassMethod);
        Console.Out.Write(": ");
        Console.Out.Write(s_strTFPath + s_strTFName);
        Console.Out.Write(": ");
        Console.Out.Write(s_strDtTmVer);
        Console.Out.WriteLine(" runTest started...");
        Delegate   dlg1;
        Delegate   dlg2;
        dlgMethod1 MyMethod1;
        dlgMethod1 MyMethod2;

        try
        {
            Co3871op_ComparisonOperators Co3871 = new Co3871op_ComparisonOperators();
            MyMethod1 = new dlgMethod1(Co3871.Co3871_1);
            MyMethod2 = new dlgMethod1(Co3871.Co3871_1);
            iCountTestcases++;
            if (MyMethod1 != MyMethod2)
            {
                iCountErrors++;
                Console.WriteLine("Err_753cds! op_GreaterThan giving problems here");
            }
            dlg1 = new dlgMethod1(Co3871.Co3871_1);
            dlg2 = new dlgMethod1(Co3871.Co3871_1);
            iCountTestcases++;
            if (dlg1 != dlg2)
            {
                iCountErrors++;
                Console.WriteLine("Err_653fcd! op_GreaterThan giving problems here");
            }
            dlg1 = new dlgMethod1(Co3871.Co3871_1);
            dlg2 = new dlgMethod1(Co3871.Co3871_2);
            iCountTestcases++;
            if (dlg1 == dlg2)
            {
                iCountErrors++;
                Console.WriteLine("Err_9345dxs! op_GreaterThan giving problems here");
            }
            dlg1 = new dlgMethod1(Co3871.Co3871_1);
            dlg2 = new dlgMethod2(Co3871.Co3871_3);
            iCountTestcases++;
            if (dlg1 == dlg2)
            {
                iCountErrors++;
                Console.WriteLine("Err_105xds! op_GreaterThan giving problems here");
            }
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.WriteLine(s_strTFAbbrev + "Error Err_8888yyy!  strLoc==" + strLoc + " ,exc_general==" + exc_general);
        }
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }