Beispiel #1
0
 /// <summary>
 /// get the current user
 /// </summary>
 /// <returns>The current engineer</returns>
 protected User GetDetail()
 {
     return(engineerService.getDetail());
 }
Beispiel #2
0
        /// <summary>
        /// If the fields are valid call engineer service to create a new Intervention in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    decimal hour     = decimal.Parse(InterventionHour.Text);
                    decimal cost     = decimal.Parse(InterventionCost.Text);
                    string  comments = InterventionComments.Text;
                    Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
                    DateTime createDate = DateTime.Parse(DateTime.Now.ToShortDateString());
                    DateTime?finishDate;
                    if (String.IsNullOrEmpty(InterventionPerformDate.Text))
                    {
                        finishDate = null;
                    }
                    else
                    {
                        finishDate = DateTime.Parse(InterventionPerformDate.Text);
                    }


                    DateTime          recentVisit = DateTime.Parse(DateTime.Now.ToShortDateString());
                    var               typeID      = SeletedInterventionType.SelectedValue;
                    var               clientID    = SelectClient.SelectedValue;
                    InterventionState state       = InterventionState.Proposed;

                    Intervention intervention = new Intervention(hour, cost, 100, comments, state, createDate, finishDate, recentVisit, new Guid(typeID), new Guid(clientID), engineerService.getDetail().Id, null);
                    engineerService.createIntervention(intervention);

                    Response.Redirect("~/Engineer/InterventionList.aspx", false);
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", true);
            }
        }