Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //instantiate a new instance of engineer service
                engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());
                if (!IsPostBack)
                {
                    //call engineer service to get a list of interventions created  and approvedby this engineer and then bind them to UIs
                    List <Intervention> interventions = engineerService.getInterventionListByUserId(getDetail().Id).ToList();



                    foreach (var intervention in interventions)
                    {
                        intervention.InterventionType = engineerService.getInterventionTypes().Find(it => it.Id == intervention.InterventionTypeId);
                    }

                    ListofIntervention.DataSource = interventions;
                    ListofIntervention.DataBind();
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if the query string is not null process, else go to the homepage

            if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                //instantiate a new instance of the engineer service
                engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());
                try
                {
                    //get the intervention by its id
                    intervention = engineerService.getInterventionById(new Guid(Request.QueryString["Id"]));

                    //Databind the UI with details of the intervention

                    type.Text    = engineerService.getInterventionTypes().Find(i => i.Id == intervention.InterventionTypeId).Name;
                    client.Text  = engineerService.getClientById(intervention.ClientId).Name;
                    creator.Text = engineerService.getUserById(intervention.CreatedBy).Name;
                    if (intervention.ApprovedBy == null)
                    {
                        approver.Text = "";
                    }
                    else
                    {
                        approver.Text = engineerService.getUserById(intervention.ApprovedBy.Value).Name;
                    }

                    state.Text = intervention.InterventionState.ToString();



                    hour.Text = intervention.Hours.ToString();
                    cost.Text = intervention.Costs.ToString();

                    Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");

                    proposedDate.Text = intervention.DateCreate.ToShortDateString();
                    if (intervention.DateFinish == null)
                    {
                        completedDate.Text = "";
                    }
                    else
                    {
                        completedDate.Text = intervention.DateFinish.Value.ToShortDateString();
                    }

                    recentVisitDate.Text = intervention.DateRecentVisit.ToShortDateString();
                    lifeRemaining.Text   = intervention.LifeRemaining.ToString() + "%";
                    Comments.Text        = intervention.Comments;
                }
                catch (Exception)
                {
                    Response.Redirect("~/Errors/InternalErrors.aspx", true);
                }
            }
            else
            {
                Response.Redirect("~/Engineer/Welcome.aspx", true);
            }
        }
Example #3
0
        public OrderController(IOrderService orders, ICustomerService customers, IEngineerService engineers, IJobService jobs, IMapper mappers,
                               IRazorViewToStringRenderer razor, IEmailService email, IOptions <AppSettings> settings)
        {
            _orders    = orders;
            _mapper    = mappers;
            _customers = customers;
            _engineers = engineers;
            _jobs      = jobs;

            _razor          = razor;
            _email          = email;
            _invoiceSubject = settings.Value.EmailSMTPSubject;
            _BccEmail       = settings.Value.EmailFrom;
        }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //instantiate a new instance of engineer service
         //get all clients from engineer service and data bind them to UI
         engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());
         if (!IsPostBack)
         {
             ClientListView.DataSource = engineerService.getClients();
             ClientListView.DataBind();
         }
     }
     catch (Exception)
     {
         Response.Redirect("~/Errors/InternalErrors.aspx", true);
     }
 }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Instantiate a new instance of engineer service
            engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());


            if (!IsPostBack)
            {
                //if the query string is not null process, else go to the homepage
                if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
                {
                    interventionId = new Guid(Request.QueryString["Id"]);
                    try
                    {
                        //get intervention from engineer service by using the query string
                        Intervention intervention = engineerService.getInterventionById(interventionId);

                        //Data bind the UI with intervention quality information

                        txtInterventionType.Text  = engineerService.getInterventionTypes().Find(i => i.Id == intervention.InterventionTypeId).Name;
                        ClientName.Text           = engineerService.getClientById(intervention.ClientId).Name;
                        InterventionComments.Text = intervention.Comments;

                        LifeRemaining.Text = intervention.LifeRemaining.ToString();
                        Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
                        InterventionVisitDate.Text          = intervention.DateRecentVisit.ToShortDateString();
                    }
                    catch (Exception)
                    {
                        Response.Redirect("~/Errors/InternalErrors.aspx", true);
                    }
                }
                else
                {
                    Response.Redirect("~/Engineer/Welcome.aspx", false);
                }
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());

                if (!IsPostBack)
                {
                    //if the query string is not null process, else go to the homepage
                    if (!String.IsNullOrEmpty(Request.QueryString["Id"]))
                    {
                        //instantiate a new instance of engineer service

                        //instantiate a new instance of engineer service
                        intervention = engineerService.getInterventionById(new Guid(Request.QueryString["Id"]));


                        //Data bind UI with intervention details
                        type.Text    = engineerService.getInterventionTypes().Find(i => i.Id == intervention.InterventionTypeId).Name;
                        client.Text  = engineerService.getClientById(intervention.ClientId).Name;
                        creator.Text = engineerService.getUserById(intervention.CreatedBy).Name;

                        State.SelectedIndex = (int)intervention.InterventionState;
                        State.DataSource    = getInterventionState();
                        State.DataBind();
                    }
                    else
                    {
                        Response.Redirect("~/Engineer/Welcome.aspx", false);
                    }
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", false);
            }
        }
Example #7
0
 public ShiftsController(IShiftService shiftService, IEngineerService engineerService)
 {
     _shiftService    = shiftService;
     _engineerService = engineerService;
 }
Example #8
0
 public EngineersController(IEngineerService engineerservice)
 {
     service = engineerservice;
 }
Example #9
0
 public WheelOfFateService(IShiftService shiftService, IEngineerService engineerService, int shiftsPerDay)
 {
     this.shiftService    = shiftService;
     this.engineerService = engineerService;
     this.shiftsPerDay    = shiftsPerDay;
 }
Example #10
0
 public EngineerController(IEngineerService engineers, IMapper mappers)
 {
     _engineers = engineers;
     _mapper    = mappers;
 }
Example #11
0
 public EngineerController(IEngineerService engineerService)
 {
     _engineerService = engineerService;
 }
Example #12
0
 public EngineerController(IEngineerService service)
 {
     _service = service;
 }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //instantiate a new engineer service instance
     engineerService = new EngineerService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());
 }
Example #14
0
 public SiteEngineerController(IEngineerService engineer)
 {
     this.engineer = engineer;
 }