Example #1
0
        public string UpdateMyUser(int id, MyUser myuser)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                MyUser            mu = db.MyUsers.Find(id);
                mu.AccountType  = myuser.AccountType;
                mu.BillingCycle = myuser.BillingCycle;
                mu.Companies    = myuser.Companies;
                myuser.Email    = myuser.Email;
                mu.FirstName    = myuser.FirstName;
                mu.GUI          = myuser.GUI;
                mu.LastLogin    = myuser.LastLogin;
                mu.LastName     = myuser.LastName;
                mu.Newsletter   = myuser.Newsletter;
                mu.Results      = myuser.Results;
                mu.StartDate    = myuser.StartDate;
                mu.Triggers     = myuser.Triggers;
                mu.UserName     = myuser.UserName;

                db.SaveChanges();
                return(myuser.ID.ToString() + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #2
0
 public String InsertMyUser(MyUser myuser)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.MyUsers.Add(myuser);
         db.SaveChanges();
         return(myuser.ID.ToString() + " was added successfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #3
0
 public String InsertPost(Post post)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.Posts.Add(post);
         db.SaveChanges();
         return(post.Title + " was added succesfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #4
0
 public String InsertTag(Tag tag)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.Tags.Add(tag);
         db.SaveChanges();
         return(tag.Name + " was added succesfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #5
0
 public String InsertComment(Comment comment)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.Comments.Add(comment);
         db.SaveChanges();
         return(" was added succesfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #6
0
 public String InsertCompany(Company company)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.Companies.Add(company);
         db.SaveChanges();
         return(company.ID.ToString() + " was added successfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #7
0
 public String InsertEmailList(EmailList emaillist)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.EmailLists.Add(emaillist);
         db.SaveChanges();
         return(emaillist.Name + " was added succesfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #8
0
        public string DeleteMyUser(int id)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Tag    p             = db.Tags.Find(id);
                Result r             = db.Results.Find(id);
                db.Results.Attach(r);
                db.Results.Remove(r);
                db.SaveChanges();

                MyUser mu = db.MyUsers.Find(id);
                db.MyUsers.Attach(mu);
                db.MyUsers.Remove(mu);
                db.SaveChanges();

                return(mu.ID.ToString() + " was deleted succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
 public String InsertResult(Result result)
 {
     try
     {
         triggerDBEntities db = new triggerDBEntities();
         db.Results.Add(result);
         db.SaveChanges();
         return(result.ID.ToString() + " was added successfully.");
     }
     catch (Exception e)
     {
         return("error: " + e);
     }
 }
Example #10
0
        public string UpdateTag(int id, Tag tag)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Tag p = db.Tags.Find(id);
                p.Name = tag.Name;

                db.SaveChanges();
                return(tag.Name + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #11
0
        public string UpdateEmailList(int id, EmailList emaillist)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                EmailList         p  = db.EmailLists.Find(id);
                p.Name = emaillist.Name;

                db.SaveChanges();
                return(emaillist.Name + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #12
0
        public string UpdateComment(int id)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Comment           p  = db.Comments.Find(id);
                db.Comments.Attach(p);
                db.Comments.Remove(p);
                db.SaveChanges();

                return(p.Name + " was deleted succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #13
0
        public string DeletePost(int id)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Post p = db.Posts.Find(id);
                db.Posts.Attach(p);
                db.Posts.Remove(p);
                db.SaveChanges();

                return(p.Title + " was deleted succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #14
0
        public string DeleteCompany(int id)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Tag     p            = db.Tags.Find(id);
                Company r            = db.Companies.Find(id);
                db.Companies.Attach(r);
                db.Companies.Remove(r);
                db.SaveChanges();

                return(r.ID.ToString() + " was deleted succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #15
0
        public string UpdateResult(int id, Result result)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Result            r  = db.Results.Find(id);
                r.BodyText     = result.BodyText;
                r.Company      = result.Company;
                r.DateSearched = result.DateSearched;
                r.Triggers     = result.Triggers;

                db.SaveChanges();
                return(result.ID.ToString() + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #16
0
        public string UpdateComment(int id, Comment comment)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Comment           p  = db.Comments.Find(id);
                p.Name     = comment.Name;
                p.Body     = comment.Body;
                p.Email    = comment.Email;
                p.DateTime = comment.DateTime;
                p.PostID   = comment.PostID;


                db.SaveChanges();
                return(comment.Name + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #17
0
        public string UpdateCompany(int id, Company company)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Company           r  = db.Companies.Find(id);
                r.AlternateName = company.AlternateName;
                r.CEO           = company.CEO;
                r.CFO           = company.CFO;
                r.Industry      = company.Industry;
                r.Industry2     = company.Industry2;
                r.Name          = company.Name;
                r.Symbol        = company.Symbol;

                db.SaveChanges();
                return(company.ID.ToString() + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }
Example #18
0
        public string UpdatePost(int id, Post post)
        {
            try
            {
                triggerDBEntities db = new triggerDBEntities();
                Post p = db.Posts.Find(id);
                p.Title    = post.Title;
                p.DateTime = post.DateTime;
                p.Body     = post.Body;
                p.Comments = post.Comments;
                //p.Tags = post.Tags;
                p.Tags1   = post.Tags1;
                p.IsDraft = post.IsDraft;

                db.SaveChanges();
                return(post.Title + " was updated succesfully.");
            }
            catch (Exception e)
            {
                return("error: " + e);
            }
        }