private void LoadIntialDataForNwgc(NewActivityModel newActivity) { if (role != "nwgc") { SubmitButton.Text = "Submit"; } else { SubmitButton.Text = "Complete"; LengthEntry.IsEnabled = false; CaptureImage.IsEnabled = false; WidthEntry.IsEnabled = false; DepthEntry.IsEnabled = false; SiteButton.IsEnabled = false; SpoilButton.IsEnabled = false; comments.IsEnabled = false; } LocationEntry.Text = newActivity.Location; ColourSelect.Text = newActivity.Colour; LengthEntry.Text = newActivity.Length; WidthEntry.Text = newActivity.Width; DepthEntry.Text = newActivity.Depth; StatusSelect.Text = newActivity.Status; SurfaceSelect.Text = newActivity.Surface; PublicSelect.Text = newActivity.PublicOrPrivate; SiteButton.IsToggled = newActivity.IsSiteCleared; SpoilButton.IsToggled = newActivity.IsSpoilRemoved; comments.Text = newActivity.Comments; MaterialSelect.Text = newActivity.MaterialDescription; GeoLocation.Text = newActivity.GeoLocation; image1 = newActivity.CaptureImage1; image2 = newActivity.CaptureImage2; }
private void UpdateListContent() { _expandedGroups = new ObservableCollection <ExcavationGroupModel>(); for (int i = 0; i < _allGroups.Count; i++) { ExcavationGroupModel group = _allGroups[i]; for (int j = 0; j < group.Count; j++) { NewActivityModel food = group[j]; switch (j) { case 0: _allGroups[i].StatusCount1StatusIcon = food.IsReviewed ? "Green.png" : "Red.png"; break; case 1: _allGroups[i].StatusCount2StatusIcon = food.IsReviewed ? "Green.png" : "Red.png"; break; default: break; } } ExcavationGroupModel oldGroup = _allGroups[i]; oldGroup.IsDMO = Settings.Role.Equals(Constants.DMO); oldGroup.IsNotEmptyRowPresent = oldGroup[0].IsNotEmptyRow; //Create new FoodGroups so we do not alter original list ExcavationGroupModel newGroup = new ExcavationGroupModel(oldGroup.Title, oldGroup.GroupID, oldGroup.Expanded); //Add the count of food items for Lits Header Titles to use newGroup.FoodCount = oldGroup.Count; newGroup.StatusCount1StatusIcon = oldGroup.StatusCount1StatusIcon; newGroup.StatusCount2StatusIcon = oldGroup.StatusCount2StatusIcon; newGroup.IsDMO = oldGroup.IsDMO; newGroup.IsNotEmptyRowPresent = oldGroup.IsNotEmptyRowPresent; if (group.Expanded) { foreach (NewActivityModel food in oldGroup) { newGroup.Add(food); } } _expandedGroups.Add(newGroup); } GroupedView.ItemsSource = _expandedGroups; }
public ActionResult Create() { var id = this.User.Identity.GetUserId(); var CustomerList = _context.Customers.Where(c => c.IdUser == id).ToList(); List <Status> status = new List <Status>(); status.Add(new Status { Text = "Schedule", Value = "Schedule" }); status.Add(new Status { Text = "Pending", Value = "Pending" }); status.Add(new Status { Text = "In Progress", Value = "In Progress" }); status.Add(new Status { Text = "Completed", Value = "Completed" }); List <ActivityType> activitytype = new List <ActivityType>(); activitytype.Add(new ActivityType { Text = "Call", Value = "Call" }); activitytype.Add(new ActivityType { Text = "Appointment", Value = "Appointment" }); activitytype.Add(new ActivityType { Text = "Email", Value = "Email" }); Activity activity = new Models.Activity(); activity.IdUser = id; var CreateModel = new NewActivityModel { Customers = CustomerList, Status = status, ActivityType = activitytype, Activity = activity }; return(View("ActivityForm", CreateModel)); }
public ActionResult Edit(int id) { var idUser = this.User.Identity.GetUserId(); var CustomerList = _context.Customers.Where(c => c.IdUser == idUser).ToList(); List <Status> status = new List <Status>(); status.Add(new Status { Text = "Schedule", Value = "Schedule" }); status.Add(new Status { Text = "Pending", Value = "Pending" }); status.Add(new Status { Text = "In Progress", Value = "In Progress" }); status.Add(new Status { Text = "Completed", Value = "Completed" }); List <ActivityType> activitytype = new List <ActivityType>(); activitytype.Add(new ActivityType { Text = "Call", Value = "Call" }); activitytype.Add(new ActivityType { Text = "Appointment", Value = "Appointment" }); activitytype.Add(new ActivityType { Text = "Email", Value = "Email" }); var activity = _context.Activities.SingleOrDefault(c => c.Id == id); if (activity == null) { return(HttpNotFound()); } var EditModel = new NewActivityModel { Customers = CustomerList, Status = status, ActivityType = activitytype, Activity = activity }; return(View("ActivityForm", EditModel)); }
private void OnSubmitClicked(object sender, EventArgs e) { isValidate = true; NewActivityModel newActivityModel = new NewActivityModel(); if (role == "dmo") { SubmitValidation(); } newActivityModel.GroupId = _groupId; newActivityModel.Location = LocationEntry.Text; newActivityModel.Colour = ColourSelect.Text; newActivityModel.Length = LengthEntry.Text; newActivityModel.Width = WidthEntry.Text; newActivityModel.Depth = DepthEntry.Text; newActivityModel.Status = StatusSelect.Text; newActivityModel.Surface = SurfaceSelect.Text; newActivityModel.PublicOrPrivate = PublicSelect.Text; newActivityModel.IsSiteCleared = SiteButton.IsToggled; newActivityModel.IsSpoilRemoved = SpoilButton.IsToggled; newActivityModel.Comments = comments.Text; newActivityModel.MaterialDescription = MaterialSelect.Text; newActivityModel.CaptureImage1 = image1; newActivityModel.CaptureImage2 = image2; newActivityModel.GeoLocation = GeoLocation.Text; newActivityModel.IsReviewed = role == "nwgc" ? true : false; if (isValidate) { if (_selectedNewActivityModel != null) { newActivityModel.Id = _selectedNewActivityModel.Id; App.DAUtil.EditEmployee(newActivityModel); } else { App.DAUtil.SaveNewActivity(newActivityModel); } Navigation.PopAsync(); } }
public ExcavationInfoPage(string groupId = "1", NewActivityModel selectedNewActivityModel = null) { InitializeComponent(); NavigationPage.SetBackButtonTitle(this, ""); LengthEntry.Keyboard = Keyboard.Numeric; WidthEntry.Keyboard = Keyboard.Numeric; DepthEntry.Keyboard = Keyboard.Numeric; newActivityVM = new NewActivityViewModel(); _selectedNewActivityModel = selectedNewActivityModel; if (_selectedNewActivityModel != null) { LoadIntialDataForNwgc(_selectedNewActivityModel); } _groupId = groupId; BindingContext = newActivityVM; }
//Post: api/Student/Login //Http call to login a user public async Task <Object> AddActivity(NewActivityModel newActivity) { Activity activity = new Activity { ActivityName = newActivity.ActivityName, CreatorName = newActivity.User.Name, IsActivated = false, MaximumAttenders = newActivity.MaximumAttenders, CreatorId = newActivity.User.Id, Description = newActivity.Description }; try { _dataContext.Activities.Add(activity); await _dataContext.SaveChangesAsync(); return(Ok(activity)); } catch (Exception) { return(BadRequest(null)); } }
public int EditEmployee(NewActivityModel aEmployee) { return(dbConn.Update(aEmployee)); }
public int DeleteEmployee(NewActivityModel aEmployee) { return(dbConn.Delete(aEmployee)); }
public int SaveNewActivity(NewActivityModel aNewActivity) { return(dbConn.Insert(aNewActivity)); }
public ObservableCollection <ExcavationGroupModel> LoadAllExcavationGroups() { var groups = new ObservableCollection <ExcavationGroupModel> { new ExcavationGroupModel("Pipeline 1", "1") { new NewActivityModel { IsNotEmptyRow = false } }, new ExcavationGroupModel("Pipeline 2", "2") { new NewActivityModel { IsNotEmptyRow = false } } }; var vList = App.DAUtil.GetAllEmployees(); var firstGroupExcavationList = vList.Where((it) => it.GroupId.Equals("1")).Take(2).ToList(); var secondGroupExcavationList = vList.Where((it) => it.GroupId.Equals("2")).Take(2).ToList(); try { if (firstGroupExcavationList != null && firstGroupExcavationList.Count() > 0) { groups[0].Clear(); for (int index = 0; index < firstGroupExcavationList.Count(); index++) { NewActivityModel activitityModel = firstGroupExcavationList[index]; if (index == 0) { activitityModel.Name = "Excavation 1"; } else { activitityModel.Name = "Excavation 2"; } groups[0].Add(activitityModel); } } if (secondGroupExcavationList != null && secondGroupExcavationList.Count() > 0) { groups[1].Clear(); for (int index = 0; index < secondGroupExcavationList.Count(); index++) { NewActivityModel activitityModel = secondGroupExcavationList[index]; if (index == 0) { activitityModel.Name = "Excavation 1"; } else { activitityModel.Name = "Excavation 2"; } groups[1].Add(activitityModel); } } }catch (Exception e) { var data = e.InnerException; } return(groups); }