public CRMView() { InitializeComponent(); _viewModel = new CRMViewModel(); DataContext = _viewModel; Loaded += OnCrmViewLoaded; }
public CRMView() { InitializeComponent(); _viewModel = new CRMViewModel(); DataContext = _viewModel; Loaded += OnCrmViewLoaded; }
public async Task <ActionResult> Create() { await RunNotifications(); var model = new CRMViewModel(); return(View(model)); }
public CRMView() { InitializeComponent(); DataContext = _viewModel = new CRMViewModel(); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Loaded += OnCRMViewLoaded; EnquiriesGridView.MouseDoubleClick += EnquiriesGridViewOnMouseDoubleClick; ActivitiesRadGridView.MouseDoubleClick += ActivitiesGridViewOnMouseDoubleClick; FollowUpsRadGridView.MouseDoubleClick += FollowUpsGridViewOnMouseDoubleClick; CampaignsRadGridView.MouseDoubleClick += CampaignsGridViewOnMouseDoubleClick; }
public async Task <ActionResult> Create(CRMViewModel model) { try { if (ModelState.IsValid) { _repo.AddCRM(_mapper.Map <CRM>(model), CurrentUser.Id); if (await _repo.SaveAllAsync()) { TempData["Success"] = string.Format("CRM has been successfully Created"); return(RedirectToAction("Index")); } } TempData["Error"] = "Unable to create CRM due to some internal issues."; return(RedirectToAction("Index")); } catch (Exception e) { _telemetryClient.TrackException(e); ModelState.AddModelError("error", e.Message); return(ServerError()); } }
public async Task <ActionResult> DeleteConfirmed(CRMViewModel umodel) { try { var model = await _repo.GetCRMById(umodel.Id); _repo.DeleteCRM(model, GetUserId()); if (await _repo.SaveAllAsync()) { TempData["Success"] = $"Successfully deleted CRM"; } else { TempData["Error"] = "Unable to delete CRM due to some internal issues."; } return(RedirectToAction("Index")); } catch (Exception e) { _telemetryClient.TrackException(e); ModelState.AddModelError("error", e.Message); return(ServerError()); } }
public async Task <ActionResult> Manage(CRMViewModel model, string from) { try { if (ModelState.IsValid) { _repo.UpdateCRM(_mapper.Map <CRM>(model), CurrentUser.Id); var revision = new CRMRevisionHistory { UserName = CurrentUser.FirstName + " " + CurrentUser.MiddleName + " " + CurrentUser.LastName, CRMId = model.Id }; _repo.AddCRMRevisionHistory(revision, CurrentUser.Id); if (await _repo.SaveAllAsync()) { TempData["Success"] = string.Format("CRM has been successfully Updated"); if (from == "Email") { return(RedirectToAction("ManageWithEmail", new { id = model.Id })); } else if (from == "Call") { return(RedirectToAction("ManageWithCall", new { id = model.Id })); } else if (from == "Revision") { return(RedirectToAction("ManageWithRevision", new { id = model.Id })); } else { return(RedirectToAction("Manage", new { id = model.Id })); } } TempData["Error"] = "Unable to updated CRM due to some internal issues."; if (from == "Email") { return(RedirectToAction("ManageWithEmail", new { id = model.Id })); } else if (from == "Call") { return(RedirectToAction("ManageWithCall", new { id = model.Id })); } else if (from == "Revision") { return(RedirectToAction("ManageWithRevision", new { id = model.Id })); } else { return(RedirectToAction("Manage", new { id = model.Id })); } } TempData["Error"] = "Unable to create CRM due to some internal issues."; return(RedirectToAction("Index")); } catch (Exception e) { _telemetryClient.TrackException(e); ModelState.AddModelError("error", e.Message); return(ServerError()); } }