예제 #1
0
        public void AddProject(ProjectDto t)
        {
            var project = new ProjectDb
            {
                CreationDate = t.CreationDate,
                Comment      = t.Comment,
                CreatorId    = t.CreatorId,
                DeptId       = t.DeptId,
                Finish       = t.Finish,
                ManagerId    = t.ManagerId,
                Name         = t.Name,
                Priority     = t.Priority,
                Start        = t.Start,
                State        = t.State,
                UserId       = t.UserId
            };

            using (var context = new CamozziEntities())
            {
                context.ProjectDbs.Add(project);
                context.SaveChanges();
                Console.WriteLine("------------------------------------------------------------");
                Console.WriteLine(DateTime.Now + " Project Added by " +
                                  context.UserDbs.First(x => x.Id == project.CreatorId).Name);
            }
            UpdateClients();
        }
예제 #2
0
 public void DeleteUser(UserDto t)
 {
     using (var context = new CamozziEntities())
     {
         context.UserDbs.Remove(context.UserDbs.Find(t.Id));
         context.SaveChanges();
     }
 }
예제 #3
0
        public void AddUser(UserDto t)
        {
            var user = new UserDb()
            {
                AccountId = t.AccountId,
                Comment   = t.Comment,
                DeptId    = t.DeptId,
                Mail      = t.Mail,
                Name      = t.Name,
                Password  = "******",
                Phone     = t.Phone
            };

            using (var context = new CamozziEntities())
            {
                context.UserDbs.Add(user);
                context.SaveChanges();
                user.QueryId = user.Id;
                context.SaveChanges();
            }
        }
예제 #4
0
 public void DeleteProject(ProjectDto t)
 {
     using (var context = new CamozziEntities())
     {
         Console.WriteLine("------------------------------------------------------------");
         Console.WriteLine(DateTime.Now + " Project Deleted by " +
                           context.UserDbs.First(x => x.Id == t.UserId).Name);
         context.ProjectDbs.Remove(context.ProjectDbs.Find(t.Id));
         context.SaveChanges();
     }
     UpdateClients();
 }
예제 #5
0
 public void UpdateUser(UserDto t)
 {
     using (var context = new CamozziEntities())
     {
         var user = context.UserDbs.Find(t.Id);
         //context.UserDbs.Attach(Mapper.Map<UserDb>(t));
         //var entry = context.Entry(t);
         user.Mail    = t.Mail;
         user.Comment = t.Comment;
         //user.Name = t.Name;
         user.Phone = t.Phone;
         context.SaveChanges();
     }
 }
예제 #6
0
 public void UpdateProject(ProjectDto t)
 {
     using (var context = new CamozziEntities())
     {
         var project = context.ProjectDbs.First(x => x.Id == t.Id);
         project.CreationDate = t.CreationDate;
         project.Comment      = t.Comment;
         project.CreatorId    = t.CreatorId;
         project.DeptId       = t.DeptId;
         project.Finish       = t.Finish;
         project.ManagerId    = t.ManagerId;
         project.Name         = t.Name;
         project.Priority     = t.Priority;
         project.Start        = t.Start;
         project.State        = t.State;
         project.UserId       = t.UserId;
         context.SaveChanges();
         Console.WriteLine("------------------------------------------------------------");
         Console.WriteLine(DateTime.Now + " Project Updated by " +
                           context.UserDbs.First(x => x.Id == project.UserId).Name);
     }
     UpdateClients();
 }