Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.services         = new ProgramServices();
        this.btnBack.Click   += BtnBack_Click;
        this.btnEdit.Click   += BtnEdit_Click;
        this.btnDelete.Click += BtnDelete_Click;

        this.txtWorkplanDesc.Attributes.Add("readonly", "readonly");

        this.customer             = this.services.GetCustomerDataFromBookingID(int.Parse(Application["bookingID"].ToString()));
        this.workplan             = this.services.Getworkplans().Find(wp => wp.WorkPlanID == int.Parse(Application["workplanID"].ToString()));
        this.booking              = this.services.GetBookingFromWorkplan(workplan);
        this.txtFirstName.Text    = customer.FirstName;
        this.txtLastName.Text     = customer.LastName;
        this.txtDate.Text         = booking.Date;
        this.txtTime.Text         = workplan.Time;
        this.txtOwnerName.Text    = customer.Vehicles[0].OwnerName;
        this.txtVehicleMake.Text  = customer.Vehicles[0].CarMake;
        this.txtVehicleModel.Text = customer.Vehicles[0].CarModel;
        this.txtVehicleReg.Text   = customer.Vehicles[0].CarRegistration;
        this.txtNoShow.Text       = customer.HasMissedBooking.ToString();

        this.txtStaffID.Text = workplan.AssignedStaffMemberID.ToString();
        Staff staffMember = this.services.GetStaffData().Find(stf => stf.ID == workplan.AssignedStaffMemberID);

        this.txtStaffName.Text = staffMember.FirstName + " " + staffMember.LastName;

        if (!this.IsPostBack)
        {
            this.txtWorkplanDesc.Text = booking.ProblemSummary;
        }
    }
Beispiel #2
0
        public ActionResult UpdateProgram(ProgramVM model)
        {
            try
            {
                ProgramServices.Update(model, BPARepo);

                return(RedirectToAction("Program"));
            }
            catch (Exception ex)
            {
                SetViewError(ex);
                return(View(model));
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //I hate James' code
        this.services                 = new ProgramServices();
        this.bookings                 = services.GetCustomerBookingData().Where(booking => booking.Pending).ToList();
        this.staffMembers             = this.services.GetStaffData();
        this.btnDeclineBooking.Click += BtnDeclineBooking_Click;

        if (!IsPostBack)
        {
            foreach (Booking booking in this.bookings)
            {
                Customer cust = this.services.GetCustomerDataFromBookingID(booking.BookingID);
                this.lstBookings.Items.Add(string.Format("{0}: {1}", cust.FirstName + " " + cust.LastName, booking.Date));
            }
            foreach (Staff staff in this.staffMembers)
            {
                this.lstStaff.Items.Add(string.Format("{0}: {1}", staff.FirstName + " " + staff.LastName, staff.ID));
            }
        }

        this.lstBookings.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(this.lstBookings, "move"));
        this.lstStaff.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(this.lstStaff, "move"));

        if (ViewState["date"] != null)
        {
            this.startOfWeek = DateTime.Parse(ViewState["date"].ToString());
        }
        else
        {
            //assign a value to the stateValue
            int      delta  = DayOfWeek.Monday - DateTime.Now.DayOfWeek;
            DateTime monday = DateTime.Now.AddDays(delta);
            this.startOfWeek = monday;
        }

        this.drawTable();
    }
Beispiel #4
0
        public ActionResult UpdateProgram(int id)
        {
            var model = ProgramServices.GetById(id, BPARepo);

            return(View(model));
        }
Beispiel #5
0
        public ActionResult CreateProgram()
        {
            var model = ProgramServices.GetNew(BPARepo);

            return(View(model));
        }
Beispiel #6
0
        public ActionResult Program()
        {
            var model = ProgramServices.GetAll(BPARepo);

            return(View(model));
        }
Beispiel #7
0
 public BCS(IConfiguration config)
 {
     _programManager = new ProgramServices(config.GetConnectionString("DATABAIST"));
     _studentManager = new StudentServices(config.GetConnectionString("DATABAIST"));
     _dbUserManager  = new DatabaseUserManager(config.GetConnectionString("DATABAIST"));
 }