Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Redirect("~/Login.aspx");

        }
        else
        {
            if (!Page.IsPostBack)
            {
                Logic lo = new Logic();
                Label lb = Page.Master.FindControl("lbTitle") as Label;
                lb.Text = "Welcome, to Task Manager Web App";
                lb.ForeColor = Color.Black;

                Label user = Page.Master.FindControl("lbUsername") as Label;
                string u = Session["username"].ToString();
                Person pp = lo.GetPerson(u);
                user.Text = pp.Username;

                int pend, complete, total;
                TaskManagerModelContainer db = new TaskManagerModelContainer();
                pend = lo.GetAllPendingTasks(pp.Id).Count;
                complete = lo.GetAllCompletedTasks(pp.Id).Count;
                total = lo.GetAllTasks(pp.Id).Count;

                Label1.Text = pend.ToString() + " Task(s) Pending";
                Label2.Text = complete.ToString() + " Task(s) Completed";
                Label3.Text = total.ToString() + " Task(s) in Total";
            }
        }
    }
Ejemplo n.º 2
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Panel1.Visible = true;
         Logic lo = new Logic();
         Taskk t = lo.GetSingleTask(drpTitles.SelectedItem.Text);
         int id = lo.GetTaskID(drpTitles.SelectedItem.Text);
         string u = Session["username"].ToString();
         Person pp = lo.GetPerson(u);
         bool delPersonTask = lo.DeletePersonTask(pp.Id, id);
         bool delTask = lo.DeleteTask(id);
         if (delPersonTask == true && delTask == true)
         {
             Label lb = new Label();
             lb.Text = "Task Deleted Successfully...";
             Panel1.CssClass = "divSuccess";
             icon.CssClass = "img";
             icon.ImageUrl = "~/assets/icons/success3.png";
             icon.Visible = true;
             PlaceHolder1.Controls.Add(lb);
             Load();
             txtTitle.Text = "";
             txtDescription.Text = "";
             txtIsCompleted.Text = "";
         }
         else
         {
             Label lb = new Label();
             lb.Text = "Delete Failed";
             Panel1.CssClass = "divError";
             icon.CssClass = "img";
             icon.ImageUrl = "~/assets/icons/error3.png";
             icon.Visible = true;
             PlaceHolder1.Controls.Add(lb);
             Load();
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Redirect("~/Login.aspx");

        }
        else
        {
            if (!Page.IsPostBack)
            {
                Logic lo = new Logic();

                Label lb = Page.Master.FindControl("lbTitle") as Label;
                lb.Text = "Pending Tasks";
                lb.ForeColor = Color.Black;

                Label user = Page.Master.FindControl("lbUsername") as Label;
                string u = Session["username"].ToString();
                Person pp = lo.GetPerson(u);
                user.Text = pp.Username;

                TaskManagerModelContainer db = new TaskManagerModelContainer();

                Pendin p = new Pendin();
                List<Taskk> ts = lo.GetAllPendingTasks(pp.Id);
                List<Pendin> pen = new List<Pendin>();
                List<string> fr = new List<string>();
                for (int i = 0; i < ts.Count; i++)
                {
                    fr.Add(ts[i].Title);
                }

                drpTitles.DataSource = fr;
                drpTitles.DataBind();

            }
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Redirect("~/Login.aspx");

        }
        else
        {
            if (!Page.IsPostBack)
            {
                Logic lo = new Logic();
                Label lb = Page.Master.FindControl("lbTitle") as Label;
                lb.Text = "Add New Task";
                lb.ForeColor = Color.Black;

                Label user = Page.Master.FindControl("lbUsername") as Label;
                string u = Session["username"].ToString();
                Person pp = lo.GetPerson(u);
                user.Text = pp.Username;
            }
        }
    }
