public static string GenerateUpdateEmailSubject(OfficeLocation officeLocation) { var subject = "ACTION REQUIRED: Office Data Source Update for the " + officeLocation.Name + " Office"; return(subject); }
public ViewProfileResponse ViewProfile(ViewProfileRequest request) { if (request == null) { throw new InvalidUserRequest("Request object cannot be null"); } var selectedUser = _users.Users.Where(x => x.UserId == request.UserId); var name = ""; var userImage = ""; var description = ""; var phoneNumber = ""; var empLevel = 111; OfficeLocation officeLocation = OfficeLocation.Braamfontein; UserRoles userRole = UserRoles.Administrator; foreach (var x in selectedUser) { name = x.Name; userImage = x.UserImgUrl; description = x.UserDescription; phoneNumber = x.PhoneNumber; empLevel = x.EmployeeLevel; officeLocation = x.OfficeLocation; userRole = x.UserRole; } ViewProfileResponse response = new ViewProfileResponse(HttpStatusCode.OK, name, userImage, description, phoneNumber, empLevel, userRole, officeLocation); return(response); }
public static string GenerateInsertEmailSubject(OfficeLocation officeLocation) { var subject = "ACTION REQUIRED: New Office - " + officeLocation.Name; return(subject); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] OfficeLocation officeLocation) { if (id != officeLocation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(officeLocation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OfficeLocationExists(officeLocation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(officeLocation)); }
private static Nomination LoadSuperStarAwardsNominationFromSurveyExport(Row row, int rowNumber) { var isAnonymousNominator = row[10] != @"Display My Name (Recommended)"; var nominatorName = PersonName.CreateForNominator(row[9], isAnonymousNominator); var nomineeName = PersonName.Create(row[12]); var awardType = AwardType.SuperStar; var nomineeOfficeLocation = OfficeLocation.FindByName(row[14]); var hasContinuouslyImproving = !string.IsNullOrWhiteSpace(row[15]); var hasDrivingInnovation = !string.IsNullOrWhiteSpace(row[16]); var hasDelightingCustomers = !string.IsNullOrWhiteSpace(row[17]); var hasBehavingWithIntegrity = !string.IsNullOrWhiteSpace(row[18]); var hasDeliveringMeaningfulOutcomes = !string.IsNullOrWhiteSpace(row[19]); var hasStreamingGood = !string.IsNullOrWhiteSpace(row[20]); var writeUp = NominationWriteUp.Create(nomineeName, row[21]); var writeUpSummary = NominationWriteUpSummary.NotApplicable; var companyValues = GetCompanyValues(hasContinuouslyImproving, hasDrivingInnovation, hasDelightingCustomers, hasBehavingWithIntegrity, hasDeliveringMeaningfulOutcomes, hasStreamingGood); var nominee = Person.Create(nomineeName, nomineeOfficeLocation, nomineeName.DerivedEmailAddress); var nomination = new Nomination(rowNumber, NomineeVotingIdentifier.Unknown, nominee, awardType, nominatorName, companyValues, writeUp, writeUpSummary); return(nomination); }
public static OfficeDto ExtractDto(this OfficeLocation officeLocation) { if (officeLocation == null) { return(null); } var officeDto = new OfficeDto() { OfficeId = officeLocation.OfficeId, Name = officeLocation.Name, Address = officeLocation.Address, CountrySlug = officeLocation.Country.Slug, Switchboard = officeLocation.Switchboard, Fax = officeLocation.Fax, }; switch (officeLocation.Operating) { case "Active": officeDto.Operating = 1; break; case "Closed": officeDto.Operating = 0; break; default: throw new ArgumentOutOfRangeException(); } return(officeDto); }
public void CreateOfficeLocation(OfficeLocation officeLocation) { if (officeLocation == null) { return; } this._dataBase.Insert(officeLocation); }
public void UpdateOfficeLocation(OfficeLocation officeLocation) { if (officeLocation == null) { return; } this._dataBase.Update(officeLocation); }
public EditProfileRequest(int userId, string name, string phoneNumber, string userDescription, string userImage, bool isAdmin, int empLevel, UserRoles userRoles, OfficeLocation officeLocation) { this._userId = userId; this._name = name; this._phoneNumber = phoneNumber; this._userDescription = userDescription; this._userImage = userImage; this._officeLocation = officeLocation; }
public async Task <IActionResult> Create([Bind("Id,Name")] OfficeLocation officeLocation) { if (ModelState.IsValid) { _context.Add(officeLocation); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(officeLocation)); }
private void SendInsertEmail( OfficeLocation changedOfficeLocation) { var body = OfficeLocationFacadeHelper.GenerateInsertEmailBody( changedOfficeLocation); var subject = OfficeLocationFacadeHelper.GenerateInsertEmailSubject( changedOfficeLocation); _client.SendEmailMessage(body, subject); }
public ActionResult UpdateOfficeLocation() { OfficeLocation officeLocation = RequestArgs <OfficeLocation>(); if (officeLocation == null) { return(RespondResult(false, "参数无效。")); } _settingsManager.UpdateOfficeLocation(officeLocation); return(RespondResult()); }
private void SendUpdateEmail( OfficeLocation changedOfficeLocation, OfficeLocation originalOfficeLocation) { var body = OfficeLocationFacadeHelper.GenerateUpdateEmailBody( changedOfficeLocation, originalOfficeLocation); var subject = OfficeLocationFacadeHelper.GenerateUpdateEmailSubject( originalOfficeLocation); _client.SendEmailMessage(body, subject); }
protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity <Product>() .ToTable("Product"); builder.Entity <Category>() .ToTable("Categories"); builder.Entity <List>() .ToTable("List") .Property(e => e.OrderState) .HasConversion(new EnumToStringConverter <OrderState>()); builder.Entity <ListProduct>() .ToTable("ListProduct") .Property(e => e.ListProductState) .HasConversion(new EnumToStringConverter <ListProductState>()); builder.Entity <UserListProductVote>() .ToTable("UserListProductVote") .Property(e => e.UserProductVoteState) .HasConversion(new EnumToStringConverter <UserProductVoteState>()); builder.Entity <OfficeLocation>() .ToTable("OfficeLocation"); builder.Entity <AuditLog>() .ToTable("AuditLog") .Property(e => e.AuditAction) .HasConversion(new EnumToStringConverter <AuditAction>()); var indyOffice = new OfficeLocation() { Id = 1, Name = "Indy Office", Active = true, Address = "9025 River Road Suite 150", City = "Indianapolis", Country = "USA", CreatedDateTimeUtc = DateTime.UtcNow, State = "IN", Zip = "46240" }; builder.Entity <OfficeLocation>() .HasData(indyOffice); }
public static string GenerateInsertEmailBody(OfficeLocation officeLocation) { string body = @" Hello, <br /> <br /> The following update was just made to the Office Data Source system: <br /> <br /> Office: {0} <br /> <br /> <table cellpadding='10'> <tr> <td>Office Name:</td> <td style='color:red;font-weight:bold;'>{1}</td> </tr> <tr> <td>Address: </td> <td style='color:red;font-weight:bold;'>{2}</td> </tr> <tr> <td>Phone: </td> <td style='color:red;font-weight:bold;'>{3}</td> </tr> <tr> <td>Fax: </td> <td style='color:red;font-weight:bold;'>{4}</td> </tr> <tr> <td>Operating Status: </td> <td style='color:red;font-weight:bold;'>{5}</td> </tr> </table> <br /><br /> Please make sure that your system reflects this change, and that the proper employees are notified of the change. If you have any questions regarding this change, please reach out to the Corporate Services/Technology team for help. <br /><br /> Thanks! <br /> <br /> ODS Team "; var officeAddress = officeLocation.Address.Replace(CRLF, "<br/>") + "<br/>" + officeLocation.Country.Name; body = string.Format(body, officeLocation.Name, officeLocation.Name, officeAddress, officeLocation.Switchboard, officeLocation.Fax, officeLocation.Operating); return(body); }
public ActionResult CreateOfficeLocation() { OfficeLocation officeLocation = RequestArgs <OfficeLocation>(); if (officeLocation == null) { return(RespondResult(false, "参数无效。")); } officeLocation.Id = Guid.NewGuid(); _settingsManager.CreateOfficeLocation(officeLocation); return(RespondDataResult(new { officeLocation.Id })); }
public CreateUserRequest(int userId, string firstName, string lastName, int phoneNumber, List <int> pinnedUserIds, string userImage, string userDescription, bool isOnline, bool isAdmin, int employeeLevel, UserRoles userRole, OfficeLocation officeLocation) { _userId = userId; _firstName = firstName; _lastName = lastName; _phoneNumber = phoneNumber; _pinnedUserIds = pinnedUserIds; _userImage = userImage; _userDescription = userDescription; _isOnline = isOnline; _isAdmin = isAdmin; _employeeLevel = employeeLevel; _userRole = userRole; _officeLocation = officeLocation; }
private OfficeLocation GetClientLocationByIp() { OfficeLocation retval = new OfficeLocation(); try { using (var reader = new DatabaseReader("GeoLite2Db/GeoLite2-City.mmdb")) { // Replace "City" with the appropriate method for your database, e.g., // "Country". string clientIp = Request.UserHostAddress; var city = reader.City(clientIp); Console.WriteLine(city.Country.IsoCode); // 'US' Console.WriteLine(city.Country.Name); // 'United States' Console.WriteLine(city.MostSpecificSubdivision.Name); // 'Minnesota' Console.WriteLine(city.MostSpecificSubdivision.IsoCode); // 'MN' Console.WriteLine(city.City.Name); // 'Minneapolis' retval.Name = city.City.Name; Console.WriteLine(city.Postal.Code); // '55455' Console.WriteLine(city.Location.Latitude); // 44.9733 Console.WriteLine(city.Location.Longitude); // -93.2323 retval.LocationX = city.Location.Latitude.HasValue ? city.Location.Latitude.Value : 59.3252315; retval.LocationY = city.Location.Longitude.HasValue ? city.Location.Longitude.Value : 18.0599355; if (!city.Location.Latitude.HasValue || !city.Location.Longitude.HasValue) { retval.Name = "Osäker position"; retval.LocationX = 59.3252315; retval.LocationY = 18.0599355; } } } catch { retval.Name = "Osäker position"; retval.LocationX = 59.3252315; retval.LocationY = 18.0599355; } return(retval); }
public GetUserResponse(Models.User.User user, String name, int emplvl, bool isadmin, String desc, int userid, string number, UserRoles role, String image, OfficeLocation office, List <int> pinnedids) { this.description = desc; this.UserRole = role; this.name = name; this.empLevel = emplvl; this.isAdmin = isadmin; this.userID = userid; this.phoneNumber = number; this.userImage = image; this.OfficeLocation = office; for (int i = 0; i < pinnedids.Count; i++) { this.pinnedIDs[i] = pinnedids[i]; } this.user = user; }
internal Nomination ToNomination() { var nominee = Person.Create(PersonName.Create(NomineeName), OfficeLocation.FindByName(NomineeOfficeLocation), EmailAddress.Create(NomineeEmailAddress)); var companyValues = (CompanyValues ?? Enumerable.Empty <string>()) .Select(CompanyValue.FindByValue) .ToList(); return(new Nomination(Id, NomineeVotingIdentifier.Unknown, nominee, ValueObjects.AwardType.FindByAwardName(AwardType), PersonName.CreateForNominator(NominatorName, IsNominatorAnonymous), companyValues, NominationWriteUp.Create(nominee.Name, WriteUp), NominationWriteUpSummary.Create(WriteUpSummary))); }
public void UpdateNomineeOfficeLocation(Person nominee, OfficeLocation newOfficeLocation) { if (nominee == null) { throw new ArgumentNullException(nameof(nominee)); } if (newOfficeLocation == null) { throw new ArgumentNullException(nameof(newOfficeLocation)); } if (!OfficeLocation.ValidEmployeeOfficeLocations.Contains(newOfficeLocation)) { throw new ArgumentException(nameof(newOfficeLocation)); } var nominations = Nominations.Where(n => n.Nominee == nominee); var updated = false; foreach (var nomination in nominations) { nomination.UpdateNomineeOfficeLocation(newOfficeLocation); updated = true; } if (!updated) { return; } SetNomineeIdentifiers(); var awardWinner = AwardWinners.FirstOrDefault(w => w.Person == nominee); if (awardWinner != null) { awardWinner.UpdateAwardWinnerOfficeLocation(newOfficeLocation); } MarkAsDirty( $@"Updated nominee {nominee.Name.FullName}'s office location from {nominee.OfficeLocation.Name} to { newOfficeLocation.Name }"); }
public async Task <ReportCode> CreateNewReportCode(OfficeLocation officeLocation, CancellationToken token) { //if (_connectionHelper.IsNetworkAvailable()) //{ try { var response = await SendRequest(HttpRequestEnum.CreateNewReportCode, HttpMethod.Post, officeLocation, token); var dto = JsonConvert.DeserializeObject <ReportCodeDto>(response); var mapped = _appMapper.Map <ReportCode>(dto); return(mapped); } catch (Exception) { return(null); } //} //throw new Exception("No Internet connectivity detected. Please reconnect and try again."); }
public int AddLocation(OfficeLocationDto location) { try { int insertedId = 0; if (!_context.OfficeLocation.Any(r => r.Address == location.Address && r.IsDeleted == false)) { var office_location = new OfficeLocation { Address = location.Address }; _context.OfficeLocation.Add(office_location); _context.SaveChanges(); insertedId = office_location.Id; } return(insertedId); } catch { return(0); } }
public OfficeLocation Update(OfficeLocation changedOfficeLocation) { var offices = GetAll(); if (offices.All(x => x.OfficeId != changedOfficeLocation.OfficeId)) { var id = _officeLocationRepository.Insert(changedOfficeLocation); changedOfficeLocation.OfficeId = id; SendInsertEmail(changedOfficeLocation); } else { var originalOfficeLocation = GetById(changedOfficeLocation.OfficeId); _officeLocationRepository.Update(changedOfficeLocation); if (originalOfficeLocation != changedOfficeLocation) { SendUpdateEmail(changedOfficeLocation, originalOfficeLocation); } } return(changedOfficeLocation); }
public async Task <ReportCode> CreateNew(OfficeLocation officeLocation) { try { var currentDate = DateTime.Now; var date = new DateTime(currentDate.Year, 1, 1, 0, 0, 0, 0); var count = await _reportCodeDataService.GetCountByDateRange(date, null); var reportCode = new ReportCode { Location = officeLocation, Code = $"{AppId}{officeLocation}{currentDate.Year.ToString().Substring(2, 2)}{(count + 1).ToString().PadLeft(4, '0')}", CreationDate = currentDate }; await _reportCodeDataService.Add(reportCode); return(reportCode); } catch (Exception ex) { return(null); } }
public User(int userId, string name, string phoneNumber, List <int> pinnedUserIds, string userImgUrl, string userDescription, bool isAdmin, int employeeLevel, UserRoles userRole, OfficeLocation officeLocation) { UserId = userId; this.Name = name; this.PhoneNumber = phoneNumber; this.PinnedUserIds = pinnedUserIds; this.UserImgUrl = userImgUrl; this.UserDescription = userDescription; this.IsAdmin = isAdmin; this.EmployeeLevel = employeeLevel; this.UserRole = userRole; this.OfficeLocation = officeLocation; }
public static string GenerateUpdateEmailBody(OfficeLocation newOfficeLocation, OfficeLocation originalOfficeLocation) { string changedName = newOfficeLocation.Name; if (newOfficeLocation.Name != originalOfficeLocation.Name) { changedName = "<span style='color:red;font-weight:bold;'>" + newOfficeLocation.Name + "</span>"; } string changedAddress = newOfficeLocation.Address.Replace(CRLF, "<br/>") + "<br/>" + newOfficeLocation.Country.Name; if (newOfficeLocation.Address != originalOfficeLocation.Address || newOfficeLocation.Country != originalOfficeLocation.Country) { changedAddress = "<span style='color:red;font-weight:bold;'>" + newOfficeLocation.Address.Replace(CRLF, "<br/>") + "<br/>" + newOfficeLocation.Country.Name + "</span>"; } string changedSwitchboard = newOfficeLocation.Switchboard; if (newOfficeLocation.Switchboard != originalOfficeLocation.Switchboard) { changedSwitchboard = "<span style='color:red;font-weight:bold;'>" + newOfficeLocation.Switchboard + "</span>"; } string changedFax = newOfficeLocation.Fax; if (newOfficeLocation.Fax != originalOfficeLocation.Fax) { changedFax = "<span style='color:red;font-weight:bold;'>" + newOfficeLocation.Fax + "</span>"; } string changedOperating = newOfficeLocation.Operating; if (newOfficeLocation.Operating != originalOfficeLocation.Operating) { changedOperating = "<span style='color:red;font-weight:bold;'>" + newOfficeLocation.Operating + "</span>"; } string body = @" Hello, <br /> <br /> The following update was just made to the Office Data Source system: <br /> <br /> Office: {0} <br /> <table cellpadding='10'> <tr> <th></th> <th><u>Old</u></th> <th><u>Updated</u></th> </tr> <tr> <td>Office Name:</td> <td>{1}</td> <td>{2}</td> </tr> <tr> <td>Address: </td> <td>{3}</td> <td>{4}</td> </tr> <tr> <td>Phone: </td> <td>{5}</td> <td>{6}</td> </tr> <tr> <td>Fax: </td> <td>{7}</td> <td>{8}</td> </tr> <tr> <td>Operating Status: </td> <td>{9}</td> <td>{10}</td> </tr> </table> <br /><br> Please make sure that your system reflects this change, and that the proper employees are notified of the change. If you have any questions regarding this change, please reach out to the Corporate Services/Technology team for help. <br /><br /> Thanks! <br /> <br /> ODS Team "; var originalOfficeAddress = originalOfficeLocation.Address.Replace(CRLF, "<br/>") + "<br/>" + originalOfficeLocation.Country.Name; body = string.Format(body, originalOfficeLocation.Name, originalOfficeLocation.Name, changedName, originalOfficeAddress, changedAddress, originalOfficeLocation.Switchboard, changedSwitchboard, originalOfficeLocation.Fax, changedFax, originalOfficeLocation.Operating, changedOperating); return(body); }
internal void UpdateNomineeOfficeLocation(OfficeLocation newOfficeLocation) { Nominee = Nominee.UpdateOfficeLocation(newOfficeLocation); }
public void DeleteOfficeLocation(OfficeLocation OfficeLocation) { UnitOfWork.OfficeLocationRepository.Delete(OfficeLocation); }
protected override void Execute(CodeActivityContext executionContext) { //Create the tracing service ITracingService trace = executionContext.GetExtension <ITracingService>(); //Create the context IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); try { EntityReference RetrivedEntity = null; var expression = string.Empty; expression = Expression.Get <string>(executionContext); if (expression == null || expression == "") { throw new InvalidPluginExecutionException("Expression is null"); } trace.Trace("retrieving Parent Record"); RetrivedEntity = RetrieveRecordProcessHelper.RetrieveParentRecord(expression, service, context, trace); if (RetrivedEntity != null) { if (RetrivedEntity.LogicalName == "tc_locationoffice") { OfficeLocation.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "account") { Account.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "contact") { Contact.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "incident") { Case.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_assistancerequest") { AssistanceRequest.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_bookingaccommodation") { Accommodation.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_caseline") { CaseLine.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_hotel") { Hotel.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_country") { Country.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "businessunit") { BusinessUnit.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_recovery") { Recovery.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_bookingtransfer") { Bookingtransfer.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_bookingtransport") { Bookingtransport.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "tc_bookingextraservice") { Bookingextraservice.Set(executionContext, RetrivedEntity); } if (RetrivedEntity.LogicalName == "team") { Team.Set(executionContext, RetrivedEntity); } } } catch (FaultException <OrganizationServiceFault> ex) { throw new InvalidPluginExecutionException(ex.ToString()); } catch (TimeoutException ex) { throw new InvalidPluginExecutionException(ex.ToString()); } catch (Exception ex) { throw new InvalidPluginExecutionException(ex.ToString()); } }