private void InitFileLog()
        {
            var now = DateTime.Now;
            var path = _root + now.ToString("yyyyMMdd") + "\\" + now.ToString("HH") + ".log";

            _log = new FileLog(path);
        }
    public WBSPGHelper(System.Web.SessionState.HttpSessionState session, System.Web.UI.Page page, FileLog eventLog, ExceptionLog exceptionEventLog, bool isProduction)
    {
        Session = session;
        Page = page;
        objEventLog = eventLog;
        objExceptionEventLog = exceptionEventLog;
        bIsProduction = isProduction;

        return;
    }
        /// <summary>
        ///   Construct a basic server such that it is ready to be started, and possibly using the default connect
        ///   behavior.
        /// </summary>
        public BasicServer(IPAddress localaddr, int port, string logFileName = null, bool tailLog = true)
        {
            IsRunning = false;
            _localaddr = localaddr;
            _port = port;

            ClientTable = new BidirectionalDict<string, Client>();
            AuthTable = new DefaultDict<Client, bool>();

            Log = new FileLog(logFileName, Frequency.Burst);
            if (tailLog)
                Log.AddMirror(new ConsoleLog());
            Log.Info("Server initialized: <{0}>::{1}".format(localaddr, port));
        }
    public DeviceAtlasData(FileLog objEventLog, ExceptionLog objExceptionEventLog)
    {
        Tree = null;

        try
        {
            Tree = Api.GetTreeFromFile((string)ConfigurationManager.AppSettings["DeviceAtlasDataPath"]);
        }

        catch (Exception e)
        {
            objExceptionEventLog.Write("Exception while reading DA hash tree from file: ", e);
        }

        return;
    }
Exemple #5
0
    public Log(string logFilePath, long maxLogSize)
    {
      try
      {
        _FileLog = new FileLog(logFilePath, maxLogSize);

        _FileLog.WriteLine(string.Format(
          "<!--================================================================================-->\r\n" +
          "\r\n" +
          "<LogStarting time='{0}'/>\r\n", TimeToString(DateTime.Now)));
      }
      catch (Exception exc)
      {
        Console.WriteLine(new Exception("Не удалось создать лог файл", exc));
      }
    }
    public static DeviceAtlasData GetDeviceAtlasData(Cache objCache, FileLog objEventLog, ExceptionLog objExceptionEventLog)
    {
        DeviceAtlasData objDeviceAtlasData = null;

        lock (DeviceAtlasData.CacheLock)
        {
            if (objCache["DeviceAtlasData"] != null)
            {
                objDeviceAtlasData = (DeviceAtlasData)objCache["DeviceAtlasData"];
            }

            else
            {
                objDeviceAtlasData = new DeviceAtlasData(objEventLog, objExceptionEventLog);
                objCache.Add("DeviceAtlasData", objDeviceAtlasData, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.NotRemovable, null);
            }

        }

        return objDeviceAtlasData;
    }
Exemple #7
0
 /// <summary>
 /// 带WebApi_Result实体返回值的业务处理委托。(用于非跨域的AJAX接口调用)
 /// </summary>
 /// <param name="actionName">操作名称</param>
 /// <param name="handler">业务处理委托</param>
 public string ExecuteActionJsonResult(string actionName, UI_Business_Logic_JsonResult_Handler handler)
 {
     try
     {
         var _WebApi_Result = new WebApi_Result()
         {
             code = 13, msg = "登录凭证失效,获取数据失败!"
         };
         if (IsTokenAuthorized)
         {
             _WebApi_Result      = handler();
             _WebApi_Result.msg  = _WebApi_Result.msg == null ? actionName + "成功!" : _WebApi_Result.msg;
             _WebApi_Result.code = _WebApi_Result.code == null ? 0 : _WebApi_Result.code;
         }
         return(ResponseJsonResult(_WebApi_Result));
     }
     catch (Exception err)
     {
         if (err.Message.Contains("ORA-12570"))
         {
             ExecuteActionJsonResult(actionName, handler);
         }
         string strErrorContent = actionName + "失败!-------" + err.Message;
         if (string.IsNullOrWhiteSpace(Request["token"].GetUserToken().UserId))
         {
             strErrorContent += "----------用户ID:" + Request["token"].GetUserToken().UserId;
         }
         FileLog.AddErrorLog(strErrorContent);
         Globle_Message = strErrorContent;
         return(ResponseJsonResult(new WebApi_Result()
         {
             code = 6
         }));
     }
     finally
     {
         //Response.End();//Response.End必须放在finally里面执行,否则会报“正在中止线程”的错误 http://www.cnblogs.com/jintianhu/archive/2011/02/16/1952833.html
     }
 }
Exemple #8
0
        /// <summary>
        /// 执行一个返回结果集的数据库操作
        /// </summary>
        /// <param name="connectionString">连接字符串</param>
        /// <param name="sql">查询字符串</param>
        /// <returns>数据结果集</returns>
        public static SqlDataReader ExecuteReader(string connectionString, string sql)
        {
            SqlCommand    cmd  = new SqlCommand();
            SqlConnection conn = new SqlConnection(connectionString);

            try
            {
                PrepareCommand(cmd, conn, null, CommandType.Text, sql, null);
                SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                cmd.Parameters.Clear();
                conn.Close();
                conn.Dispose();
                return(rdr);
            }
            catch (Exception e)
            {
                conn.Close();
                conn.Dispose();
                FileLog.WriteLog(e.ToString());
                throw;
            }
        }
