Example #1
0
        public ActionResult Create([Bind(Include = "ethnicityID,ethName")] Ethnicity ethnicity)
        {
            if (ModelState.IsValid)
            {
                db.Ethnicities.Add(ethnicity);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ethnicity));
        }
        public ActionResult Create([Bind(Include = "contactTypeID,contactTypeName")] ContactType contactType)
        {
            if (ModelState.IsValid)
            {
                db.ContactTypes.Add(contactType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contactType));
        }
        public ActionResult Create([Bind(Include = "groupContactID,grpContName,contactTypeID,volunteerGroupID,grpContInfo")] GroupContact groupContact)
        {
            if (ModelState.IsValid)
            {
                db.GroupContacts.Add(groupContact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(groupContact));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "completedTrainingID,volunteerID,volunteerTrainingID,cmpTrnDate,cmpTrnComments")] CompletedTraining completedTraining)
        {
            if (ModelState.IsValid)
            {
                db.CompletedTrainings.Add(completedTraining);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(completedTraining));
        }
        public ActionResult Create([Bind(Include = "foreignLanguageID,foreignLangName")] ForeignLanguage foreignLanguage)
        {
            if (ModelState.IsValid)
            {
                db.ForeignLanguages.Add(foreignLanguage);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(foreignLanguage));
        }
Example #6
0
        public ActionResult Create([Bind(Include = "courtOrderedID,volunteerID,crtOrderCaseNumber,crtOrderedHoursRequired,crtOrderedStartDate,crtOrderedSexOrViolentCrime,crtOrderedOneMonthLimit")] CourtOrdered courtOrdered)
        {
            if (ModelState.IsValid)
            {
                db.CourtOrdereds.Add(courtOrdered);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(courtOrdered));
        }
        public ActionResult Create([Bind(Include = "volunteerTrainingID,volTrnName,volTrnDesc,volTrnCCSRequired,volTrnStateRequired,volTrnMonthsValid,volTrnBackgroundLvl,volTrnMVR")] VolunteerTraining volunteerTraining)
        {
            if (ModelState.IsValid)
            {
                db.VolunteerTrainings.Add(volunteerTraining);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(volunteerTraining));
        }
        public ActionResult Create([Bind(Include = "PositionID,PositionTitle")] Position position)
        {
            if (ModelState.IsValid)
            {
                db.Positions.Add(position);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(position));
        }