Ejemplo n.º 5
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Logic lo = new Logic();
        Taskk t = new Taskk();
        t.Title = tasktitle.Value;
        t.Description = taskdesc.Value;
        t.IsComplete = false;

        //DateTime.Parse(Calendar1.SelectedDate)
        if (tasktitle.Value.Length == 0 || taskdesc.Value.Length == 0)
        {
            Label lb = new Label();
            lb.Text = "Empty Fields Are Not Allowed";
            Panel1.CssClass = "divError";
            icon.CssClass = "img";
            icon.ImageUrl = "~/assets/icons/error3.png";
            icon.Visible = true;
            PlaceHolder1.Controls.Add(lb);
        }
        else if (tasktitle.Value.Length != 0 && taskdesc.Value.Length != 0)
        {
            if (Calendar1.SelectedDate != null)
            {
                t.DateCreated = (DateTime)Calendar1.SelectedDate;
                bool resp1 = lo.CreateTask(t);
                int last = lo.GetLastTaskID();
                PersonTask pt = new PersonTask();
                string u = Session["username"].ToString();
                Person pp = lo.GetPerson(u);
                pt.PersonId = pp.Id; //lo.GetPersonID("ay");
                pt.TaskkId = last;
                bool resp2 = lo.CreatePersonTask(pt);
                if (resp1 == true && resp2 == true)
                {
                    Label lb = new Label();
                    lb.Text = "New Task Added Successfully";
                    Panel1.CssClass = "divSuccess";
                    icon.CssClass = "img";
                    icon.ImageUrl = "~/assets/icons/success3.png";
                    icon.Visible = true;
                    PlaceHolder1.Controls.Add(lb);
                }
                else if (resp1 != true || resp2 != true)
                {
                    Label lb = new Label();
                    lb.Text = "New Task Could Not Be Added";
                    Panel1.CssClass = "divError";
                    icon.CssClass = "img";
                    icon.ImageUrl = "~/assets/icons/error3.png";
                    icon.Visible = true;
                    PlaceHolder1.Controls.Add(lb);
                }
            }
            else if (Calendar1.SelectedDate == null)
            {

                Label lb = new Label();
                lb.Text = "No Date Selected";
                Panel1.CssClass = "divError";
                icon.CssClass = "img";
                icon.ImageUrl = "~/assets/icons/error3.png";
                icon.Visible = true;
                PlaceHolder1.Controls.Add(lb);
            }
        }
    }
Ejemplo n.º 6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        try
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            if (username.Length == 0 || password.Length == 0)
            {
                Label lb = new Label();
                lb.Text = "Empty Fields Are Not Allowed.";
                Panel1.CssClass = "divError";
                icon.CssClass = "img";
                icon.ImageUrl = "~/assets/icons/error3.png";
                icon.Visible = true;
                PlaceHolder1.Controls.Add(lb);
            }
            else if (username.Length != 0 && password.Length != 0)
            {
                TaskManagerModelContainer db = new TaskManagerModelContainer();
                Logic lo = new Logic();
                List<string> users = (from d in db.People select d.Username).ToList();
                if (users.Contains(username))
                {
                    Person p = lo.GetPerson(username);
                    if (p.Password == password)
                    {
                        Session["username"] = username;
                        Response.Redirect("~/Cpanel/Default.aspx");
                    }
                    else if (p.Password != password)
                    {
                        Label lb = new Label();
                        lb.Text = "Invalid Username or Password";
                        Panel1.CssClass = "divError";
                        icon.CssClass = "img";
                        icon.ImageUrl = "~/assets/icons/error3.png";
                        icon.Visible = true;
                        PlaceHolder1.Controls.Add(lb);
                    }
                }
                else if (!users.Contains(username))
                {
                    Label lb = new Label();
                    lb.Text = "Invalid Username or Password";
                    Panel1.CssClass = "divError";
                    icon.CssClass = "img";
                    icon.ImageUrl = "~/assets/icons/error3.png";
                    icon.Visible = true;
                    PlaceHolder1.Controls.Add(lb);
                }
            }
        }
        catch
        {
            Label lb = new Label();
            lb.Text = "Login Failed";
            Panel1.CssClass = "divError";
            icon.CssClass = "img";
            icon.ImageUrl = "~/assets/icons/error3.png";
            icon.Visible = true;
            PlaceHolder1.Controls.Add(lb);
        }
    }