public BackgroundInfo GetBackgroundInfoByInfoID(int?id)
        {
            if (id == null)
            {
                return(null);
            }
            var peo = db.BackgroundInfoes
                      .Where(b => b.ID == id).FirstOrDefault();
            BackgroundInfo bi = new BackgroundInfo();

            if (bi == null)
            {
                return(null);
            }
            else
            {
                bi.ID                = peo.ID;
                bi.title             = peo.title;
                bi.type              = peo.type;
                bi.startDate         = peo.startDate;
                bi.endDate           = peo.endDate;
                bi.description       = peo.description;
                bi.isCurrentPosition = peo.isCurrentPosition;
                bi.UserInfoID        = peo.UserInfoID;
                return(bi);
            }
        }
 public void UpdateCurrentPosition([Bind(Include = "ID,type,title,startDate,endDate,description,isCurrentPosition,UserInfoID,createdDate,updatedDate")] BackgroundInfo backgroundInfo)
 {
     db.Entry(backgroundInfo).State = EntityState.Modified;
     db.Entry(backgroundInfo).Property("createdDate").IsModified = false;
     db.Entry(backgroundInfo).Property("UserInfoID").IsModified  = false;
     db.SaveChanges();
 }
        public BackgroundInfo GetCurrentPositionByID(int?id, Boolean isCP)
        {
            BackgroundInfo cP = new BackgroundInfo();

            if (id == null)
            {
                return(null);
            }
            var peo = db.BackgroundInfoes
                      .Where(b => b.UserInfoID == id && b.isCurrentPosition == isCP)
                      .FirstOrDefault();

            if (peo == null)
            {
                return(null);
            }
            else
            {
                cP.endDate           = peo.endDate;
                cP.startDate         = peo.startDate;
                cP.ID                = peo.ID;
                cP.type              = peo.type;
                cP.isCurrentPosition = peo.isCurrentPosition;
                cP.title             = peo.title;
                cP.description       = peo.description;
                cP.UserInfoID        = peo.UserInfoID;
            }
            return(cP);
        }
        public List <BackgroundInfo> GetBackgroundInfoByID(int?id, Boolean isCP)
        {
            List <BackgroundInfo> bInfoes = new List <BackgroundInfo>();

            if (id == null)
            {
                return(null);
            }
            var peo = db.BackgroundInfoes
                      .Where(b => b.UserInfoID == id && b.isCurrentPosition == isCP);

            //var peo = (from BackgroundInfo in db.BackgroundInfoes select new { Id = obj.Id, Name = obj.Name });
            foreach (BackgroundInfo bi in peo)
            {
                BackgroundInfo b = new BackgroundInfo();
                b.description = bi.description;
                b.endDate     = bi.endDate;
                b.startDate   = bi.startDate;
                b.title       = bi.title;
                b.type        = bi.type;
                b.UserInfoID  = bi.UserInfoID;
                b.ID          = bi.ID;
                bInfoes.Add(b);
            }

            if (bInfoes == null)
            {
                return(null);
            }
            return(bInfoes);
        }
        public BackgroundInfo GetCurrentPositionByID(int? id, Boolean isCP)
        {
            BackgroundInfo cP = new BackgroundInfo();
            if (id == null)
            {
                return null;
            }
            var peo = db.BackgroundInfoes
                    .Where(b => b.UserInfoID == id && b.isCurrentPosition == isCP)
                    .FirstOrDefault();

            if (peo == null)
            {
                return null;
            }
            else
            {
                cP.endDate = peo.endDate;
                cP.startDate = peo.startDate;
                cP.ID = peo.ID;
                cP.type = peo.type;
                cP.isCurrentPosition = peo.isCurrentPosition;
                cP.title = peo.title;
                cP.description = peo.description;
                cP.UserInfoID = peo.UserInfoID;
            }
            return cP;
        }
        public BackgroundInfo GetBackgroundInfoByInfoID(int? id)
        {
            if (id == null)
            {
                return null;
            }
            var peo = db.BackgroundInfoes
                    .Where(b => b.ID == id).FirstOrDefault();
            BackgroundInfo bi = new BackgroundInfo();

            if (bi == null)
            {
                return null;
            }
            else
            {
                bi.ID = peo.ID;
                bi.title = peo.title;
                bi.type = peo.type;
                bi.startDate = peo.startDate;
                bi.endDate = peo.endDate;
                bi.description = peo.description;
                bi.isCurrentPosition = peo.isCurrentPosition;
                bi.UserInfoID = peo.UserInfoID;
                return bi;
            }         
        }
 public List<BackgroundInfo> GetBackgroundInfoByID(int? id , Boolean isCP)
 {
     List<BackgroundInfo> bInfoes = new List<BackgroundInfo>();
     if (id == null)
     {
         return null;
     }
     var peo = db.BackgroundInfoes
             .Where(b => b.UserInfoID == id && b.isCurrentPosition == isCP);
     //var peo = (from BackgroundInfo in db.BackgroundInfoes select new { Id = obj.Id, Name = obj.Name });
     foreach (BackgroundInfo bi in peo)
     {
         BackgroundInfo b = new BackgroundInfo();
         b.description = bi.description;
         b.endDate = bi.endDate;
         b.startDate = bi.startDate;
         b.title = bi.title;
         b.type = bi.type;
         b.UserInfoID = bi.UserInfoID;
         b.ID = bi.ID;
         bInfoes.Add(b);
     }
     
     if (bInfoes == null)
     {
         return null;
     }
     return bInfoes;
 }
        public void DeleteBackgroundInfoByID(int?id)
        {
            if (id == null)
            {
                //return null;
            }
            BackgroundInfo backgroundInfo = db.BackgroundInfoes.Find(id);

            db.BackgroundInfoes.Remove(backgroundInfo);
            db.SaveChanges();
        }