Example #9
0
        public ActionResult Create([Bind(Include = "contactID,contactTypeID,volunteerID,contactInfo,contCanContact")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                db.Contacts.Add(contact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
Example #10
0
        public ActionResult Create([Bind(Include = "positionLocationID,posLocationName,posLocationStreet1,posLocationStreet2,posLocationCity,posLocationState,posLocationZip,posLocationNotes")] PositionLocation positionLocation)
        {
            if (ModelState.IsValid)
            {
                db.PositionLocations.Add(positionLocation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(positionLocation));
        }
Example #11
0
        public ActionResult Create([Bind(Include = "hoursWorkedID,positionLocationID,hrsWrkdIDType,hrsWrkdTimeIn,hrsWrkdTimeOut,userAcctID,modifiedOn,hrsWrkedSchedDate,volunteerID,volunteerGroupID,hrsWrkdQty")] HoursWorked hoursWorked)
        {
            if (ModelState.IsValid)
            {
                db.HoursWorkeds.Add(hoursWorked);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hoursWorked));
        }
        public ActionResult Create([Bind(Include = "volunteerLanguageID,volunteerID,foreignLanguageID,volLangFluencyLvl,volLangLiteracyLvl")] VolunteerLanguage volunteerLanguage)
        {
            if (ModelState.IsValid)
            {
                db.VolunteerLanguages.Add(volunteerLanguage);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.foreignLanguageID = new SelectList(db.ForeignLanguages, "foreignLanguageID", "foreignLangName", volunteerLanguage.foreignLanguageID);
            ViewBag.volunteerID       = new SelectList(db.Volunteers, "volunteerID", "volFirstName", volunteerLanguage.volunteerID);
            return(View(volunteerLanguage));
        }
        public ActionResult Create([Bind(Include = "volunteerGroupID,volGrpName,volGrpUserName,volGrpPasswordHash,volGrpAddress1,volGrpAddress2,volGrpState,volGrpZip,volGrpIsActive")] VolunteerGroup volunteerGroup)
        {
            if (volunteerGroup.volGrpUserName != null)
            {
                volunteerGroup.volGrpPasswordHash = volunteerGroup.volGrpUserName;
            }
            if (ModelState.IsValid)
            {
                db.VolunteerGroups.Add(volunteerGroup);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(volunteerGroup));
        }
Example #14
0
 public static void ClockOutExcessUsers()
 {
     using (CCSContext context = new CCSContext())
     {
         foreach (var item in _users)
         {
             context.HoursWorkeds.Add(new HoursWorked()
             {
                 hrsWrkdIDType      = item.HoursWorkedType,
                 hrsWrkdTimeIn      = item.ClockIn,
                 hrsWrkdQty         = item.HoursWorkedQuantity,
                 hrsWrkdTimeOut     = item.ClockOut,
                 hrsWrkedSchedDate  = item.HoursWorkedDate,
                 userAcctID         = item.UserAccount,
                 modifiedOn         = item.ModifiedOn,
                 volunteerID        = item.UserId,
                 volunteerGroupID   = item.GroupId,
                 volunteer          = context.Volunteers.Find(item.UserId),
                 positionLocationID = item.PositionLocationId
             });
             context.SaveChanges();
         }
     }
     _users.RemoveRange(0, _users.Count());
 }
Example #15
0
        public ActionResult Create([Bind(Include = "volunteerID,volFirstName,volLastName,volDOB,volPin,volGender,volJoinDate,volsCourtOrdered,ethnicityID,volsClient,volsActive")] Volunteer volunteer)
        {
            if (ModelState.IsValid)
            {
                volunteer.volJoinDate      = DateTime.Now.Date;
                volunteer.volsCourtOrdered = 0;
                volunteer.volsClient       = 0;
                volunteer.volsActive       = 1;
                volunteer.volPin           = volunteer.volPin;
                db.Volunteers.Add(volunteer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(volunteer));
        }
Example #16
0
        public ActionResult NewVolunteer([Bind(Include = "volunteerID,volFirstName,volLastName,volDOB,volGender,ethnicityID")] Volunteer volunteer)
        {
            /*volPin,*/
            /*volJoinDate,volsCourtOrdered,*/
            /*,volsClient,volsActive*/
            if (ModelState.IsValid)
            {
                volunteer.volJoinDate      = DateTime.Now.Date;
                volunteer.volsCourtOrdered = 0;
                volunteer.volsClient       = 0;
                volunteer.volsActive       = 1;
                volunteer.volPin           = volunteer.volPin;
                db.Volunteers.Add(volunteer);
                db.SaveChanges();
                return(RedirectToAction("VolunteerDetails", new { id = volunteer.volunteerID }));
            }

            return(View(volunteer));
        }
Example #17
0
 public static void InsertVolunteerInDatabase(User user)
 {
     using (CCSContext context = new CCSContext())
     {
         HoursWorked hoursWorked = new HoursWorked()
         {
             hrsWrkdIDType      = user.HoursWorkedType,
             hrsWrkdTimeIn      = user.ClockIn,
             hrsWrkdQty         = user.HoursWorkedQuantity,
             hrsWrkdTimeOut     = user.ClockOut,
             hrsWrkedSchedDate  = user.HoursWorkedDate,
             userAcctID         = user.UserAccount,
             modifiedOn         = user.ModifiedOn,
             volunteerID        = user.UserId,
             volunteerGroupID   = user.GroupId,
             volunteer          = context.Volunteers.Find(user.UserId),
             positionLocation   = context.PositionLocations.Find(user.PositionKey),
             positionLocationID = user.PositionLocationId
         };
         context.HoursWorkeds.Add(hoursWorked);
         context.SaveChanges();
     }
 }