protected void Page_Load(object sender, EventArgs e)
        {
            if (DB == null)
            {
                DB = DBHandler.Instance;
            }

            EditOrAddLabel.Text = (Session["TaskToEdit"] == null) ? "Add new task" : "Edit task";
            SubmitChanges.Text  = (Session["TaskToEdit"] == null) ? "Create task" : "Save changes";

            for (int i = 1; i <= 31; i++)
            {
                StartTaskDay.Items.Add(i.ToString());
                EndTaskDay.Items.Add(i.ToString());
            }

            for (int i = 1; i <= 12; i++)
            {
                StartTaskMonth.Items.Add(i.ToString());
                EndTaskMonth.Items.Add(i.ToString());
            }

            for (int i = DateTime.Now.Year; i <= DateTime.Now.Year + 20; i++)
            {
                StartTaskYear.Items.Add(i.ToString());
                EndTaskYear.Items.Add(i.ToString());
            }

            if (!IsPostBack)
            {
                if (Session["TaskToEdit"] != null)
                {
                    TTask taskToEdit = DB.getTaskByID((int)Session["TaskToEdit"]);
                    NameOfTheTaskTB.Text = taskToEdit.NameOfTask;
                    TextOFTheTaskTB.Text = taskToEdit.TextOfTask;

                    StartTaskDay.SelectedIndex   = EndTaskDay.SelectedIndex = taskToEdit.StartDate.Value.Day;
                    StartTaskMonth.SelectedIndex = EndTaskMonth.SelectedIndex = taskToEdit.StartDate.Value.Month;
                    EndTaskYear.SelectedIndex    = StartTaskYear.SelectedIndex = 0;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (DB == null)
            {
                DB = DBHandler.Instance;
            }

            if (Session["LoggerUser"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (Session["sharingTasks"] != null)
            {
                sharingTasks.Text = (string)Session["sharingTasks"];
            }
            else
            {
                sharingTasks.Text = String.Empty;
            }

            Session["sharingTasks"] = null;

            User loggedUser = (User)Session["LoggerUser"];

            bool haveAnyTasks = false;

            var tasks = DB.getUserTasks(loggedUser);

            if (tasks != null)
            {
                haveAnyTasks = tasks.Length != 0;
            }

            if (haveAnyTasks)
            {
                makeTable();
            }

            TaskCount.Visible = !haveAnyTasks;
        }