Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseAuditID,AuditTimestamp,AuditLog,CaseID,LocalUserID")] CaseAudit caseAudit)
        {
            if (id != caseAudit.CaseAuditID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caseAudit);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CaseAuditExists(caseAudit.CaseAuditID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CaseID"]      = new SelectList(_context.Case, "CaseID", "CaseID", caseAudit.CaseID);
            ViewData["LocalUserID"] = new SelectList(_context.LocalUser, "LocalUserID", "LocalUserID", caseAudit.LocalUserID);
            return(View(caseAudit));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,Name,ScholarRequestType,ScholarCompAllowanceChange,ScholarJobProfile,JobTitle,PropTitle,CurrentFTE,ProposedFTE,EffectiveStartDate,EffectiveEndDate,StepStipendAllowance,Department,Note,BudgetNumbers")] HRServiceScholarResident hrScholar)

        {
            /** First check important fields to see if values have changed and if so add to audit log **/
            string strAudit = "Case Edited. Values updated (old,new). ";

            IQueryable <HRServiceScholarResident> beforeCases = _context.HRServiceScholarResident.Where(c => c.CaseID == id).AsNoTracking <HRServiceScholarResident>();
            HRServiceScholarResident beforeCase = beforeCases.FirstOrDefault();

            if (beforeCase == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                if (beforeCase.Name != hrScholar.Name)
                {
                    strAudit += "Student: (" + beforeCase.Name + "," + hrScholar.Name + ") ";
                }


                if (beforeCase.EffectiveStartDate.ToShortDateString() != hrScholar.EffectiveStartDate.ToShortDateString())
                {
                    strAudit += "StartDate: (" + beforeCase.EffectiveStartDate.ToShortDateString() + "," + hrScholar.EffectiveStartDate.ToShortDateString() + ") ";
                }
                DateTime beforeEffectDate = beforeCase.EffectiveEndDate.GetValueOrDefault();
                DateTime curEffectDate    = hrScholar.EffectiveEndDate.GetValueOrDefault();
                if (beforeEffectDate.ToShortDateString() != curEffectDate.ToShortDateString())
                {
                    strAudit += "EndDate: (" + beforeEffectDate.ToShortDateString() + "," + curEffectDate.ToShortDateString() + ") ";
                }

                /*
                 * if (beforeCase.Department.ToString() != hrGradStudent.Department.ToString())
                 * {
                 *  strAudit += "Department: (" + beforeCase.Department.ToString() + "," + hrGradStudent.Department.ToString() + ") ";
                 * }
                 * if (beforeCase.StepStipendAllowance.ToString() != hrGradStudent.StepStipendAllowance.ToString())
                 * {
                 *  strAudit += "Allowance: (" + beforeCase.StepStipendAllowance.ToString() + "," + hrGradStudent.StepStipendAllowance.ToString() + ") ";
                 * }
                 * if (beforeCase.BudgetNumbers.ToString() != hrGradStudent.BudgetNumbers.ToString())
                 * {
                 *  strAudit += "BudgetNumbers: (" + beforeCase.BudgetNumbers.ToString() + "," + hrGradStudent.BudgetNumbers.ToString() + ") ";
                 * }
                 */

                var audit = new CaseAudit {
                    AuditLog = strAudit, CaseID = id, LocalUserID = User.Identity.Name
                };
                _context.Add(audit);
                _context.Entry(hrScholar).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
                //return RedirectToAction("Index", "Home");
            }
            return(View(hrScholar));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("CaseAuditID,AuditTimestamp,AuditLog,CaseID,LocalUserID")] CaseAudit caseAudit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(caseAudit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CaseID"]      = new SelectList(_context.Case, "CaseID", "CaseID", caseAudit.CaseID);
            ViewData["LocalUserID"] = new SelectList(_context.LocalUser, "LocalUserID", "LocalUserID", caseAudit.LocalUserID);
            return(View(caseAudit));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,Name,FacAffiliateTitle,HireDate,Department,Note")] HiringAffiliateFaculty hrAffFaculty)

        {
            IQueryable <HiringAffiliateFaculty> beforeCases = _context.HiringAffiliateFaculty.Where(c => c.CaseID == id).AsNoTracking <HiringAffiliateFaculty>();
            HiringAffiliateFaculty beforeCase = beforeCases.FirstOrDefault();

            if (beforeCase == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                /** First check fields to see if values have changed and if so add to audit log  **/
                /** Also clear any fields that were hidden when and not automatically reset in the form **/

                string strAudit = "Case Edited. Values updated (old,new). ";

                string bcRequest   = beforeCase.FacAffiliateTitle.ToString();
                string currRequest = hrAffFaculty.FacAffiliateTitle.ToString();



                if (beforeCase.Department.ToString() != hrAffFaculty.Department.ToString())
                {
                    strAudit += "Department: (" + beforeCase.Department.ToString() + "," + hrAffFaculty.Department.ToString() + ") ";
                }



                var audit = new CaseAudit {
                    AuditLog = strAudit, CaseID = id, LocalUserID = User.Identity.Name
                };
                _context.Add(audit);
                _context.Entry(hrAffFaculty).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
                //return RedirectToAction("Index", "Home");
            }
            return(View(hrAffFaculty));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,EmployeeName,Budget,BudgetPurpose,BudgetType,BudgetNumbers,EmployeeEID,Airfare,Registration,Transportation,Other1,Other2,Meals,Hotels,Total,TravelStartDate,TravelEndDate, Department,Note,Destination,Reason")] Travel travel)

        {
            if (id != travel.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <Travel> beforeCases = _context.Travel.Where(c => c.CaseID == id).AsNoTracking <Travel>();
                    Travel beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking
                        var old_details = new TravelTracking
                        {
                            Status          = "old",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = beforeCase.CaseID,
                            Destination     = beforeCase.Destination,
                            EmployeeName    = beforeCase.EmployeeName,
                            TravelStartDate = beforeCase.TravelStartDate,
                            TravelEndDate   = beforeCase.TravelEndDate,
                            Reason          = beforeCase.Reason,
                            BudgetNumbers   = beforeCase.BudgetNumbers,
                            BudgetPurpose   = beforeCase.BudgetPurpose,
                            BudgetType      = beforeCase.BudgetType,
                            Total           = beforeCase.Total
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new TravelTracking
                        {
                            Status          = "new",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = travel.CaseID,
                            Destination     = travel.Destination,
                            EmployeeName    = travel.EmployeeName,
                            TravelStartDate = travel.TravelStartDate,
                            TravelEndDate   = travel.TravelEndDate,
                            Reason          = travel.Reason,
                            BudgetNumbers   = travel.BudgetNumbers,
                            BudgetPurpose   = travel.BudgetPurpose,
                            BudgetType      = travel.BudgetType,
                            Total           = travel.Total
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(travel);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TravelExists(travel.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(travel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID, CaseDescription, EmployeeName, Salary")] SampleCaseType samplecasetype)

        {
            if (id != samplecasetype.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <SampleCaseType> beforeCases = _context.SampleCaseType.Where(c => c.CaseID == id).AsNoTracking <SampleCaseType>();
                    SampleCaseType beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking
                        var old_details = new SampleCaseTypeTracking
                        {
                            Status          = "old",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = beforeCase.CaseID,
                            CaseDescription = beforeCase.CaseDescription,
                            EmployeeName    = beforeCase.EmployeeName,
                            Salary          = beforeCase.Salary
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new SampleCaseTypeTracking
                        {
                            Status          = "new",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = samplecasetype.CaseID,
                            CaseDescription = samplecasetype.CaseDescription,
                            EmployeeName    = samplecasetype.EmployeeName,
                            Salary          = samplecasetype.Salary
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(samplecasetype);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SampleCaseTypeExists(samplecasetype.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(samplecasetype));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,EmployeeName,FacRequestType,EffectiveStartDate,EffectiveEndDate,TerminationReason,Offboarding,Note,ClosePosition,LeaveWA,Salary,Amount,SupOrg,Department,CurrentFTE,ProposedFTE,JobTitle,EmployeeEID,BudgetNumbers")] HRServiceFaculty hrFaculty)

        {
            IQueryable <HRServiceFaculty> beforeCases = _context.HRServiceFaculty.Where(c => c.CaseID == id).AsNoTracking <HRServiceFaculty>();
            HRServiceFaculty beforeCase = beforeCases.FirstOrDefault();

            if (beforeCase == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                /** First check fields to see if values have changed and if so add to audit log  **/
                /** Also clear any fields that were hidden when and not automatically reset in the form **/

                string strAudit = "Case Edited. Values updated (old,new). ";

                string bcRequest   = beforeCase.FacRequestType.ToString();
                string currRequest = hrFaculty.FacRequestType.ToString();
                string bcTerm      = beforeCase.TerminationReason.ToString();
                string currTerm    = hrFaculty.TerminationReason.ToString();
                string bcOff       = beforeCase.Offboarding.ToString();
                string currOff     = hrFaculty.Offboarding.ToString();
                string bcClose     = beforeCase.ClosePosition.ToString();
                string currClose   = hrFaculty.ClosePosition.ToString();
                string bcLeave     = beforeCase.LeaveWA.ToString();
                string currLeave   = hrFaculty.LeaveWA.ToString();
                string bcAmount    = "";
                string currAmount  = "";
                string bcCurrFTE   = "";
                string currCurrFTE = "";
                string bcPropFTE   = "";
                string currPropFTE = "";
                string bcSup       = beforeCase.SupOrg.ToString();
                string currSup     = hrFaculty.SupOrg.ToString();
                if (!String.IsNullOrEmpty(beforeCase.Amount))
                {
                    bcAmount = beforeCase.Amount;
                }
                if (!String.IsNullOrEmpty(hrFaculty.Amount))
                {
                    currAmount = hrFaculty.Amount;
                }
                if (!String.IsNullOrEmpty(beforeCase.CurrentFTE))
                {
                    bcCurrFTE = beforeCase.CurrentFTE;
                }
                if (!String.IsNullOrEmpty(beforeCase.ProposedFTE))
                {
                    bcPropFTE = beforeCase.ProposedFTE;
                }
                if (!String.IsNullOrEmpty(hrFaculty.CurrentFTE))
                {
                    currCurrFTE = hrFaculty.CurrentFTE;
                }
                if (!String.IsNullOrEmpty(hrFaculty.ProposedFTE))
                {
                    currPropFTE = hrFaculty.ProposedFTE;
                }


                if (beforeCase.EmployeeName != hrFaculty.EmployeeName)
                {
                    strAudit += "Employee: (" + beforeCase.EmployeeName + "," + hrFaculty.EmployeeName + ") ";
                }

                if (bcRequest != currRequest)
                {
                    strAudit += "RequestType: (" + beforeCase.FacRequestType.ToString() + "," + hrFaculty.FacRequestType.ToString() + ") ";
                }
                if (currRequest != "Termination")
                {
                    hrFaculty.TerminationReason = null;
                    currTerm = "";
                    hrFaculty.Offboarding = false;
                    currOff = "False";
                    hrFaculty.ClosePosition = false;
                    currClose         = "False";
                    hrFaculty.LeaveWA = false;
                    currLeave         = "False";
                }


                if (currRequest != "FTE")
                {
                    hrFaculty.CurrentFTE  = "";
                    hrFaculty.ProposedFTE = "";
                    currCurrFTE           = "";
                    currPropFTE           = "";
                }
                if (currRequest != "Move")
                {
                    hrFaculty.SupOrg = null;
                    currSup          = "";
                }

                if (bcAmount != currAmount)
                {
                    strAudit += "Amount: (" + bcAmount + "," + currAmount + ") ";
                }

                if (bcTerm != currTerm)
                {
                    strAudit += "TerminationReason: (" + bcTerm + "," + currTerm + ") ";
                }
                if (bcOff != currOff)
                {
                    strAudit += "Offboarding: (" + bcOff + "," + currOff + ") ";
                }
                if (bcLeave != currLeave)
                {
                    strAudit += "LeaveWA: (" + bcLeave + "," + currLeave + ") ";
                }
                if (bcClose != currClose)
                {
                    strAudit += "ClosePosition: (" + bcClose + "," + currClose + ") ";
                }
                if (bcCurrFTE != currCurrFTE)
                {
                    strAudit += "CurrentFTE: (" + bcCurrFTE + "," + currCurrFTE + ") ";
                }
                if (bcPropFTE != currPropFTE)
                {
                    strAudit += "PurposedFTE: (" + bcPropFTE + "," + currPropFTE + ") ";
                }
                if (bcSup != currSup)
                {
                    strAudit += "SupOrg: (" + bcSup + "," + currSup + ") ";
                }
                if (beforeCase.EffectiveStartDate.ToShortDateString() != hrFaculty.EffectiveStartDate.ToShortDateString())
                {
                    strAudit += "StartDate: (" + beforeCase.EffectiveStartDate.ToShortDateString() + "," + hrFaculty.EffectiveStartDate.ToShortDateString() + ") ";
                }
                DateTime beforeEffectDate = beforeCase.EffectiveEndDate.GetValueOrDefault();
                DateTime curEffectDate    = hrFaculty.EffectiveEndDate.GetValueOrDefault();
                if (beforeEffectDate.ToShortDateString() != curEffectDate.ToShortDateString())
                {
                    strAudit += "EndDate: (" + beforeEffectDate.ToShortDateString() + "," + curEffectDate.ToShortDateString() + ") ";
                }

                if (beforeCase.Department.ToString() != hrFaculty.Department.ToString())
                {
                    strAudit += "Department: (" + beforeCase.Department.ToString() + "," + hrFaculty.Department.ToString() + ") ";
                }

                if (!String.IsNullOrEmpty(beforeCase.Salary) && !String.IsNullOrEmpty(hrFaculty.Salary))
                {
                    if (beforeCase.Salary.ToString() != hrFaculty.Salary.ToString())
                    {
                        strAudit += "Salary: (" + beforeCase.Salary.ToString() + "," + hrFaculty.Salary.ToString() + ") ";
                    }
                }
                if (beforeCase.EmployeeEID.ToString() != hrFaculty.EmployeeEID.ToString())
                {
                    strAudit += "EmployeeEID: (" + beforeCase.EmployeeEID.ToString() + "," + hrFaculty.EmployeeEID.ToString() + ") ";
                }
                if (beforeCase.BudgetNumbers.ToString() != hrFaculty.BudgetNumbers.ToString())
                {
                    strAudit += "Budget#: (" + beforeCase.BudgetNumbers.ToString() + "," + hrFaculty.BudgetNumbers.ToString() + ") ";
                }
                if (beforeCase.JobTitle.ToString() != hrFaculty.JobTitle.ToString())
                {
                    strAudit += "JobTitle: (" + beforeCase.JobTitle.ToString() + "," + hrFaculty.JobTitle.ToString() + ") ";
                }

                var audit = new CaseAudit {
                    AuditLog = strAudit, CaseID = id, LocalUserID = User.Identity.Name
                };
                _context.Add(audit);
                _context.Entry(hrFaculty).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
                //return RedirectToAction("Index", "Home");
            }
            return(View(hrFaculty));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,EmployeeName,RequestType,BasePayChange,AllowanceChange,EffectiveStartDate,EffectiveEndDate,TerminationReason,Offboarding,Note,ClosePosition,LeaveWA,WorkerType,Amount,SupOrg,EmployeeEID,BudgetNumbers")] HRServiceStaff hrStaff)
        {
            if (id != hrStaff.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <HRServiceStaff> beforeCases = _context.HRServiceStaff.Where(c => c.CaseID == id).AsNoTracking <HRServiceStaff>();
                    HRServiceStaff beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking

                        var old_details = new HRServiceStaffTracking
                        {
                            Status             = "old",
                            CaseAuditID        = audit.CaseAuditID,
                            CaseID             = beforeCase.CaseID,
                            EmployeeName       = beforeCase.EmployeeName,
                            RequestType        = beforeCase.RequestType,
                            BasePayChange      = beforeCase.BasePayChange,
                            AllowanceChange    = beforeCase.AllowanceChange,
                            TerminationReason  = beforeCase.TerminationReason,
                            Offboarding        = beforeCase.Offboarding,
                            LeaveWA            = beforeCase.LeaveWA,
                            ClosePosition      = beforeCase.ClosePosition,
                            Amount             = beforeCase.Amount,
                            WorkerType         = beforeCase.WorkerType,
                            EffectiveStartDate = beforeCase.EffectiveStartDate,
                            EffectiveEndDate   = beforeCase.EffectiveEndDate,
                            SupOrg             = beforeCase.SupOrg,
                            EmployeeEID        = beforeCase.EmployeeEID,
                            Note          = beforeCase.Note,
                            BudgetNumbers = beforeCase.BudgetNumbers
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new HRServiceStaffTracking
                        {
                            Status             = "new",
                            CaseAuditID        = audit.CaseAuditID,
                            CaseID             = hrStaff.CaseID,
                            EmployeeName       = hrStaff.EmployeeName,
                            RequestType        = hrStaff.RequestType,
                            BasePayChange      = hrStaff.BasePayChange,
                            AllowanceChange    = hrStaff.AllowanceChange,
                            TerminationReason  = hrStaff.TerminationReason,
                            Offboarding        = hrStaff.Offboarding,
                            LeaveWA            = hrStaff.LeaveWA,
                            ClosePosition      = hrStaff.ClosePosition,
                            Amount             = hrStaff.Amount,
                            WorkerType         = hrStaff.WorkerType,
                            EffectiveStartDate = hrStaff.EffectiveStartDate,
                            EffectiveEndDate   = hrStaff.EffectiveEndDate,
                            SupOrg             = hrStaff.SupOrg,
                            EmployeeEID        = hrStaff.EmployeeEID,
                            Note          = hrStaff.Note,
                            BudgetNumbers = hrStaff.BudgetNumbers
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(hrStaff);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HRServiceStaffExists(hrStaff.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(hrStaff));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,EmployeeName,EmployeeEID,EventDate,Department,BudgetNumbers,BudgetType,BudgetPurpose,Note,Item1,Item2,item3,Item4,Item5,Item6,Item7,Total,Justification,EventDescription")] FoodEvent foodEvent)

        {
            if (id != foodEvent.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <FoodEvent> beforeCases = _context.FoodEvent.Where(c => c.CaseID == id).AsNoTracking <FoodEvent>();
                    FoodEvent beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking
                        var old_details = new FoodEventTracking
                        {
                            Status           = "old",
                            CaseAuditID      = audit.CaseAuditID,
                            CaseID           = beforeCase.CaseID,
                            EventDescription = beforeCase.EventDescription,
                            EmployeeName     = beforeCase.EmployeeName,
                            EventDate        = beforeCase.EventDate,
                            Department       = beforeCase.Department,
                            BudgetNumbers    = beforeCase.BudgetNumbers,
                            BudgetPurpose    = beforeCase.BudgetPurpose,
                            BudgetType       = beforeCase.BudgetType,
                            Total            = beforeCase.Total
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new FoodEventTracking
                        {
                            Status           = "new",
                            CaseAuditID      = audit.CaseAuditID,
                            CaseID           = foodEvent.CaseID,
                            EventDescription = foodEvent.EventDescription,
                            EmployeeName     = foodEvent.EmployeeName,
                            Department       = foodEvent.Department,
                            EventDate        = foodEvent.EventDate,
                            BudgetNumbers    = foodEvent.BudgetNumbers,
                            BudgetPurpose    = foodEvent.BudgetPurpose,
                            BudgetType       = foodEvent.BudgetType,
                            Total            = foodEvent.Total
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(foodEvent);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FoodEventExists(foodEvent.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(foodEvent));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,Name,FacAffiliateTitle,HireDate,Department,Note")] HiringAffiliateFaculty hrAffFaculty)
        {
            if (id != hrAffFaculty.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <HiringAffiliateFaculty> beforeCases = _context.HiringAffiliateFaculty.Where(c => c.CaseID == id).AsNoTracking <HiringAffiliateFaculty>();
                    HiringAffiliateFaculty beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking

                        var old_details = new HiringAffiliateFacultyTracking
                        {
                            Status            = "old",
                            CaseAuditID       = audit.CaseAuditID,
                            CaseID            = beforeCase.CaseID,
                            HireDate          = beforeCase.HireDate,
                            Department        = beforeCase.Department,
                            Name              = beforeCase.Name,
                            FacAffiliateTitle = beforeCase.FacAffiliateTitle
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new HiringAffiliateFacultyTracking
                        {
                            Status      = "new",
                            CaseAuditID = audit.CaseAuditID,
                            CaseID      = hrAffFaculty.CaseID,
                            HireDate    = hrAffFaculty.HireDate,
                            Department  = hrAffFaculty.Department,
                            Name        = hrAffFaculty.Name,

                            FacAffiliateTitle = hrAffFaculty.FacAffiliateTitle
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(hrAffFaculty);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HiringAffiliateFacultyExists(hrAffFaculty.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(hrAffFaculty));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,StudentName,PatientName,PatientAddress,PatientPhone,BirthDate,Complaint,TreatmentPlan,bwxrays,paxrays,RestorativeExam,PerioExam,Prophy,Other, OtherProcedure,TChart,Note")] PerioLimitedCare perioLimitedCare)

        {
            /** First check important fields to see if values have changed and if so add to audit log **/
            string strAudit = "Case Edited. Values updated (old,new). ";

            IQueryable <PerioLimitedCare> beforeCases = _context.PerioLimitedCare.Where(c => c.CaseID == id).AsNoTracking <PerioLimitedCare>();
            PerioLimitedCare beforeCase = beforeCases.FirstOrDefault();

            if (beforeCase == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                if (beforeCase.StudentName != perioLimitedCare.StudentName)
                {
                    strAudit += "Student: (" + beforeCase.StudentName + "," + perioLimitedCare.StudentName + ") ";
                }

                if (beforeCase.PatientName != perioLimitedCare.PatientName)
                {
                    strAudit += "Patient: (" + beforeCase.PatientName + "," + perioLimitedCare.PatientName + ") ";
                }
                if (beforeCase.PatientAddress != perioLimitedCare.PatientAddress)
                {
                    strAudit += "PatientAddress: (" + beforeCase.PatientAddress + "," + perioLimitedCare.PatientAddress + ") ";
                }
                if (beforeCase.PatientPhone != perioLimitedCare.PatientPhone)
                {
                    strAudit += "PatientPhone: (" + beforeCase.PatientPhone + "," + perioLimitedCare.PatientPhone + ") ";
                }
                if (beforeCase.BirthDate.ToShortDateString() != perioLimitedCare.BirthDate.ToShortDateString())
                {
                    strAudit += "BirthDate: (" + beforeCase.BirthDate.ToShortDateString() + "," + perioLimitedCare.BirthDate.ToShortDateString() + ") ";
                }
                if (beforeCase.Complaint != perioLimitedCare.Complaint)
                {
                    strAudit += "Complaint: (" + beforeCase.Complaint + "," + perioLimitedCare.Complaint + ") ";
                }
                if (beforeCase.TreatmentPlan != perioLimitedCare.TreatmentPlan)
                {
                    strAudit += "TreatmentPlan: (" + beforeCase.TreatmentPlan + "," + perioLimitedCare.TreatmentPlan + ") ";
                }
                if (beforeCase.TChart != perioLimitedCare.TChart)
                {
                    strAudit += "TChart: (" + beforeCase.TChart + "," + perioLimitedCare.TChart + ") ";
                }
                string bcbwxrays       = beforeCase.bwxrays.ToString();
                string bcpaxrays       = beforeCase.paxrays.ToString();
                string bcPerioExam     = beforeCase.PerioExam.ToString();
                string bcRestoreExam   = beforeCase.RestorativeExam.ToString();
                string bcProphy        = beforeCase.Prophy.ToString();
                string bcOther         = beforeCase.Other.ToString();
                string currProphy      = perioLimitedCare.Prophy.ToString();
                string currOther       = perioLimitedCare.Other.ToString();
                string currRestoreExam = perioLimitedCare.RestorativeExam.ToString();
                string curbwxrays      = perioLimitedCare.bwxrays.ToString();
                string currpaxrays     = perioLimitedCare.paxrays.ToString();
                string currPerioExam   = perioLimitedCare.PerioExam.ToString();

                if (bcbwxrays != curbwxrays)
                {
                    strAudit += "BW x-rays: (" + bcbwxrays + "," + curbwxrays + ") ";
                }
                if (bcpaxrays != currpaxrays)
                {
                    strAudit += "PA x-rays: (" + bcpaxrays + "," + currpaxrays + ") ";
                }
                if (bcPerioExam != currPerioExam)
                {
                    strAudit += "PerioExam: (" + bcPerioExam + "," + currPerioExam + ") ";
                }
                if (bcRestoreExam != currRestoreExam)
                {
                    strAudit += "RestoreExam: (" + bcRestoreExam + "," + currRestoreExam + ") ";
                }
                if (bcProphy != currProphy)
                {
                    strAudit += "Prophy: (" + bcProphy + "," + currProphy + ") ";
                }
                if (bcOther != currOther)
                {
                    strAudit += "Other: (" + bcOther + "," + currOther + ") ";
                }

                var audit = new CaseAudit {
                    AuditLog = strAudit, CaseID = id, LocalUserID = User.Identity.Name
                };
                _context.Add(audit);
                _context.Entry(perioLimitedCare).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
                //return RedirectToAction("Index", "Home");
            }
            return(View(perioLimitedCare));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,Name,ScholarRequestType,ScholarCompAllowanceChange,ScholarJobProfile,JobTitle,PropTitle,CurrentFTE,ProposedFTE,EffectiveStartDate,EffectiveEndDate,StepStipendAllowance,Department,Note,BudgetNumbers")] HRServiceScholarResident hrScholar)

        {
            if (id != hrScholar.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <HRServiceScholarResident> beforeCases = _context.HRServiceScholarResident.Where(c => c.CaseID == id).AsNoTracking <HRServiceScholarResident>();
                    HRServiceScholarResident beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking

                        var old_details = new HRServiceScholarResidentTracking
                        {
                            Status               = "old",
                            CaseAuditID          = audit.CaseAuditID,
                            CaseID               = beforeCase.CaseID,
                            Name                 = beforeCase.Name,
                            ScholarJobProfile    = beforeCase.ScholarJobProfile,
                            ScholarRequestType   = beforeCase.ScholarRequestType,
                            EffectiveStartDate   = beforeCase.EffectiveStartDate,
                            EffectiveEndDate     = beforeCase.EffectiveEndDate,
                            Department           = beforeCase.Department,
                            StepStipendAllowance = beforeCase.StepStipendAllowance,
                            Note                 = beforeCase.Note,
                            BudgetNumbers        = beforeCase.BudgetNumbers
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new HRServiceScholarResidentTracking
                        {
                            Status               = "new",
                            CaseAuditID          = audit.CaseAuditID,
                            CaseID               = hrScholar.CaseID,
                            Name                 = hrScholar.Name,
                            ScholarRequestType   = hrScholar.ScholarRequestType,
                            EffectiveStartDate   = hrScholar.EffectiveStartDate,
                            EffectiveEndDate     = hrScholar.EffectiveEndDate,
                            Department           = hrScholar.Department,
                            ScholarJobProfile    = hrScholar.ScholarJobProfile,
                            StepStipendAllowance = hrScholar.StepStipendAllowance,
                            Note                 = hrScholar.Note,
                            BudgetNumbers        = hrScholar.BudgetNumbers
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(hrScholar);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HRServiceScholarResidentExists(hrScholar.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(hrScholar));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,StudentName,PatientName,PatientAddress,PatientPhone,BirthDate,Complaint,TreatmentPlan,bwxrays,paxrays,RestorativeExam,PerioExam,Prophy,Other, OtherProcedure,TChart,Note")] PerioLimitedCare perioLimitedCare)

        {
            if (id != perioLimitedCare.CaseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    IQueryable <PerioLimitedCare> beforeCases = _context.PerioLimitedCare.Where(c => c.CaseID == id).AsNoTracking <PerioLimitedCare>();
                    PerioLimitedCare beforeCase = beforeCases.FirstOrDefault();
                    if (beforeCase == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        // Creating an audit log
                        var audit = new CaseAudit {
                            AuditLog = "Case Specific Details Edited", CaseID = id, LocalUserID = User.Identity.Name
                        };
                        _context.Add(audit);
                        await _context.SaveChangesAsync();

                        // Adding old details to tracking

                        var old_details = new PerioLimitedCareTracking
                        {
                            Status          = "old",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = beforeCase.CaseID,
                            BirthDate       = beforeCase.BirthDate,
                            StudentName     = beforeCase.StudentName,
                            PatientName     = beforeCase.PatientName,
                            TreatmentPlan   = beforeCase.TreatmentPlan,
                            Complaint       = beforeCase.Complaint,
                            PatientAddress  = beforeCase.PatientAddress,
                            PatientPhone    = beforeCase.PatientPhone,
                            PerioExam       = beforeCase.PerioExam,
                            OtherProcedure  = beforeCase.OtherProcedure,
                            RestorativeExam = beforeCase.RestorativeExam,
                            bwxrays         = beforeCase.bwxrays,
                            paxrays         = beforeCase.paxrays,
                            TChart          = beforeCase.TChart,
                        };
                        _context.Add(old_details);
                        // Adding current details to tracking
                        var new_details = new PerioLimitedCareTracking
                        {
                            Status          = "new",
                            CaseAuditID     = audit.CaseAuditID,
                            CaseID          = perioLimitedCare.CaseID,
                            BirthDate       = perioLimitedCare.BirthDate,
                            StudentName     = perioLimitedCare.StudentName,
                            PatientName     = perioLimitedCare.PatientName,
                            TreatmentPlan   = perioLimitedCare.TreatmentPlan,
                            Complaint       = perioLimitedCare.Complaint,
                            PatientAddress  = perioLimitedCare.PatientAddress,
                            PatientPhone    = perioLimitedCare.PatientPhone,
                            PerioExam       = perioLimitedCare.PerioExam,
                            OtherProcedure  = perioLimitedCare.OtherProcedure,
                            RestorativeExam = perioLimitedCare.RestorativeExam,
                            bwxrays         = perioLimitedCare.bwxrays,
                            paxrays         = perioLimitedCare.paxrays,
                            TChart          = perioLimitedCare.TChart,
                        };
                        _context.Add(new_details);
                        // Adding current details to actual Case Type entity
                        _context.Update(perioLimitedCare);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PerioLimitedCareExists(perioLimitedCare.CaseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
            }
            return(View(perioLimitedCare));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseID,EmployeeName,RequestType,BasePayChange,AllowanceChange,EffectiveStartDate,EffectiveEndDate,TerminationReason,Offboarding,Note,ClosePosition,LeaveWA,WorkerType,Amount,SupOrg,EmployeeEID,BudgetNumbers")] HRServiceStaff hrStaff)

        {
            /** First check important fields to see if values have changed and if so add to audit log **/

            string strAudit = "Case Edited. Values updated (old,new). ";

            IQueryable <HRServiceStaff> beforeCases = _context.HRServiceStaff.Where(c => c.CaseID == id).AsNoTracking <HRServiceStaff>();
            HRServiceStaff beforeCase = beforeCases.FirstOrDefault();

            if (beforeCase == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                string bcRequest   = beforeCase.RequestType.ToString();
                string currRequest = hrStaff.RequestType.ToString();
                string bcBase      = beforeCase.BasePayChange.ToString();
                string currBase    = hrStaff.BasePayChange.ToString();
                string bcAllow     = beforeCase.AllowanceChange.ToString();
                string currAllow   = hrStaff.AllowanceChange.ToString();
                string bcTerm      = beforeCase.TerminationReason.ToString();
                string currTerm    = hrStaff.TerminationReason.ToString();
                string bcOff       = beforeCase.Offboarding.ToString();
                string bcLeave     = beforeCase.LeaveWA.ToString();
                string bcClose     = beforeCase.ClosePosition.ToString();
                string currOff     = hrStaff.Offboarding.ToString();
                string currLeave   = hrStaff.LeaveWA.ToString();
                string currClose   = hrStaff.ClosePosition.ToString();
                string currAmount  = "";
                if (!String.IsNullOrEmpty(hrStaff.Amount))
                {
                    currAmount = hrStaff.Amount;
                }
                string bcAmount = "";
                if (!String.IsNullOrEmpty(beforeCase.Amount))
                {
                    bcAmount = beforeCase.Amount;
                }
                if (bcRequest != currRequest)
                {
                    if (currRequest != "Termination")
                    {
                        hrStaff.TerminationReason = null;
                        hrStaff.Offboarding       = false;
                        hrStaff.LeaveWA           = false;
                        hrStaff.ClosePosition     = false;
                        currTerm  = null;
                        currOff   = "False";
                        currLeave = "False";
                        currClose = "False";
                    }
                    if (currRequest != "Allowance")
                    {
                        hrStaff.AllowanceChange = null;
                        currAllow = "";
                    }
                    if (currRequest != "Base")
                    {
                        hrStaff.BasePayChange = null;
                        currBase       = "";
                        hrStaff.Amount = "";
                        currAmount     = "";
                    }
                }
                if (beforeCase.EmployeeName != hrStaff.EmployeeName)
                {
                    strAudit += "Employee: (" + beforeCase.EmployeeName + "," + hrStaff.EmployeeName + ") ";
                }
                if (beforeCase.WorkerType.ToString() != hrStaff.WorkerType.ToString())
                {
                    strAudit += "WorkerType: (" + beforeCase.WorkerType.ToString() + "," + hrStaff.WorkerType.ToString() + ") ";
                }

                if (beforeCase.RequestType.ToString() != hrStaff.RequestType.ToString())
                {
                    strAudit += "RequestType: (" + beforeCase.RequestType.ToString() + "," + hrStaff.RequestType.ToString() + ") ";
                }
                if (bcBase != currBase)
                {
                    strAudit += "BasePayChange: (" + bcBase + "," + currBase + ") ";
                }

                if (bcAmount != currAmount)
                {
                    strAudit += "Amount: (" + bcAmount + "," + currAmount + ") ";
                }
                if (bcAllow != currAllow)
                {
                    strAudit += "AllowanceChange: (" + bcAllow + "," + currAllow + ") ";
                }
                if (bcTerm != currTerm)
                {
                    strAudit += "TerminationReason: (" + bcTerm + "," + currTerm + ") ";
                }
                if (bcOff != currOff)
                {
                    strAudit += "Offboarding: (" + bcOff + "," + currOff + ") ";
                }
                if (bcLeave != currLeave)
                {
                    strAudit += "LeaveWA: (" + bcLeave + "," + currLeave + ") ";
                }
                if (bcClose != currClose)
                {
                    strAudit += "ClosePosition: (" + bcClose + "," + currClose + ") ";
                }

                if (beforeCase.EffectiveStartDate.ToShortDateString() != hrStaff.EffectiveStartDate.ToShortDateString())
                {
                    strAudit += "StartDate: (" + beforeCase.EffectiveStartDate.ToShortDateString() + "," + hrStaff.EffectiveStartDate.ToShortDateString() + "),";
                }
                DateTime beforeEffectDate = beforeCase.EffectiveEndDate.GetValueOrDefault();
                DateTime curEffectDate    = hrStaff.EffectiveEndDate.GetValueOrDefault();
                if (beforeEffectDate.ToShortDateString() != curEffectDate.ToShortDateString())
                {
                    strAudit += "EndDate: (" + beforeEffectDate.ToShortDateString() + "," + curEffectDate.ToShortDateString() + ") ";
                }
                if (beforeCase.SupOrg.ToString() != hrStaff.SupOrg.ToString())
                {
                    strAudit += "SupOrg: (" + beforeCase.SupOrg.ToString() + "," + hrStaff.SupOrg.ToString() + ") ";
                }


                if (beforeCase.EmployeeEID.ToString() != hrStaff.EmployeeEID.ToString())
                {
                    strAudit += "EmployeeEID: (" + beforeCase.EmployeeEID.ToString() + "," + hrStaff.EmployeeEID.ToString() + ") ";
                }
                if (!String.IsNullOrEmpty(beforeCase.BudgetNumbers) && !String.IsNullOrEmpty(hrStaff.BudgetNumbers))
                {
                    if (beforeCase.BudgetNumbers.ToString() != hrStaff.BudgetNumbers.ToString())
                    {
                        strAudit += "Budgets: (" + beforeCase.BudgetNumbers.ToString() + "," + hrStaff.BudgetNumbers.ToString() + ") ";
                    }
                }

                var audit = new CaseAudit {
                    AuditLog = strAudit, CaseID = id, LocalUserID = User.Identity.Name
                };
                _context.Add(audit);
                _context.Entry(hrStaff).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                var cid = id;
                return(RedirectToAction("Details", "Cases", new { id = cid, area = "" }));
                //return RedirectToAction("Index", "Home");
            }
            return(View(hrStaff));
        }