Example #1
0
        public XElement RegisterActivity(int project, string title, int parentActivity, int priority,
            string due, string reminder, int completed)
        {
            XElement x = new XElement("activities");

            DBHelper db = new DBHelper(dbcstring);

            DateTime ddue = DateTime.Parse(due),
                dreminder = DateTime.Parse(reminder);
            bool bcompleted = (completed > 0);

            int registeredid = db.RegisterActivity(project, title, ddue, parentActivity,
                Convert.ToByte(priority), dreminder, bcompleted);
            AActivity activity = db.GetActivity(registeredid);

            if (activity != null)
            {
                XElement xproject = new XElement("activity");
                xproject.Add(new XElement("id", activity.ID.ToString()));
                xproject.Add(new XElement("title", activity.Title.Trim()));
                xproject.Add(new XElement("date", activity.Date));
                xproject.Add(new XElement("created", activity.Created));
                xproject.Add(new XElement("reminder", activity.Reminder));
                xproject.Add(new XElement("priority", activity.Priority));
                xproject.Add(new XElement("completed", activity.Completed));
                x.Add(xproject);
            }

            return x;
        }
Example #2
0
        public XElement UpdateReminder(int activity, string reminder)
        {
            XElement x = new XElement("activities");

            DBHelper db = new DBHelper(dbcstring);

            db.UpdateReminder(activity, DateTime.Parse(reminder));

            AActivity aactivity = db.GetActivity(activity);

            if (aactivity != null)
            {
                XElement xproject = new XElement("activity");
                xproject.Add(new XElement("id", aactivity.ID.ToString()));
                xproject.Add(new XElement("title", aactivity.Title.Trim()));
                xproject.Add(new XElement("date", aactivity.Date));
                xproject.Add(new XElement("created", aactivity.Created));
                xproject.Add(new XElement("reminder", aactivity.Reminder));
                xproject.Add(new XElement("priority", aactivity.Priority));
                xproject.Add(new XElement("completed", aactivity.Completed));
                x.Add(xproject);
            }

            return x;
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
                CurrentUser = (AUser)Session["user"];
            if (!Page.IsPostBack)
            {
                string sid = Request.QueryString["view"];
                int id;
                int.TryParse(sid, out id);

                db = new DBHelper(AgentUtileries.dbcstring);
                Session["db"] = db;
                CurrentActivity = db.GetActivity(id);

                // Si hay una actividad actual, obtener sus otros datos.
                if (CurrentActivity != null)
                {
                    OwnerProject = db.GetProject(CurrentActivity.ProjectID);
                    ParentActivity = db.GetActivity(CurrentActivity.Parent);
                    ChildActivities = db.GetChildActivities(CurrentActivity.ID);
                    ActivityImages = db.GetImages(CurrentActivity.ID);
                    Session["activity"] = CurrentActivity;
                }
            }
            else
            {
                CurrentActivity = (AActivity)Session["activity"];
                db = (DBHelper)Session["db"];
                if (CurrentActivity != null)
                {
                    OwnerProject = db.GetProject(CurrentActivity.ProjectID);
                    ParentActivity = db.GetActivity(CurrentActivity.Parent);
                    ChildActivities = db.GetChildActivities(CurrentActivity.ID);
                    Title = CurrentActivity.Title;
                }
            }
        }