Exemple #9
0
        public static object ExecuteScalar(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
        {
            SqlCommand    cmd  = new SqlCommand();
            SqlConnection conn = new SqlConnection(connectionString);

            try
            {
                PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
                object result = cmd.ExecuteScalar();
                cmd.Parameters.Clear();
                conn.Close();
                conn.Dispose();
                return(result);
            }
            catch (Exception e)
            {
                conn.Close();
                conn.Dispose();
                FileLog.WriteLog(e.ToString());
                throw;
            }
        }
Exemple #10
0
    protected void btnSignOut_Click(object sender, EventArgs e)
    {
        try
        {
            ddlType.SelectedValue      = "7";
            lblErrorMess.Text          = "";
            lblSuccess.Text            = "";
            grdSignInSignOut.PageIndex = 0;
            SignOut(objSignInSignOutModel);
        }

        catch (V2Exceptions ex)
        {
            throw;
        }
        catch (System.Exception ex)
        {
            FileLog objFileLog = FileLog.GetLogger();
            objFileLog.WriteLine(LogType.Error, ex.Message, "SignInSignOut.cs", "btnSignOut_Click", ex.StackTrace);
            throw new V2Exceptions();
        }
    }
Exemple #11
0
 protected void lnkModifyTime_Click(object sender, EventArgs e)
 {
     try
     {
         // redirects to manual sign in sign out page where the user can modify the in/out time for a selected date.
         Response.Redirect("ManualSignInSignOut.aspx");
     }
     catch (System.Threading.ThreadAbortException)
     {
         throw;
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "SignInSignOut.cs", "lnkModifyTime_Click", ex.StackTrace);
         throw new V2Exceptions();
     }
 }
