示例#1
0
        public void DriverInfoScheduleDelete(DriverInfoDeleteViewModel model)
        {
            string UserId = BHIP.Model.Helper.Security.GetLoggedInUserID();

            var query = (from driver in ContextPerRequest.CurrentData.DriverInfoSchedules
                         where driver.DriverInfoScheduleID == model.DriverInfoScheduleID
                         select driver).FirstOrDefault();

            if (query != null)
            {
                DriverInfoScheduleHold driver = new DriverInfoScheduleHold
                {
                    Comments             = query.Comments,
                    DateAdded            = query.DateAdded,
                    DateRemoved          = model.DateRemoved,
                    DOB                  = query.DOB,
                    DriverInfoScheduleID = query.DriverInfoScheduleID,
                    EditType             = "Delete",
                    FirstName            = query.FirstName,
                    LastName             = query.LastName,
                    LicenseNumber        = query.LicenseNumber,
                    MemberCoverageID     = query.MemberCoverageID,
                    StateID              = query.StateID,
                    UserID               = UserId,
                    ScheduleStatusID     = 2
                };
                ContextPerRequest.CurrentData.DriverInfoScheduleHolds.Add(driver);
                ContextPerRequest.CurrentData.SaveChanges();
            }
        }
示例#2
0
        public void TransferScheduleRecords(DriverInfoScheduleHold model)
        {
            if (model.EditType == "Edit")
            {
                var query = (from veh in ContextPerRequest.CurrentData.DriverInfoSchedules
                             where veh.DriverInfoScheduleID == model.DriverInfoScheduleID
                             select veh).FirstOrDefault();

                if (query != null)
                {
                    query.Comments         = model.Comments;
                    query.DateAdded        = model.DateAdded;
                    query.DateRemoved      = model.DateRemoved;
                    query.DOB              = model.DOB;
                    query.FirstName        = model.FirstName;
                    query.LastName         = model.LastName;
                    query.LicenseNumber    = model.LicenseNumber;
                    query.MemberCoverageID = model.MemberCoverageID;
                    query.StateID          = model.StateID;
                    ContextPerRequest.CurrentData.SaveChanges();
                }
            }
            else if (model.EditType == "Add")
            {
                DriverInfoSchedule driver = new DriverInfoSchedule
                {
                    Comments         = model.Comments,
                    DateAdded        = model.DateAdded,
                    DateRemoved      = model.DateRemoved,
                    DOB              = model.DOB,
                    FirstName        = model.FirstName,
                    LastName         = model.LastName,
                    LicenseNumber    = model.LicenseNumber,
                    MemberCoverageID = model.MemberCoverageID,
                    StateID          = model.StateID
                };

                ContextPerRequest.CurrentData.DriverInfoSchedules.Add(driver);
                ContextPerRequest.CurrentData.SaveChanges();
            }
            else if (model.EditType == "Delete")
            {
                var deleteQuery = (from driver in ContextPerRequest.CurrentData.DriverInfoSchedules
                                   where driver.DriverInfoScheduleID == model.DriverInfoScheduleID
                                   select driver).FirstOrDefault();
                if (deleteQuery != null)
                {
                    deleteQuery.DateRemoved = model.DateRemoved;
                    ContextPerRequest.CurrentData.SaveChanges();
                }
            }
        }
示例#3
0
        public void DriverInfoScheduleEdit(DriverInfoViewModel model)
        {
            string UserId = BHIP.Model.Helper.Security.GetLoggedInUserID();

            DriverInfoScheduleHold driver = new DriverInfoScheduleHold
            {
                Comments             = model.Comments,
                DateAdded            = model.DateAdded,
                DateRemoved          = model.DateRemoved,
                DOB                  = model.DOB,
                DriverInfoScheduleID = model.DriverInfoScheduleID,
                EditType             = "Edit",
                FirstName            = model.FirstName,
                LastName             = model.LastName,
                LicenseNumber        = model.LicenseNumber,
                MemberCoverageID     = model.MemberCoverageID,
                StateID              = model.StateID,
                UserID               = UserId,
                ScheduleStatusID     = 2
            };

            ContextPerRequest.CurrentData.DriverInfoScheduleHolds.Add(driver);
            ContextPerRequest.CurrentData.SaveChanges();
        }