public static void Setup() { var btf = new Models.BusinessTripFormatter(); btf.ApproveAction = ""; btf.CancelAction = ""; BusinessTripFormatterServiceLocator.SetFormatter(btf); }
protected void Application_BeginRequest(object sender, EventArgs args) { var btf = new Models.BusinessTripFormatter(); HttpContextBase currentContext = new HttpContextWrapper(HttpContext.Current); UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); btf.ApproveAction = urlHelper.Action("Approve", "RegisterBT", null, Request.Url.Scheme); btf.CancelAction = urlHelper.Action("Cancel", "RegisterBT", null, Request.Url.Scheme); BusinessTripFormatterServiceLocator.SetFormatter(btf); }
static void Main() { var btf = new Models.BusinessTripFormatter(); btf.ApproveAction = ""; btf.CancelAction = ""; BusinessTripFormatterServiceLocator.SetFormatter(btf); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private void SendEmailToManager(string approveAction, string cancelAction) { IEmailService emailService = EmailServiceLocator.GetEmailService(); Email email = new Email(); email.From = Employee.mailAddress; email.To = Manager.mailAddress; email.Subject = "Please aprove my request"; IBusinessTripFormatter btf = BusinessTripFormatterServiceLocator.GetFormatter(); email.Body = btf.GetBody(this); emailService.Send(email); }
public void Cancel() { if (Status != STATES.STATE_PENDING) { return; } Status = STATES.STATE_CANCELED; IEmailService emailService = EmailServiceLocator.GetEmailService(); Email email = new Email(); email.From = Manager.mailAddress; email.To = Employee.mailAddress; email.Subject = "Your request is canceled"; IBusinessTripFormatter btf = BusinessTripFormatterServiceLocator.GetFormatter(); email.Body = btf.GetBody(this); emailService.Send(email); }
public void Setup() { manager = new Manager("Mihail", "*****@*****.**"); Location location = new Location("BT"); var office = new Office(manager, location); emp = office.CreateEmployee("Valentin", "*****@*****.**"); startingDate = new DateTime(2008, 04, 14); endDate = new DateTime(2008, 04, 30); meaningOfTransportation = "bmw"; AccommodationIsNeeded = true; BusinessTripRepository businessTripRepo = new BusinessTripRepository(); businessTripRepo.CleanUp(); EmailServiceLocator.SetEmailService(new EmailServiceTest()); BusinessTripFormatterServiceLocator.SetFormatter(new BusinessTripFormatterTest()); }
public void Setup() { manager = new Manager("Mihail", "*****@*****.**"); Location location = new Location("BT"); var office = new Office(manager, location); emp = office.CreateEmployee("Valentin", "*****@*****.**"); startingDate = new DateTime(2008, 04, 14); endDate = new DateTime(2008, 04, 30); phone = "112"; bankCard = "1502 4023 3453 3252"; meaningOfTransportation = "bmw"; AccommodationIsNeeded = true; BusinessTripRepository businessTripRepo = new BusinessTripRepository(); businessTripRepo.CleanUp(); EmailServiceLocator.SetEmailService(new GmailEmailService()); BusinessTripFormatterServiceLocator.SetFormatter(new BusinessTripFormatterTest()); }