Exemple #12
0
        public void SettingRangeValidaters()
        {
            try
            {
                rvInDate.MaximumValue = DateTime.Now.ToShortDateString();
                rvInDate.MinimumValue = DateTime.Now.AddMonths(-12).ToShortDateString();

                rvOutDate.MaximumValue = DateTime.Now.ToShortDateString();
                rvOutDate.MinimumValue = DateTime.Now.AddMonths(-12).ToShortDateString();
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "ManualSignInSignOut.cs", "SettingRangeValidaters", ex.StackTrace);

                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #13
0
        public void GetOldData()
        {
            try
            {
                //dsGetOldData =  objManualSignInSignOutBOL.GetOldData(Convert.ToInt32(strSignInSignOutID));
                dsGetOldData = objManualSignInSignOutBOL.GetOldData(objSignInSignOutModel);
                objSignInSignOutModel.Date1 = Convert.ToDateTime(dsGetOldData.Tables[0].Rows[0]["date"]);

                objSignInSignOutModel.SignInComment  = dsGetOldData.Tables[0].Rows[0]["SignInComment"].ToString();
                objSignInSignOutModel.SignOutComment = dsGetOldData.Tables[0].Rows[0]["SignOutComment"].ToString();
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "ManualSignInSignOut.cs", "GetOldData", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #14
0
        protected void gvBulkEntries_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string lblSignInSignOutID = ((Label)gvBulkEntries.Rows[e.RowIndex].FindControl("lblSignInSignOutID")).Text;

            objSignInSignOutModel.SignInSignOutID = Convert.ToInt32(lblSignInSignOutID);
            try
            {
                objBulkBOL.DeleteSignInSignOutDetails(objSignInSignOutModel);
                lblSuccess.Text = "Record Deleted Successfully";
                BindData();
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "BulkEntries.aspx.cs", "gvBulkEntries_RowDeleting", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #15
0
        public override int Run(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, SpellOpt spell)
        {
            /*
             * [ opt10001 : 주식기본정보요청 ]
             * 1. Open API 조회 함수 입력값을 설정합니다.
             * 종목코드 = 전문 조회할 종목코드
             * SetInputValue("종목코드"	,  "181710;066570");
             * 2. Open API 조회 함수를 호출해서 전문을 서버로 전송합니다.
             * CommRqData( "RQName"	,  "opt10001"	,  "0"	,  "화면번호");
             */

            FileLog.PrintF("OPT10001:Run sRQNAME=>" + spell.sRQNAME);
            FileLog.PrintF("OPT10001:Run sTrCode=>" + spell.sTrCode);
            FileLog.PrintF("OPT10001:Run nPrevNext=>" + spell.nPrevNext);
            FileLog.PrintF("OPT10001:Run sScreenNo=>" + spell.sScreenNo);
            FileLog.PrintF("OPT10001:Run 종목코드=>" + spell.stockCode);

            axKHOpenAPI.SetInputValue("종목코드", spell.stockCode);
            int ret = axKHOpenAPI.CommRqData(spell.sRQNAME, spell.sTrCode, spell.nPrevNext, spell.sScreenNo);

            return(ret);
        }
 public void dgProblemPriority_Edit(object Sender, DataGridCommandEventArgs e)
 {
     try
     {
         pnlAddEditProblemPriority.Visible = false;
         objBLProblemPriority            = new BusinessLayer.clsBLProblemPriority();
         dsProblemPriorityList           = objBLProblemPriority.GetProblemPriorityList();
         strIsActive1                    = dsProblemPriorityList.Tables[0].Rows[e.Item.ItemIndex][4].ToString();
         dgProblemPriority.EditItemIndex = (int)e.Item.ItemIndex;
         GetProblemPriorityList();
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemPriorityMaster.aspx", "dgProblemPriority_Edit", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
 protected void lnkAddNew_Click(object sender, System.EventArgs e)
 {
     try
     {
         pnlAddEditProblemPriority.Visible = true;
         lblDuplicateProblemPriority.Text  = "";
         lblMsg.Text = "";
         ResetPageControls();
         GetProblemPriorityList();
         this.setfocus(txtProblemPriority);
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemPriorityMaster.aspx", "lnkAddNew_Click", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
Exemple #18
0
 public void passwordGenTest()
 {
     using (FileLog l = new FileLog("passwordGenTest", new FileLogSettings()
     {
         DateFolderMask = "yyyy-MM-dd"
     }))
     {
         l.Debug("Start");
         for (int i = 0; i < 40; i++)
         {
             l.Debug(PasswordGenerator.Generate(new PasswordGeneratorOptions()
             {
                 ValidLen = Math.Max(8, i % 32), MinSpecial = 0, MinDigit = 0, MinLower = 0
             }));
         }
         for (int i = 0; i < 100; i++)
         {
             l.Debug(PasswordGenerator.Generate(new PasswordGeneratorOptions()
             {
                 ValidLen = Math.Max(8, i % 32), MinSpecial = 1
             }));
         }
         for (int i = 0; i < 100; i++)
         {
             l.Debug(PasswordGenerator.Generate(new PasswordGeneratorOptions()
             {
                 ValidLen = Math.Max(8, i % 32), MinSpecial = 0, MinUpper = 3, MinLower = 3
             }));
         }
         for (int i = 0; i < 1000; i++)
         {
             l.Debug(PasswordGenerator.Generate(new PasswordGeneratorOptions()
             {
                 ValidLen = Math.Max(8, i % 32), MinSpecial = 2, MinUpper = 2, MinLower = 2, MinDigit = 2
             }));
         }
         l.Debug("Finish");
     }
 }
        static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = new List <CodeInstruction>(instructions);

            try {
                int start = 0;
                FileLog.Log("Running patch, which found anchor " + InstructionHandlers.toString(codes, start));
                List <CodeInstruction> inject = new List <CodeInstruction>();
                inject.Add(new CodeInstruction(OpCodes.Ldarg_0));
                inject.Add(InstructionHandlers.createMethodCall("ReikaKalseki.RoomEnvironmentals.RoomEnvironmentalsMod", "onRoomEnviroPPSCost", false, typeof(Room_Enviro)));
                FileLog.Log("Injecting " + inject.Count + " instructions: " + InstructionHandlers.toString(inject));
                codes.InsertRange(start, inject);
                FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
            }
            catch (Exception e) {
                FileLog.Log("Caught exception when running patch " + MethodBase.GetCurrentMethod().DeclaringType + "!");
                FileLog.Log(e.Message);
                FileLog.Log(e.StackTrace);
                FileLog.Log(e.ToString());
            }
            return(codes.AsEnumerable());
        }
Exemple #20
0
 public int UpdateCancelCompenstionDetails(CompensationDetailsModel objCompensationModel)
 {
     try
     {
         SqlParameter[] objParam = new SqlParameter[4];
         objParam[0] = new SqlParameter("@CompensationID", objCompensationModel.CompensationID);
         objParam[1] = new SqlParameter("@UserID", objCompensationModel.UserID);
         objParam[2] = new SqlParameter("@StatusID", objCompensationModel.StatusID);
         objParam[3] = new SqlParameter("@RequestedOn", objCompensationModel.RequestedOn);
         return(SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "UpdateCancelCompenstionDetails", objParam));
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "CompensationDetailsDAL.cs", "UpdateCancelCompenstionDetails", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
 // GET api/userapi/GetUserIndicatorView   查询用户指标
 /// <summary>
 /// 按照用户ID获取指标信息
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public HttpResponseMessage GetUserIndicatorView(int userid)
 {
     FileLog.WriteLog("InfoApiTime:" + DateTime.Now.ToString() + ",调用:Angel.ControllersApi/ControllerApi/UserApiController/GetUserIndicatorView()方法");
     try
     {
         string        indicatorlist = IndicatorListdata(userid);
         StringBuilder wsql          = new StringBuilder();
         if (indicatorlist.Trim().Length > 2)
         {
             string[] IndicatoryList = { "" };
             JObject  model          = JObject.FromObject(JsonConvert.DeserializeObject("{indicator:" + indicatorlist + "}"));
             IndicatoryList = model["indicator"][0]["indicator_content"].ToString().ToUpper().Split(',');
             //添加用户指标查询条件
             for (int i = 0; i < IndicatoryList.Length; i++)
             {
                 if (i == IndicatoryList.Length - 1)
                 {
                     wsql.Append("'" + IndicatoryList[i] + "'");
                 }
                 else
                 {
                     wsql.Append("'" + IndicatoryList[i] + "',");
                 }
             }
             string Inidjson     = "{\"Indicatorids\": \"" + wsql.ToString() + "\"}";
             var    Indicatorids = Newtonsoft.Json.Linq.JObject.Parse(Inidjson);
             return(GetJSONMessage(QueryService.GetData(Indicatorids, "1_15")));
         }
         else
         {
             return(GetJSONMessage(""));
         }
     }
     catch (Exception er)
     {
         FileLog.WriteLog("Error:调用Angel.ControllersApi/ControllerApi/UserApiController/GetUserIndicatorView()方法," + er.ToString());
         return(GetJSONMessage(""));
     }
 }
Exemple #22
0
        public void dgSubCategories_Status(object sender, DataGridItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    Label lblStatus = (Label)e.Item.FindControl("lblstatus");

                    if (lblStatus.Text == "True")
                    {
                        lblStatus.Text = "Active";
                    }
                    else if (lblStatus.Text == "False")
                    {
                        lblStatus.Text = "Inactive";
                    }
                }
                else if (e.Item.ItemType == ListItemType.EditItem)
                {
                    clsBLSubCategory objClsBLSubCategory = new clsBLSubCategory();
                    dsCategoryID = objClsBLSubCategory.getCategoryID();
                    DropDownList ddlCategory = (DropDownList)e.Item.Cells[3].FindControl("ddlCategory");
                    ddlCategory.DataSource     = dsCategoryID.Tables[0];
                    ddlCategory.DataValueField = dsCategoryID.Tables[0].Columns["CategoryID"].ToString();
                    ddlCategory.DataTextField  = dsCategoryID.Tables[0].Columns["Category"].ToString();
                    ddlCategory.DataBind();
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "subCategoryMaster.aspx", "dgSubCategories_Status", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
        internal static void Log(string text, LogLevel level, LogType type, string caller)
        {
            if (type.Contains(LogType.None) || type.Contains(LogType.Custom))
            {
                AddToFile(caller, $"{DateTime.Now.ToShortTimeString()} [{caller}] [{level:f}] {text}");
            }

            if (type.Contains(LogType.Harmony))
            {
                FileLog.Log($"{DateTime.Now.ToShortTimeString()} [{caller}] [{level:f}] {text}");
            }

            if (type.Contains(LogType.Console))
            {
                Console.WriteLine($"[{caller}] [{level:f}] {text}");
            }

            if (type.Contains(LogType.PlayerScreen))
            {
                ErrorMessage.AddDebug($"{DateTime.Now.ToShortTimeString()} [{caller}] [{level:f}] {text}");
            }
        }
Exemple #24
0
        /// <summary>
        /// 删除设备信息
        /// </summary>
        /// <param name="Mm_id">类型ID号</param>
        /// <returns></returns>
        public APIRst SetYdModelsOnDel(int Mm_id)
        {
            APIRst rst = new APIRst();

            try
            {
                if (Mm_id == 0)
                {
                    throw new Exception("设备采集码ID不能为空");
                }
                int cc = bll.SetYdModelsOnDel(Mm_id);
                rst.data = cc == 0 ? "此类型可能已删除" : cc.ToString();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取充值参数信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Exemple #25
0
        /// <summary>
        /// 获取区域权限信息
        /// </summary>
        /// <param name="id">权限ID</param>
        /// <returns></returns>
        public APIRst GetAreaById(int id)
        {
            APIRst rst = new APIRst();

            try
            {
                int total   = 0;
                int role_id = CommFunc.ConvertDBNullToInt32(id);
                //var dt2 = bll.GetAreaById2();
                List <Treeview> dt  = bll.GetAreaById(role_id, WebConfig.SysProject, out total);
                object          obj = new { total = total, rows = dt };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取区域树形列表错误(GetAreaById):" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Exemple #26
0
        public DataSet GetStatusList()
        {
            DataSet dsStatusList;

            dsStatusList = new DataSet();
            try
            {
                dsStatusList = SqlHelper.ExecuteDataset(sqlConn, CommandType.StoredProcedure, "sp_GetStatusList");
                return(dsStatusList);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }

            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLStatus.cs", "GetStatusList", ex.StackTrace);
                throw new V2Exceptions();
            }
        }
Exemple #27
0
        public async Task <JsonResult> UpdateFileStatus(string fileName)
        {
            var db     = new ApplicationDbContext();
            var record = new FileLog();

            //add record properties
            record.FileName   = fileName;
            record.CreateDate = DateTime.Now;
            record.BaseDate   = DateTime.Now;
            record.FilePath   = AppDomain.CurrentDomain.BaseDirectory + "Uploads\\LogFiles\\" + fileName;
            record.Status     = FileStatus.OK;
            record.ClientID   = 1;
            record.AssetID    = 1;
            record.Archived   = false;
            record.DeleteInd  = false;
            record.TranLogID  = null;

            db.FileLogs.Add(record);
            db.SaveChanges();

            return(Json("File processed"));
        }
    // 加载Manifest
    private void LoadAssetBundleManifest()
    {
        string path = Path.Combine(AppConst.LOCAL_DOWNLOAD_PATH, "AB");

        if (File.Exists(Path.Combine(Application.streamingAssetsPath, "AB", "AB")))
        {
            path = Path.Combine(Application.streamingAssetsPath, "AB", "AB");
        }
        AssetBundle ab = AssetBundle.LoadFromFile(path);

        if (ab == null)
        {
            FileLog.LogError("<AB.manifest> 不存在于目录:" + path);
            return;
        }
        else
        {
            _manifest = ab.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            // 压缩包释放掉
            ab.Unload(false);
        }
    }
Exemple #29
0
        private void Initialize()
        {
            if (_waitForDebugger)
            {
                _logger.Warning("Waiting for debugger to attach. Hit any key to bypass.");

                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(TimeSpan.FromSeconds(1));
                }

                Debugger.Break();
            }

            SetThreadPoolSizes();

            if (_fileLog == null)
            {
                _fileLog = new FileLog(_logDirectoryPath, null, _fileLogSeverity, _logAutoFlush, _logMaxFileSize, _logMaxFileCount);
                _logger.AddLog(_fileLog);
            }
        }
Exemple #30
0
        //check for the missing Sign out entries. Employee will not be allowed to sign in unless he has singed out for the corr sign-ins.
        public DataSet CheckMissingSignOut(SignInSignOutModel objSignInSignOutModel)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@EmployeeID", SqlDbType.Int);
                param[0].Value = objSignInSignOutModel.EmployeeID;

                dsSignInSignOutDAL = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, "CheckMissingSignOut", param);
                return(dsSignInSignOutDAL);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "SignInSignOutDAL", "CheckMissingSignOut", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #31
0
        //wf


        #region WFGetCompensationDetails

        public DataSet WFGetCompensationDetails(int compensationID)
        {
            try
            {
                DataSet        GetCompensationDetails;
                SqlParameter[] objParam = new SqlParameter[1];
                objParam[0] = new SqlParameter("@CompensationID", compensationID);

                GetCompensationDetails = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, "WFGetCompensationDetails", objParam);
                return(GetCompensationDetails);
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "CompensationDetailsDAL.cs", "WFGetCompensationDetails", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Exemple #32
0
        static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = new List <CodeInstruction>(instructions);

            try {
                FileLog.Log("Running patch " + MethodBase.GetCurrentMethod().DeclaringType);
                int loc = InstructionHandlers.getInstruction(codes, 0, 0, OpCodes.Callvirt, "Segment", "SearchEntity", true, new Type[] { typeof(long), typeof(long), typeof(long) });
                FileLog.Log("Found match at pos " + InstructionHandlers.toString(codes, loc));
                codes.RemoveAt(loc + 1);               //isinst
                codes[loc].operand = InstructionHandlers.convertMethodOperand("ReikaKalseki.FortressTweaks.FortressTweaksMod", "getStorageHandlerForEntityForBelt", false, new Type[] { typeof(Segment), typeof(long), typeof(long), typeof(long), typeof(ConveyorEntity) });
                codes.Insert(loc, new CodeInstruction(OpCodes.Ldarg_0));
                FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
                //FileLog.Log("Codes are "+InstructionHandlers.toString(codes));
            }
            catch (Exception e) {
                FileLog.Log("Caught exception when running patch " + MethodBase.GetCurrentMethod().DeclaringType + "!");
                FileLog.Log(e.Message);
                FileLog.Log(e.StackTrace);
                FileLog.Log(e.ToString());
            }
            return(codes.AsEnumerable());
        }
Exemple #33
0
 private void dgStatus_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
     try
     {
         //			pnlAddEditStatus.Visible=false;
         if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
         {
             LinkButton lnkDel = (LinkButton)(e.Item.Cells[0].FindControl("lnkDelete"));
             lnkDel.Attributes.Add("onClick", "return confirm('Do you want to delete this record?')");
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "StatusMaster.aspx", "dgStatus_ItemCreated", ex.StackTrace);
         throw new V2Exceptions(ex.ToString(), ex);
     }
 }
Exemple #34
0
 public void getStatus()
 {
     try
     {
         dsGetStatus = objOutOfOfficeBOL.GetStatus();
         ddlStatus.Items.Add(new ListItem("All", "0"));
         for (int i = 0; i < dsGetStatus.Tables[0].Rows.Count; i++)
         {
             ddlStatus.Items.Add(new ListItem(dsGetStatus.Tables[0].Rows[i]["StatusName"].ToString(), dsGetStatus.Tables[0].Rows[i]["StatusID"].ToString()));
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "OutOfOffice.aspx.cs", "getStatus", ex.StackTrace);
         throw new V2Exceptions();
     }
 }
Exemple #35
0
 public void getReason()
 {
     try
     {
         dsGetResonName = objOutOfOfficeBOL.GetReasonName();
         for (int i = 0; i < dsGetResonName.Tables[0].Rows.Count; i++)
         {
             rdbType.Items.Add(new ListItem(dsGetResonName.Tables[0].Rows[i]["Reason"].ToString(), dsGetResonName.Tables[0].Rows[i]["TypeId"].ToString()));
             rdbType.SelectedValue = "2";
         }
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "OutOfOffice.aspx.cs", "getReason", ex.StackTrace);
         throw new V2Exceptions();
     }
 }
Exemple #36
0
 protected void grdSignInSignOut_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     try
     {
         grdSignInSignOut.EditIndex = -1;
         getOutOfOffice();
         //tdAddDetails.Visible = true;
         //tdSearch.Visible = false;
         //td1.Visible = false;
         getSearchDetails();
     }
     catch (V2Exceptions ex)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         FileLog objFileLog = FileLog.GetLogger();
         objFileLog.WriteLine(LogType.Error, ex.Message, "OutOfOffice.aspx.cs", "btnUpdate_Click", ex.StackTrace);
         throw new V2Exceptions();
     }
 }
        private void DoConversion()
        {
            filer.Clear();

            inn_sti = txtInPath.Text;
            ut_sti = txtOutPath.Text;

            if (rbFileType.Checked)
                filtype="doc|docx";
            if (rbFileType1.Checked)
                filtype="rtf";
            if (rbFileType2.Checked)
                filtype="txt";

            if (log_sti == string.Empty)
                log_sti = inn_sti;

            //Init log
            log = new FileLog(log_sti);

            // les passordfil
            if (txtPasswordFile.Text != "")
            {
                string separator = (rbSeparator1.Checked ? "," : rbSeparator2.Checked ? ";" : "");
                StreamReader sr = File.OpenText(txtPasswordFile.Text);
                while (!sr.EndOfStream)
                {
                    string[] passordStringArray = sr.ReadLine().Split(separator.ToCharArray());

                    passordStringArray[0] = Path.GetFileName(passordStringArray[0].ToLower());

                    if (!passwordList.ContainsKey(passordStringArray[0].ToLower()))
                        passwordList.Add(passordStringArray[0].ToLower(), passordStringArray[1]);
                }

                LogFromThread(progress, "Lest passordfil med totalt " + passwordList.Count + " passord" + Environment.NewLine);
            }

            if (inn_fil != string.Empty)
            {
                LogFromThread(progress, "Åpner inn_fil = " + inn_fil + "..." + Environment.NewLine);

                StreamReader sr = File.OpenText(inn_fil);
                List<string> tmp = new List<string>();

                while (!sr.EndOfStream)
                    filer.Add(sr.ReadLine());

                LogFromThread(progress, "Ferdig med å lese inn_fil med totalt " + filer.Count + " filer" + Environment.NewLine);

            }
            else
            {

                LogFromThread(progress, "Finner filer... " + Environment.NewLine);

                if (filtype.Contains("|"))
                {
                    // Mange filtyper..
                    foreach (string ftype in filtype.Split("|".ToCharArray()))
                    {
                        if (filer == null)
                            filer = Directory.GetFiles(inn_sti, "*." + ftype, (chkRecursive.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)).ToList<string>();
                        else
                            filer.AddRange(Directory.GetFiles(inn_sti, "*." + ftype, (chkRecursive.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)).ToList<string>());
                    }
                }
                else
                {
                    // Hvis ingen passordfil er oppgitt, kjøres det kun mot eksisterende filer.
                    try
                    {
                        filer = Directory.GetFiles(inn_sti, "*." + filtype, (chkRecursive.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)).ToList<string>();
                    }
                    catch (UnauthorizedAccessException ex)
                    {
                        LogFromThread(progress, "Du har ikke lesetilgang til en eller flere mapper i InnSti (" + inn_sti + ")" + Environment.NewLine + "Vennligst kontroller tilgang og prøv igjen. Feilmelding var :" + Environment.NewLine + ex.Message + Environment.NewLine);
                        MessageBox.Show("Du har ikke lesetilgang til en eller flere mapper i InnSti (" + inn_sti + ")" + Environment.NewLine + "Vennligst kontroller tilgang og prøv igjen. Feilmelding var :" + Environment.NewLine + ex.Message + Environment.NewLine);
                    }
                }

                LogFromThread(progress, filer.Count + " funnet..." + Environment.NewLine);
            }


            // fjerne rtf-filer som benyttes til brevfletting

            LogFromThread(progress, "Finner filer som ikke skal være med... Dette kan ta en del tid.. " + Environment.NewLine);

            int tmpcnt = 0;
            if (rbFileType.Checked) // Kun nødvendig å kjøre sjekk mot word-filer.
            {
                LogFromThread(progress, "Finner temporære word-filer (inneholder ~)" + Environment.NewLine);
                foreach (string fil in filer)
                {
                    if (fil.Contains("~"))
                    {
                        filersomskalfjernes.Add(fil); // fjern word-temp-filer
                        continue;
                    }
                }
                tmpcnt = 0;
            }
            if (!chkOverwrite.Checked)
            {
                LogFromThread(0, "Finner allerede konverterte filer (PDF-versjon eksisterer)" + Environment.NewLine);
                foreach (string fil in filer)
                {
                    tmpcnt++;
                    if (tmpcnt % 1000 == 0)
                        LogFromThread(0, tmpcnt + " kontrollert.." + Environment.NewLine);
                    if (!chkOverwrite.Checked && File.Exists(Path.ChangeExtension(fil, "pdf")))
                    {
                        filersomskalfjernes.Add(fil); // fjern word-temp-filer
                        continue;
                    }
                }
            }
            tmpcnt = 0;
            /* Ikke nødvendig, for hvis man har krysset av for doc, vil ingen rtf-filer ligge i filer-array.
             * Har man krysset av for rtf eller txt, er ikke dette en aktuell sjekk å kjøre.
            if (rbFileType.Checked) // Kun nødvendig å kjøre sjekk mot word-filer.
            {
                if (filtype.Contains("doc"))
                {
                    LogFromThread(0, "Finner duplikater (doc/rtf-par som er flettedatafil-par)..." + Environment.NewLine);
                    foreach (string fil in filer)
                    {
                        tmpcnt++;
                        if (tmpcnt % 1000 == 0)
                            LogFromThread(0, tmpcnt + " kontrollert.." + Environment.NewLine);

                        //if (Debugger.IsAttached)
                        //{
                        //    if (tmpcnt > 2000)
                        //        break;
                        //}

                        string filetosearchfor = Path.GetFileNameWithoutExtension(fil);
                        List<string> hits = filer.FindAll(file => Path.GetFileNameWithoutExtension(file) == filetosearchfor);
                        if (hits.Count > 1)
                        {
                            if (!filersomskalfjernes.Contains(Path.ChangeExtension(fil, "RTF")))
                                filersomskalfjernes.Add(Path.ChangeExtension(fil, "RTF"));
                        }
                    }
                }
            }
            */

            LogFromThread(0, "Funnet " + filersomskalfjernes.Count + " filer som ikke skal konverteres" + Environment.NewLine);
            foreach (string fil in filersomskalfjernes)
                filer.Remove(fil);

            LogFromThread(0, "Totalt antall filer for konvertering: " + filer.Count + Environment.NewLine);

            // ********************************************************

            #region processqueue
            if (jumpAhead > filer.Count)
            {
                LogFromThread(0, "Hopp-over-teller er større en antall filer i prosesseringskø. Vennligst oppgi et mindre antall." + Environment.NewLine);
                return;
            }

            for (int a = jumpAhead; a < filer.Count; a++)
            {
                if (backgroundWorker1.CancellationPending)
                {
                    LogFromThread((100 / filer.Count) * a, Environment.NewLine + "Konvertering avbrutt av operatør." + Environment.NewLine);
                    break;
                }
                ProcessFile(filer[a], a);
                
            }
            #endregion

            // Quit Word and release the ApplicationClass object.
            CloseApplication();
            FileLog.CloseLog();
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
            GC.WaitForPendingFinalizers();
           
        }
    protected virtual void Page_Init(object sender, EventArgs e)
    {
        dtPageStartTime = DateTime.Now;

        if (Context.Session != null)
        {
            bool bIsNewSessionOverride = false;

            if (Context.Items["IsNewSessionOverride"] != null)
                bIsNewSessionOverride = (bool)Context.Items["IsNewSessionOverride"];

            if (Session.IsNewSession && !bIsNewSessionOverride)
            {
                Response.Redirect("~/Default.aspx");
                return;
            }

        }

        bIsProduction = XnGR_WBS_Page.IsProductionMode();

        if (ConfigurationManager.AppSettings["WBSBookingMode"] == "Production")
            bIsBookThrough = true;
        else
            bIsBookThrough = false;

        if (ConfigurationManager.AppSettings["GuestDetailsTestPrefill"] == "1")
            bIsGuestDetailsTestPrefill = true;
        else
            bIsGuestDetailsTestPrefill = false;

        bIsParentPreRender = false;
        bIsDeepLinkNav = false;

        objEventLog = (FileLog)Application["EventLog"];
        objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"];

        wbsAPIRouter = WBSAPIRouter.GetWbsApiRouter(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSAPIRouter.RequestExpirationSeconds"], (int)Application["WBSAPIRouter.WindowUnitSeconds"], (int)Application["WBSAPIRouter.WindowUnits"]);
        wbsAPIRouterData = null;
        wbsIISAsyncResult = null;

        wbsAPI = new WBSAPIRouterHelper(Session, Page, objEventLog, objExceptionEventLog, bIsProduction);
        wbsPG = new WBSPGHelper(Session, Page, objEventLog, objExceptionEventLog, bIsProduction);
        wbsUI = new WBSUIHelper(Session, Page);

        wbsPerfCounters = WBSPerfCounters.GetWbsPerfCounters(Context.Cache, objEventLog, objExceptionEventLog, (string)Application["WBSPerfCounters.PerformanceMonitorGroupName"]);
        wbsServiceTimesUpdater = WBSServiceTimesUpdater.GetWbsServiceTimesUpdater(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSAPIRouter.RequestExpirationSeconds"], (int)Application["WBSAPIRouter.WindowUnitSeconds"], (int)Application["WBSAPIRouter.WindowUnits"], (string)Application["WBSPerfCounters.PerformanceMonitorGroupName"]); // retrieved only as a "keep-alive" mechanism

        wbsMonitor = WBSMonitor.GetWbsMonitor(Context.Cache, objEventLog, objExceptionEventLog, bIsProduction, (int)Application["WBSMonitor.ExpirationSeconds"]); // Used for pending prepay bookings logging

        this.InitPageErrors();

        if (!IsPostBack)
        {
            if (Request.QueryString.Get("CrossPageErrors") == "1")
                this.RestoreCrossPageErrors();

            if (Request.QueryString.Get("DeepLinkNav") == "1") // used wtih Response.Redirect
                bIsDeepLinkNav = true;

            if ((string)Context.Items["DeepLinkNav"] == "1") // used with Server.Transfer
                bIsDeepLinkNav = true;
        }

        return;
    }
Exemple #39
0
        static void Main(string[] args)
        {
            //Initialise logging to the console &  a file
            Log consoleLog = new ConsoleLog(LOG_LEVEL);
            Log fileLog;
            bool dirCreated = false;
            if (!Directory.Exists(LOGS_DIR_PATH))
            {
                dirCreated = true;
                System.IO.Directory.CreateDirectory(LOGS_DIR_PATH);
            }

            int logAttempt = 0;
            while(true)
            {
                string logName = String.Format("{0}/Quantitative_Evaluation_DefaultLog.{1}.{2:000}.log", LOGS_DIR_PATH, DateTime.Now.ToString("yyyy-MM-dd"), logAttempt);
                if (!System.IO.File.Exists(logName))
                {
                    fileLog = new FileLog(logName, LOG_LEVEL);
                    DefaultLog.Info("Log Initialised");
                    break;
                }
                logAttempt++;
            }
            DefaultLog.Log = new CompoundLog(consoleLog, fileLog);
            if (dirCreated)
            {
                DefaultLog.Warn("Logs Directory was not found, creating . . .");
            }

            //If the directories for storing Classifiers don't exist, make them now
            if (!Directory.Exists(CLASSIFIERS_PATH))
            {
                DefaultLog.Info("Classifiers Directory didn't exist, creating . . .");
                Directory.CreateDirectory(CLASSIFIERS_PATH);
            }
            if (!Directory.Exists(NEURAL_NETWORKS_PATH))
            {
                DefaultLog.Info("Neural Networks Path didn't exist, creating . . .");
                Directory.CreateDirectory(NEURAL_NETWORKS_PATH);
            }

            //Load the Wordsearch Database
            DefaultLog.Info("Loading Wordsearch Database . . .");
            ImageMarkupDatabase.LoadDatabase();
            DefaultLog.Info("Wordsearch Database Loaded");

            //TODO: Change to some pre-determined split rather than splitting at runtime
            //Split the Wordsearch Images into 3 groups: training, cross-validation & evaluation
            DefaultLog.Info("Splitting Wordsearch Image data into Training, Cross-Validation & Evaluation data sets");
            List<WordsearchImage> wordsearchImages = ImageMarkupDatabase.GetWordsearchImages();

            List<WordsearchImage> trainingWordsearchImages = new List<WordsearchImage>();
            List<WordsearchImage> crossValidationWordsearchImages = new List<WordsearchImage>();
            List<WordsearchImage> evaluationWordsearchImages = new List<WordsearchImage>();

            //Split the images from 2014.02.20 into the three groups & add all of the 2014.05.18 images to the evaluation data set
            int oldImagesNum = 0;
            foreach(WordsearchImage wordsearchImage in wordsearchImages)
            {
                string imgPath = wordsearchImage.FromImage.Path;

                //If this image is in the old image directory (the one being split amongst the 3 data sets)
                if(imgPath.Substring(0, OLD_IMAGES_PATH.Length) == OLD_IMAGES_PATH)
                {
                    //Determine which data set to put the image in
                    if (oldImagesNum % 3 == 0)
                    {
                        trainingWordsearchImages.Add(wordsearchImage);
                    }
                    else if(oldImagesNum % 3 == 1)
                    {
                        crossValidationWordsearchImages.Add(wordsearchImage);
                    }
                    else
                    {
                        evaluationWordsearchImages.Add(wordsearchImage);
                    }
                    oldImagesNum++;
                }
                else //Otherwise this image in in the new image directory and should be put in the evaluation data set
                {
                    evaluationWordsearchImages.Add(wordsearchImage);
                }
            }

            DefaultLog.Info("Data split into Training, Cross-Validation & Evalutaion data");

            //If we're evaluating neural networks
            if (EVALUATE_NEURAL_NETWORKS)
            {
                //Evaluate all of the neural network combo's
                DefaultLog.Info("Starting to evaluate all Neural Networks . . .");
                IDictionary<string, NeuralNetworkEvaluator> neuralNetworkEvalResults =
                    EvaluateNeuralNetworks.evaluateNeuralNetworks(trainingWordsearchImages,
                    crossValidationWordsearchImages, evaluationWordsearchImages);
                DefaultLog.Info("Evaluation of all Neural Networks completed");

                //Write out the evaluation results
                if (!Directory.Exists(EVALUATION_RESULTS_DIR_PATH))
                {
                    DefaultLog.Info("Evaluation Results Directory didn't exist, creating . . .");
                    Directory.CreateDirectory(EVALUATION_RESULTS_DIR_PATH);
                }

                DefaultLog.Info("Writing out Neural Network Evaluation Results . . .");
                foreach (KeyValuePair<string, NeuralNetworkEvaluator> pair in neuralNetworkEvalResults)
                {
                    string networkName = pair.Key;
                    ConfusionMatrix cm = pair.Value.ConfusionMatrix;

                    DefaultLog.Info("Network \"{0}\" misclassified {1}/{2}", networkName,
                        cm.NumMisclassifications, cm.TotalClassifications);

                    try
                    {
                        cm.WriteToCsv(EVALUATION_RESULTS_DIR_PATH + "/" + networkName + ".csv");
                    }
                    catch (Exception e)
                    {
                        DefaultLog.Error("Error writing Confusion Matrix to file " + EVALUATION_RESULTS_DIR_PATH + "/" + networkName + ".csv");
                        Console.WriteLine(e);
                    }
                }
                DefaultLog.Info("Neural Network Evaluation results written out successfully");
            }
            
            //If we're evaluating Wordsearch rotation correction
            if(EVALUATE_WORDSEARCH_ROTATION_CORRECTION)
            {
                DefaultLog.Info("Starting to evaluate Wordsearch Rotation Correction");

                //Get the Feature Reduction Algorithm to be used
                DefaultLog.Info("Loading Feature Extraction Algorithm . . .");
                //Load a pre-trained feature reduction algorithm rather than training on the training data every time
                FeatureExtractionPCA featureExtractionAlgorithm = (FeatureExtractionPCA)TrainableFeatureExtractionAlgorithm.Load(
                    FEATURE_EXTRACTORS_PATH + PCA_ALL_FEATURES_FILE_NAME + FEATURE_EXTRACTORS_FILE_EXTENSION);
                DefaultLog.Info("Feature Extraction Algorithm Loaded");

                //Get the classifier to be used
                DefaultLog.Info("Loading Classifier . . .");
                Classifier classifier = new AForgeActivationNeuralNetClassifier(featureExtractionAlgorithm, 
                    NEURAL_NETWORKS_PATH + "SingleLayer Sigmoid BkPropLearn PCAAllFeatures" + NEURAL_NETWORK_FILE_EXTENSION);
                DefaultLog.Info("Classifier Loaded");

                //Evaluate the wordsearch Image Rotation Correction
                double rotationCorrectionRate = EvaluateWordsearchRotationCorrection.Evaluate(evaluationWordsearchImages, classifier);
                DefaultLog.Info("Wordsearch Rotation Correction returned the correct answer {0}% of the time", rotationCorrectionRate * 100);

                DefaultLog.Info("Wordsearch Rotation Correction Evaluation complete");
            }

            //If we're evaluating Wordsearch Segmentation
            if(EVALUATE_WORDSEARCH_SEGMENTATION)
            {
                /*
                 * Note that here all Wordsearch Images are used for evaluation (essentially they are all in the evaluation data set)
                 * This is because the training & cross validation data haven't been used to develop the algorithms, meaning that they 
                 * are fresh data and can be used for evaluation
                 */

                DefaultLog.Info("Starting to evaluate Wordsearch Segmentation");

                //Evaluate by the number of rows and cols returned
                Dictionary<string, double> scoresByNumRowsCols = EvaluateWordsearchSegmentation.EvaluateByNumRowsAndCols(wordsearchImages);

                //Print out scores
                DefaultLog.Info("Scores for Evaluation by Number of Rows and Cols");
                printScores(scoresByNumRowsCols);

                DefaultLog.Info("Wordsearch Segmentation Evaluation complete");
            }

            //If we're evaluating Wordsearch Recognition
            if(EVALUATE_WORDSEARCH_DETECTION)
            {
                /*
                 * Note that here all Images are used for evaluation (essentially they are all in the evaluation data set)
                 * This is because the training & cross validation data haven't been used to develop the algorithms, meaning
                 * that they are fresh data and can be used for evaluation
                 */

                DefaultLog.Info("Starting to evaluate Wordsearch Recognition");

                Dictionary<string, double> scores = EvaluateWordsearchDetection.EvaluateReturnsWordsearch(ImageMarkupDatabase.GetImages());

                //Print out scores
                DefaultLog.Info("Scores for Evaluation based on a single wordsearch returned (the best candidate)");
                printScores(scores);

                DefaultLog.Info("Wordsearch Recognition Evaluation Complete");
            }

            //If we're evaluating the Full System
            if(EVALUATE_FULL_SYSTEM)
            {
                /*
                 * This evaluation stage uses Images rather than WordsearchImages, and the Images used must not contain any WordsearchImages 
                 * from the training or cross-validation data sets
                 */

                DefaultLog.Info("Building the collection of Evaluation Images . . .");

                //Compile a list of the hashes of the Images that contain each WordsearchImage in the training & cross-validation data sets
                HashSet<string> usedImageHashes = new HashSet<string>();
                List<WordsearchImage> usedWordsearchImages = new List<WordsearchImage>(trainingWordsearchImages);
                usedWordsearchImages.AddRange(crossValidationWordsearchImages);
                foreach(WordsearchImage wordsearchImage in usedWordsearchImages)
                {
                    usedImageHashes.Add(wordsearchImage.FromImageHash);
                }

                //Now build a list of Images whose hash aren't present in the set of used hashes
                List<Image> allImages = ImageMarkupDatabase.GetImages();
                List<Image> evaluationImages = new List<Image>();
                foreach(Image image in allImages)
                {
                    if(!usedImageHashes.Contains(image.Hash))
                    {
                        evaluationImages.Add(image);
                    }
                }

                DefaultLog.Info("Collection of Evaluation Images built");

                DefaultLog.Info("Starting to Evaluate the Full System");

                Dictionary<string, double> scores = EvaluateFullSystem.Evaluate(evaluationImages);

                //Print out scores
                DefaultLog.Info("Scores for Evaluation of the Full System");
                printScores(scores);

                DefaultLog.Info("Full System Evaluation Complete");
            }

            //If we're evaluating the stages after Wordsearch Detection (Segmentation to Solver)
            if(EVALUATE_STAGES_SEGMENTATION_TO_SOLVER)
            {
                DefaultLog.Info("Starting to Evaluate the stages from Segmentation until Solving");

                Dictionary<string, double> scores = EvaluateSegmentationToSolver.Evaluate(evaluationWordsearchImages);

                //Print out scores
                DefaultLog.Info("Scores for Evaluation of the stages Segmentation to Solver");
                printScores(scores);

                DefaultLog.Info("Evaluation of stages Segmentation to Solving complete");
            }
        }
        public ActionResult UploadFiles(Files newfile, FormCollection form, int pid = 0)
        {
            using (var uow = _unitOfWorkFactory.UnitOfWork)
            {
                // Save the uploaded file
                HttpPostedFileBase file = Request.Files["uploadFile"];
                newfile.FileName = file.FileName;
                if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName))
                {
                    string fileName = file.FileName;
                    string fileContentType = file.ContentType;
                    byte[] fileBytes = new byte[file.ContentLength];
                    newfile.FilePath = Path.Combine(Server.MapPath("~/UploadedFiles"), fileName);
                    newfile.Description = form["description"];
                    file.SaveAs(newfile.FilePath);
                }

                var project = _projectRepository.GetById(pid);
                newfile.Project = project;
                _fileRepository.SaveOrUpdate(newfile);
                var newfilelog = new FileLog()
                {
                    User = _userRepository.GetById((int)Session["UserID"]),
                    Date = DateTime.Now,
                    Status = "Uploaded",
                    Project = project,
                    Files = newfile,
                    Note = newfile.FileName + " is uploaded to " + project.ProjectName
                };

                _fileLogRepository.SaveOrUpdate(newfilelog);

                uow.SaveChanges();
                return RedirectToAction("Details", new { id = pid });
            }
        }