public ExamInit() { InitializeComponent(); add_collage_list(); intialize_windows(); SaveExamButton.IsEnabled = false; days.Text = _numValue.ToString(); work_locationl = db.WorkLocations.Where(x => x.Name == collageList.Text).FirstOrDefault(); string collage_name = collageList.Text.ToString(); work_locationl = db.WorkLocations.Where(x => x.Name == collage_name).FirstOrDefault(); dean_name.Text = work_locationl.Dean; deanName = work_locationl.Dean; manager_name.Text = work_locationl.Manager; wl = work_locationl.Manager; ExamList = new ObservableCollection <Exam>(db.Exams.OrderByDescending(x => x.Id).Where(e => e.WorkLocationId.Equals(work_locationl.Id)).ToList()); CurrentExam = ExamList.FirstOrDefault(); SelectedExamComboBox.ItemsSource = ExamList; SelectedExamComboBox.SelectedValue = CurrentExam; getExamID(); //SelectedExamComboBox.SelectedValue = CurrentExam.Id; //SelectedExamComboBox.SelectedValuePath = "Id"; //SelectedExamComboBox.DisplayMemberPath = "Id"; }
public ActionResult DeleteConfirmed(int id) { WorkLocation workLocation = db.WorkLocations.Find(id); db.WorkLocations.Remove(workLocation); db.SaveChanges(); return(RedirectToAction("Index")); }
// تهيئة الواجهة public void intialize_windows() { // ارجاع مكان العمل بحسب المستخدم الذي قام بتسجيل الدخول work_locationl = db.WorkLocations.Where(x => x.Id == user_id).FirstOrDefault(); collageList.Text = work_locationl.Name; dean_name.Text = work_locationl.Dean; manager_name.Text = work_locationl.Manager; }
public WorkLocation Post(WorkLocation workLocation) { if (workLocation == null || !ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request"); } return(workLocationService.SaveWorkLocation(workLocation.CreateFrom()).CreateFromm()); }
public Boolean Delete(WorkLocation workLocation) { if (workLocation == null || !ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request"); } workLocationService.DeleteWorkLocation(workLocation.WorkLocationId); return(true); }
/// <summary> /// Updates the db instance with user data for add/update operation /// </summary> private void SetUpdateedProperties(WorkLocation dbvWorkLocation, WorkLocation upDatedWorkLocation, String operation) { if (operation.Equals("update")) { dbvWorkLocation.RecLastUpdatedBy = workLocationRepository.LoggedInUserIdentity; dbvWorkLocation.RecLastUpdatedDt = DateTime.Now; dbvWorkLocation.WorkLocationCode = upDatedWorkLocation.WorkLocationCode; dbvWorkLocation.WorkLocationName = upDatedWorkLocation.WorkLocationName; dbvWorkLocation.WorkLocationDescription = upDatedWorkLocation.WorkLocationDescription; dbvWorkLocation.Address.ContactPerson = upDatedWorkLocation.Address.ContactPerson; dbvWorkLocation.Address.StreetAddress = upDatedWorkLocation.Address.StreetAddress; dbvWorkLocation.Address.EmailAddress = upDatedWorkLocation.Address.EmailAddress; dbvWorkLocation.Address.WebPage = upDatedWorkLocation.Address.WebPage; dbvWorkLocation.Address.ZipCode = upDatedWorkLocation.Address.ZipCode; dbvWorkLocation.Address.POBox = upDatedWorkLocation.Address.POBox; dbvWorkLocation.Address.CountryId = upDatedWorkLocation.Address.CountryId; dbvWorkLocation.Address.RegionId = upDatedWorkLocation.Address.RegionId; dbvWorkLocation.Address.SubRegionId = upDatedWorkLocation.Address.SubRegionId; dbvWorkLocation.Address.CityId = upDatedWorkLocation.Address.CityId; dbvWorkLocation.Address.AreaId = upDatedWorkLocation.Address.AreaId; } else { dbvWorkLocation.Address = new Address { ContactPerson = upDatedWorkLocation.Address.ContactPerson, StreetAddress = upDatedWorkLocation.Address.StreetAddress, EmailAddress = upDatedWorkLocation.Address.EmailAddress, WebPage = upDatedWorkLocation.Address.WebPage, ZipCode = upDatedWorkLocation.Address.ZipCode, POBox = upDatedWorkLocation.Address.POBox, AddressTypeId = addressTypeRepository.GetAddressTypeIdByAddressTypeKey(1), CountryId = upDatedWorkLocation.Address.CountryId, RegionId = upDatedWorkLocation.Address.RegionId, SubRegionId = upDatedWorkLocation.Address.SubRegionId, CityId = upDatedWorkLocation.Address.CityId, AreaId = upDatedWorkLocation.Address.AreaId, RecCreatedBy = workLocationRepository.LoggedInUserIdentity, RecCreatedDt = DateTime.Now, RecLastUpdatedDt = DateTime.Now, RecLastUpdatedBy = workLocationRepository.LoggedInUserIdentity, }; dbvWorkLocation.RecCreatedBy = dbvWorkLocation.RecLastUpdatedBy = workLocationRepository.LoggedInUserIdentity; dbvWorkLocation.RecCreatedDt = DateTime.Now; dbvWorkLocation.RecLastUpdatedDt = DateTime.Now; dbvWorkLocation.UserDomainKey = workLocationRepository.UserDomainKey; dbvWorkLocation.CompanyId = upDatedWorkLocation.CompanyId; dbvWorkLocation.WorkLocationCode = upDatedWorkLocation.WorkLocationCode; dbvWorkLocation.WorkLocationName = upDatedWorkLocation.WorkLocationName; dbvWorkLocation.WorkLocationDescription = upDatedWorkLocation.WorkLocationDescription; } }
public JsonResult CreateQuote(string jsonString) { WorkFromView works = JsonConvert.DeserializeObject <WorkFromView>(jsonString); int locationId = WorkLocation.CheckAndUpdateLocation(works.ContactDetails.ClubId, works.ContactDetails.ClubAddress, works.ContactDetails.ClubName); int contactId = Contact.CheckAndUpdateContact(works.ContactDetails.ContactId, works.ContactDetails.ContactName, works.ContactDetails.ContactEmail, works.ContactDetails.ContactNumber, locationId); Quote.CreateQuote(works.QuoteRef, locationId, contactId, works.QuoteDate, works.CourtWorkDetails); return(Json(new { Success = true, Message = "Quoted work added" }, JsonRequestBehavior.AllowGet)); }
private void ChooseNewPosition() { //Debug.Log(WorkLocation); //Debug.Log(WorkLocation.AsBuilding().GetSpawnableTiles()); //Choose random point CurrentTargetPosition = GameManager.RNG.RandomFromList(WorkLocation.AsBuilding().GetSpawnableTiles()).AsVector3(); CurrentPositionTime = Time.time; CurrentPositionTimeOut = GameManager.RNG.RandomInt(40, 60); NewTarget = true; }
public ActionResult Edit([Bind(Include = "WorkLocationID,WorkLocationName,AddressLine1,AddressLine2,City,County,PostCode")] WorkLocation workLocation) { if (ModelState.IsValid) { db.Entry(workLocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workLocation)); }
// تغيير اسم العميد ورئيس الدائرة تبعا لاسم الكلية private void collageList_SelectionChanged(object sender, SelectionChangedEventArgs e) { string collage_name = collageList.Text.ToString(); work_locationl = db.WorkLocations.Where(x => x.Name == collage_name).FirstOrDefault(); dean_name.Text = work_locationl.Dean; deanName = work_locationl.Dean; manager_name.Text = work_locationl.Manager; wl = work_locationl.Manager; }
public ActionResult Edit([Bind(Include = "WorkLocationId,WorkLocationName,Address1,Address2,Address3,Town,Country,PostCode,PhoneNumber,Email")] WorkLocation worklocation) { if (ModelState.IsValid) { db.Entry(worklocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(worklocation)); }
public ActionResult Create([Bind(Include = "WorkLocationID,WorkLocationName,AddressLine1,AddressLine2,City,County,PostCode")] WorkLocation workLocation) { if (ModelState.IsValid) { db.WorkLocations.Add(workLocation); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workLocation)); }
public JsonResult GetClubsBySearchTerm(string term) { IEnumerable <WorkLocationJson> clubs = WorkLocation.GetClubsWithTerm(term).Select(location => new WorkLocationJson { Address = location.GetAddress(), id = location.WorkLocationId, label = location.WorkLocationName, text = location.WorkLocationName }); string jsonstring = JsonConvert.SerializeObject(clubs); return(Json(jsonstring, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit([Bind(Include = "LocationID,Location,WorkID,EmployeeID")] WorkLocation worklocation) { if (ModelState.IsValid) { db.Entry(worklocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "FirstName", worklocation.EmployeeID); ViewBag.WorkID = new SelectList(db.Works, "WorkId", "WorkId", worklocation.WorkID); return(View(worklocation)); }
/// <summary> /// Create From web model /// </summary> public static Cares.Models.DomainModels.WorkLocation CreateFrom(this WorkLocation source) { return(new Cares.Models.DomainModels.WorkLocation { WorkLocationCode = source.WorkLocationCode, WorkLocationId = source.WorkLocationId, WorkLocationName = source.WorkLocationName, WorkLocationDescription = source.WorkLocationDescription, CompanyId = source.CompanyId, Address = source.Address.CreateFrom(), Phones = source.Phones != null?source.Phones.Select(phone => phone.CreateFrom()).ToList() : null, }); }
// GET: WorkLocations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkLocation workLocation = db.WorkLocations.Find(id); if (workLocation == null) { return(HttpNotFound()); } return(View(workLocation)); }
private void employeelist_SelectionChanged(object sender, SelectionChangedEventArgs e) { List <WatcherViewModel> watcherViewModels = new List <WatcherViewModel>(); wl = db.WorkLocations.Where(x => x.Name == employeelist.SelectedItem.ToString()).FirstOrDefault(); // Employees.ItemsSource = db.Watchers.Where(x => x.WorkLocationId == wl.Id).ToList(); List <Watcher> watchers = db.Watchers.Where(x => x.WorkLocationId == wl.Id).ToList(); if (SelectedWatcher.Count() == 0) { foreach (Watcher w in watchers) { watcherViewModels.Add(new WatcherViewModel { Id = w.Id, FullName = w.FullName + " - ف " + w.Class, Class = w.Class, IsSelected = false }); } } else { foreach (Watcher w in watchers) { Boolean b = false; foreach (WatcherViewModel wvm in SelectedWatcher) { if (w.Id == wvm.Id) { b = true; // watcherViewModels.Add(new WatcherViewModel { FullName = w.FullName, Class = w.Class, IsSelected = true }); } } if (b == true) { watcherViewModels.Add(new WatcherViewModel { Id = w.Id, FullName = w.FullName + " - ف " + w.Class, Class = w.Class, IsSelected = true }); } else { watcherViewModels.Add(new WatcherViewModel { Id = w.Id, FullName = w.FullName + " - ف " + w.Class, Class = w.Class, IsSelected = false }); } } } Employees.ItemsSource = watcherViewModels; }
private void roomlist_SelectionChanged(object sender, SelectionChangedEventArgs e) { List <RoomView> roomViewModels = new List <RoomView>(); wl = db.WorkLocations.Where(x => x.Name == roomlist.SelectedItem.ToString()).FirstOrDefault(); //RoomsGrid.ItemsSource = db.Rooms.Where(x => x.WorkLocationId == wl.Id).ToList(); List <Room> rooms = db.Rooms.Where(x => x.WorkLocationId == wl.Id).ToList(); if (SelectedRooms.Count() == 0) { foreach (Room w in rooms) { roomViewModels.Add(new RoomView { Id = w.Id, Name = w.Name, Type = w.Type, Capacity = w.Capacity, WorkLocation = w.WorkLocationId, IsSelected = false }); } } else { foreach (Room w in rooms) { Boolean b = false; foreach (RoomView wvm in SelectedRooms) { if (w.Name == wvm.Name && w.WorkLocationId == wvm.WorkLocation) { b = true; // watcherViewModels.Add(new WatcherViewModel { FullName = w.FullName, Class = w.Class, IsSelected = true }); } } if (b == true) { roomViewModels.Add(new RoomView { Id = w.Id, Name = w.Name, Type = w.Type, Capacity = w.Capacity, WorkLocation = w.WorkLocationId, IsSelected = true }); } else { roomViewModels.Add(new RoomView { Id = w.Id, Name = w.Name, Type = w.Type, Capacity = w.Capacity, WorkLocation = w.WorkLocationId, IsSelected = false }); } } } RoomsGrid.ItemsSource = roomViewModels; }
public IActionResult Add([FromForm] Models.Trbovlje.WorkLocationViewModel workLocation) { if (!ModelState.IsValid) { return(View(workLocation)); } WorkLocation dbWorkLocation = new WorkLocation(); _mapper.Map(workLocation, dbWorkLocation); _dbContext.WorkLocations.Add(dbWorkLocation); _dbContext.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Delete Work Location /// </summary> public void DeleteWorkLocation(long workLocationId) { WorkLocation dBworkLocation = workLocationRepository.Find(workLocationId); if (dBworkLocation != null) { addressRepository.Delete(dBworkLocation.Address); workLocationRepository.Delete(dBworkLocation); workLocationRepository.SaveChanges(); } else { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "WorkLocation with Id {0} not found!", workLocationId)); } }
// GET: /WorkLocation/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkLocation worklocation = db.WorkLocations.Find(id); if (worklocation == null) { return(HttpNotFound()); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "FirstName", worklocation.EmployeeID); ViewBag.WorkID = new SelectList(db.Works, "WorkId", "WorkId", worklocation.WorkID); return(View(worklocation)); }
public static void CreateAccountsIfNeccesary(string connString) { var sqlcontrols = new SqlControls(connString); var userRoles = sqlcontrols.MultiSelectData <UserRole>("Select * From UserRoles"); if (userRoles.Count == 0) { var admin = new UserRole() { Name = "Admin" }; var agent = new UserRole() { Name = "Agent" }; sqlcontrols.Add("UserRoles", admin); sqlcontrols.Add("UserRoles", agent); } var cities = sqlcontrols.MultiSelectData <City>("Select * From Cities"); if (cities.Count == 0) { var city = new City() { Name = "Olongapo City" }; sqlcontrols.Add("Cities", city); } var workLocations = sqlcontrols.MultiSelectData <WorkLocation>("Select * From WorkLocations"); if (workLocations.Count == 0) { var workLocation = new WorkLocation() { Name = "Head Quarter", Barangay = "Sample Barangay", CityId = 1 }; sqlcontrols.Add("WorkLocations", workLocation); } var employees = sqlcontrols.MultiSelectData <Employee>("Select * From Employees"); if (employees.Count == 0) { var adminEmployee = new Employee() { NickName = "System Generated Super Admin", FirstName = "Super", LastName = "Admin", MiddleName = "Pre Generated", Address = "Olongapo City (System Generated)", ContactNumber = "N/A (Edit Upon Official Use)", EmailAddress = "N/A (Edit Upon Official Use)", WorkLocationId = 1, DateTimeCreated = DateTime.Now }; var agentEmployee = new Employee() { NickName = "System Generated Agent", FirstName = "Agent", LastName = "Employee", MiddleName = "Pre Generated", Address = "Olongapo City (System Generated)", ContactNumber = "N/A (Edit Upon Official Use)", EmailAddress = "N/A (Edit Upon Official Use)", WorkLocationId = 1, DateTimeCreated = DateTime.Now }; sqlcontrols.Add("Employees", adminEmployee); sqlcontrols.Add("Employees", agentEmployee); } var users = sqlcontrols.MultiSelectData <User>("Select * From Users"); if (users.Count == 0) { var adminUser = new User() { UserName = "******", Password = AES.Encrypt(_defaultPassword), UserRoleId = 1, EmployeeId = 1, DateTimeCreated = DateTime.Now }; var agentUser = new User() { UserName = "******", Password = AES.Encrypt(_defaultPassword), UserRoleId = 2, EmployeeId = 2, DateTimeCreated = DateTime.Now }; sqlcontrols.Add("Users", adminUser); sqlcontrols.Add("Users", agentUser); } var gameModes = sqlcontrols.MultiSelectData <GameMode>("Select * From GameModes"); if (gameModes.Count == 0) { var straightGame = new GameMode() { Name = "Straight" }; var mixedGame = new GameMode() { Name = "Straight" }; sqlcontrols.Add("GameModes", straightGame); sqlcontrols.Add("GameModes", mixedGame); } var gameSchedules = sqlcontrols.MultiSelectData <GameSchedule>("Select * From GameSchedules"); if (gameModes.Count == 0) { var morningGame = new GameSchedule() { Name = "Moring Session", EntryStart = TimeSpan.Parse("7:00"), EntryEnd = TimeSpan.Parse("8:30"), DrawTime = TimeSpan.Parse("9:00"), IsActive = true, DateTimeCreated = DateTime.Now }; sqlcontrols.Add("GameSchedules", morningGame); } }
/// <summary> /// Save / Update Work Location /// </summary> public WorkLocation SaveWorkLocation(WorkLocation workLocationRequest) { // Check the availability of workLocation code if (workLocationRepository.DoesWorkLocationCodeExists(workLocationRequest)) { throw new CaresException(Resources.Organization.WorkLocation.WorkLocationWithSameCodeExistsError); } WorkLocation dbWorkLocation = workLocationRepository.Find(workLocationRequest.WorkLocationId); bool isFind = false; bool phonesAdded = false; #region Edit if (dbWorkLocation != null) { IEnumerable <Phone> dBVersionPhones = phoneRepository.GetPhonesByWorkLocationId(dbWorkLocation.WorkLocationId); SetUpdateedProperties(dbWorkLocation, workLocationRequest, "update"); #region Phones already exists in DB // ReSharper disable once PossibleMultipleEnumeration if (dBVersionPhones.Any()) { // check for every phone in DB foreach (Phone dBPhone in dBVersionPhones) { //If DbPhone matches to any of request phone than dont delete it else delete if (workLocationRequest.Phones != null) { if (workLocationRequest.Phones.Any(reqPhone => reqPhone.PhoneId == dBPhone.PhoneId)) { isFind = true; } } else { DeletePhone(dBPhone.PhoneId); } if (!isFind) { DeletePhone(dBPhone.PhoneId); } isFind = false; } } #endregion #region Adding New Phones First Time else { if (workLocationRequest.Phones == null) { workLocationRequest.Phones = new Collection <Phone>(); } foreach (var newPhone in workLocationRequest.Phones) { newPhone.RecCreatedBy = newPhone.RecLastUpdatedBy = phoneRepository.LoggedInUserIdentity; newPhone.RecCreatedDt = newPhone.RecLastUpdatedDt = DateTime.Now; newPhone.UserDomainKey = 1; newPhone.IsActive = true; newPhone.IsDeleted = false; newPhone.IsPrivate = false; dbWorkLocation.Phones.Add(newPhone); phonesAdded = true; } } #endregion #region Adding Phones when there are more phones in request thatn in DB if (workLocationRequest.Phones != null && workLocationRequest.Phones.Count > dBVersionPhones.Count() && phonesAdded == false) { foreach (var newPhonee in workLocationRequest.Phones) { if (newPhonee.PhoneId == 0) { newPhonee.RecCreatedBy = newPhonee.RecLastUpdatedBy = phoneRepository.LoggedInUserIdentity; newPhonee.RecCreatedDt = newPhonee.RecLastUpdatedDt = DateTime.Now; newPhonee.UserDomainKey = 1; newPhonee.IsActive = true; newPhonee.IsDeleted = false; newPhonee.IsPrivate = false; dbWorkLocation.Phones.Add(newPhonee); } } } #endregion workLocationRepository.Update(dbWorkLocation); } #endregion #region ADD else { dbWorkLocation = workLocationRepository.Create(); SetUpdateedProperties(dbWorkLocation, workLocationRequest, "insert"); if (workLocationRequest.Phones != null) { dbWorkLocation.Phones = new List <Phone>(); foreach (var phone in (workLocationRequest.Phones)) { phone.RecCreatedBy = phone.RecLastUpdatedBy = phoneRepository.LoggedInUserIdentity; phone.RecCreatedDt = phone.RecLastUpdatedDt = DateTime.Now; phone.UserDomainKey = 1; phone.IsActive = true; phone.IsDeleted = false; phone.IsPrivate = false; dbWorkLocation.Phones.Add(phone); } } workLocationRepository.Add(dbWorkLocation); } #endregion //phoneRepository.SaveChanges(); workLocationRepository.SaveChanges(); // Get detailed object of worklocation return(workLocationRepository.GetWorkLocationWithDetails(dbWorkLocation.WorkLocationId)); }
public Holiday(string name, WorkLocation location, DateTime date) { Name = name; Location = location; Date = date; }
public bool IsHoliday(DateTime current, WorkLocation location) => Holidays.Any(h => h.Location == location && h.Date.Date == current.Date);
public Task <WorkLocation> CreateAsync(WorkLocation item) { return(WorkLocations.CreateAsync(item)); }
public WorkLocation Create(WorkLocation item) { return(WorkLocations.Create(item)); }
public WorkLocation Update(WorkLocation item) { return(WorkLocations.Update(item)); }
public Task <WorkLocation> UpdateAsync(WorkLocation item) { return(WorkLocations.UpdateAsync(item)); }