Ejemplo n.º 9
0
 public void UpdateCurrentPosition(BackgroundInfo CurrentPositionClient)
 {
     CurrentPositionBusinessLayer cpbl = new CurrentPositionBusinessLayer();
     cpbl.UpdateCurrentPosition(CurrentPositionClient);
 }
Ejemplo n.º 10
0
 public void AddCurrentPositionData(BackgroundInfo BackgroundInfoClient)
 {
     var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
     var currentUser = manager.FindById(User.Identity.GetUserId());
     int id = currentUser.UserInfo.Id;
     BackgroundInfo bi = new BackgroundInfo();
     bi.UserInfoID = id;
     bi.type = BackgroundInfoClient.type;
     bi.title = BackgroundInfoClient.title;
     bi.endDate = new DateTime(2013,02,08);
     bi.startDate = BackgroundInfoClient.startDate;
     bi.description = BackgroundInfoClient.description;
     bi.isCurrentPosition = true;
     bi.createdDate = DateTime.Now;
     bi.updatedDate = null;
     CurrentPositionBusinessLayer cpBal = new CurrentPositionBusinessLayer();
     cpBal.InsertCurrentPosition(bi);
 }
Ejemplo n.º 11
0
 public void UpdateBackgroundInfo(BackgroundInfo BackgroundInfoClient)
 {
     BackgroundInfoBusinessLayer biBal = new BackgroundInfoBusinessLayer();
     biBal.UpdateBackgroundInfo(BackgroundInfoClient);
 }
Ejemplo n.º 12
0
 public void AddBackgroundInfo(BackgroundInfo BackgroundInfoClient)
 {
     var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
     var currentUser = manager.FindById(User.Identity.GetUserId());
     int id = currentUser.UserInfo.Id;
     BackgroundInfo bi = new BackgroundInfo();
     bi.UserInfoID = id;
     bi.title = BackgroundInfoClient.title;
     bi.type = BackgroundInfoClient.type;
     bi.startDate = BackgroundInfoClient.startDate;
     bi.endDate = BackgroundInfoClient.endDate;
     bi.description = BackgroundInfoClient.description;
     bi.isCurrentPosition = false;
     BackgroundInfoBusinessLayer biBal = new BackgroundInfoBusinessLayer();
     biBal.InsertBackgroundInfo(bi);
 }
 public void InsertCurrentPosition([Bind(Include = "ID,type,title,startDate,endDate,description,isCurrentPosition,UserInfoID, createdDate, updatedDate")] BackgroundInfo backgroundInfo)
 {
     db.BackgroundInfoes.Add(backgroundInfo);
     db.SaveChanges();
 }