protected void btnGoToJournal_Click(object sender, EventArgs e)
    {
        string strLink = "";

        using (EmployeeJournal objEmployeeJournal = new EmployeeJournal())
        {
            if (EmployeeJournal.HasExistingJournal(Request.Cookies["Speedo"]["UserName"].ToString(), Convert.ToInt16(WeekYear.GetActiveWeekCode())))
            {
                if (EmployeeJournal.GetJournalStatus(Convert.ToInt16(EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()))).ToString() == "S" && EmployeeJournal.GetLockStatus(Convert.ToInt16(EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()))).ToString() == "0")
                {
                    strLink = "JournalEncoding";
                    Response.Redirect("JournalEncoding.aspx?JournalCode=" + EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()).ToString());
                }
                else if (EmployeeJournal.GetJournalStatus(Convert.ToInt16(EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()))).ToString() == "F" && EmployeeJournal.GetLockStatus(Convert.ToInt16(EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()))).ToString() == "0")
                {
                    strLink = "JournalEncodingM";
                    Response.Redirect("JournalEncodingM.aspx?JournalCode=" + EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()).ToString());
                }
                else
                {
                    strLink = "JournalViewer";
                    Response.Redirect("JournalViewer.aspx?JournalCode=" + EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString()).ToString());
                }
            }
            else
            {
                objEmployeeJournal.WeekCode   = Convert.ToInt16(WeekYear.GetActiveWeekCode());
                objEmployeeJournal.Enabled    = "1";
                objEmployeeJournal.CreatedBy  = Request.Cookies["Speedo"]["UserName"].ToString();
                objEmployeeJournal.CreatedOn  = DateTime.Now;
                objEmployeeJournal.ModifiedBy = Request.Cookies["Speedo"]["UserName"].ToString();
                objEmployeeJournal.ModifiedOn = DateTime.Now;
                if (objEmployeeJournal.Insert() > 0)
                {
                    Response.Redirect("JournalEncoding.aspx");
                }
            }
        }
    }