Beispiel #1
0
        /// <summary>
        /// This event fires when the user clicks on the calendar image or the save icon
        ///     It populates the calendar control
        ///     It updates a job card
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void JobCardStatusGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string command = e.CommandName.ToString();

            switch (command)
            {
            case "ChangeDate":

                GridViewRow row      = ((e.CommandSource as ImageButton).NamingContainer) as GridViewRow;
                Calendar    calendar = row.FindControl("Calendar") as Calendar;
                calendar.Visible = true;
                ImageButton image = row.FindControl("CalendarImage") as ImageButton;
                image.Visible = false;
                break;

            case "SaveJobCard":
                GridViewRow gridRow       = ((e.CommandSource as LinkButton).NamingContainer) as GridViewRow; //Gets hold of the GridViewRow
                int         jobCardId     = int.Parse(e.CommandArgument.ToString());
                string      completedDate = (gridRow.FindControl("CompletedDate") as TextBox).Text;

                CrewController crewManager = new CrewController();
                crewManager.UpdateJobCard(jobCardId, completedDate);

                PopulateRouteStatus();
                RefreshCurrentCrews();
                break;
            }
        }