public void UpdateCallCategoryTable() { var IeSMRecords = IeSMDB.CallCategories.ToList(); Console.WriteLine("Checking CallCategory Table"); foreach (var _record in IeSMRecords) { var _id = (int)_record.CallCategory; var _description = _record.Description; var _dateModified = _record.DateModified; var _hermesCallCategory = HermesDb.CallCategories.Find(_id); if (_hermesCallCategory != null) { if (_hermesCallCategory.DateModified.CompareTo(_record.DateModified) != 0) // Returns -1 if the ieSM record is newer { Console.WriteLine("Updating Record : " + _description); _hermesCallCategory.Description = _description; _hermesCallCategory.DateModified = _dateModified; HermesDb.CallCategories.Update(_hermesCallCategory); } } else { Console.WriteLine("Adding Record : " + _description); var _newHermesCallCategory = new CallCategory(_id, _description, _dateModified); HermesDb.CallCategories.Add(_newHermesCallCategory); } } Console.WriteLine("Finished Checking CallCategory Table"); }
public async Task <ActionResult> DeleteConfirmed(int id) { CallCategory callCategory = await db.CallCategories.FindAsync(id); db.CallCategories.Remove(callCategory); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public Customer_CallCategoryDTO(CallCategory CallCategory) { this.Id = CallCategory.Id; this.Code = CallCategory.Code; this.Name = CallCategory.Name; this.Errors = CallCategory.Errors; }
public async Task <CallCategory> Get(long Id) { CallCategory CallCategory = await UOW.CallCategoryRepository.Get(Id); if (CallCategory == null) { return(null); } return(CallCategory); }
public async Task <ActionResult> Edit([Bind(Include = "CallCategoryId,Description")] CallCategory callCategory) { if (ModelState.IsValid) { db.Entry(callCategory).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(callCategory)); }
public async Task <ActionResult> Create([Bind(Include = "CallCategoryId,Description")] CallCategory callCategory) { if (ModelState.IsValid) { db.CallCategories.Add(callCategory); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(callCategory)); }
// GET: CallCategories/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CallCategory callCategory = await db.CallCategories.FindAsync(id); if (callCategory == null) { return(HttpNotFound()); } return(View(callCategory)); }
public async Task <CallCategory> Get(long Id) { CallCategory CallCategory = await DataContext.CallCategory.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new CallCategory() { Id = x.Id, Code = x.Code, Name = x.Name, }).FirstOrDefaultAsync(); if (CallCategory == null) { return(null); } return(CallCategory); }
public void UpdateCallTable() { var IeSMRecords = IeSMDB.LoggedCalls.Where(call => call.CallClosed == 0 && call.AssignedTo != null && call.SubCategoryId != null).ToList(); var HermesRecords = new List <Call>(); Console.WriteLine("Checking Call Table"); foreach (var _record in IeSMRecords) { var _id = (int)_record.CallNo; var _LoggedBy = HermesDb.Users.Find((int)_record.LoggedBy); //var _ClosedBy = HermesDb.Users.Find((int)_record.ClosedBy); User _AssignedTo = HermesDb.Users.Find((int)_record.AssignedTo); var _DateLogged = _record.DateLogged; //var _DateClosed = (DateTime)_record.DateClosed; int _CallDuration; if (_record.CallDuration != null) { _CallDuration = (int)_record.CallDuration; } else { _CallDuration = 0; } int _TotalDuration; if (_record.TotalDuration != null) { _TotalDuration = (int)_record.CallDuration; } else { _TotalDuration = 0; } Customer _Customer = HermesDb.Customers.Find((int)_record.CustNo); var _Contact = _record.ContactName; var _CallDescription = _record.CallDescription; var _Problem = _record.Problem; var _Solution = _record.Solution; var _CallClosed = (int)_record.CallClosed; CallPriority _Priority = HermesDb.CallPriorities.Find((int)_record.SubCategoryId); CallCategory _CallCategory = HermesDb.CallCategories.Find((int)_record.CallCategory); CallStatus _Status = HermesDb.CallStatus.Find((int)_record.StatusNo); var _DateModified = (DateTime)_record.DateModified; User _UserModified = HermesDb.Users.Find((int)_record.UserModified); var _Resolved = (int)_record.PriorityNo; var _hermesCall = HermesDb.Calls.Find(_id); if (_hermesCall != null) { if (_hermesCall.DateModified.CompareTo(_record.DateModified) != 0) // Returns -1 if the ieSM record is newer { Console.WriteLine("Updating Record Call No: " + _id); _hermesCall.LoggedBy = _LoggedBy; //_hermesCall.ClosedBy = _ClosedBy; _hermesCall.AssignedTo = _AssignedTo; _hermesCall.DateLogged = _DateLogged; //_hermesCall.DateClosed = _DateClosed; _hermesCall.CallDuration = _CallDuration; _hermesCall.TotalDuration = _TotalDuration; _hermesCall.Customer = _Customer; _hermesCall.Contact = _Contact; _hermesCall.CallDescription = _CallDescription; _hermesCall.Problem = _Problem; _hermesCall.Solution = _Solution; _hermesCall.CallClosed = _CallClosed; _hermesCall.Priority = _Priority; _hermesCall.CallCategory = _CallCategory; _hermesCall.Status = _Status; _hermesCall.DateModified = _DateModified; _hermesCall.UserModified = _UserModified; _hermesCall.Resolved = _Resolved; } } else { Console.WriteLine("Adding Record : " + _id); var _newHermesCall = new Call(_id, _LoggedBy, /*_ClosedBy,*/ _AssignedTo, _DateLogged, /*_DateClosed,*/ _CallDuration, _TotalDuration, _Customer, _Contact, _CallDescription, _Problem, _Solution, _CallClosed, _Priority, _CallCategory, _Status, _DateModified, _UserModified, _Resolved); HermesDb.Calls.Add(_newHermesCall); } } Console.WriteLine("Finished Checking Call Table"); }