Ejemplo n.º 1
0
    protected void btnKaydet_DirectClick(object sender, DirectEventArgs e)
    {
        ShifTimeService stService = new ShifTimeService();

        if (txtshiftTimeId.Text == "")
        {
            ShiftTime sT = new ShiftTime()
            {
                departureTime = cmbdepartureTime.SelectedItem.Value.ToString(),
                plate         = new Bus()
                {
                    plate = cmbplate.SelectedItem.Text
                },
                driverId = new Driver()
                {
                    driverId = Convert.ToInt32(cmbDriver.SelectedItem.Value.ToString())
                },
                lineId = new Line()
                {
                    lineName = cmblineName.SelectedItem.Text
                },
                stiftStart = Convert.ToDateTime(txtstiftStart.Text),
                shiftEnd   = Convert.ToDateTime(txtshiftEnd.Text)
            };
            stService.Save(sT);
        }

        else
        {
            ShiftTime sT = new ShiftTime()
            {
                departureTime = cmbdepartureTime.SelectedItem.Value.ToString(),
                plate         = new Bus()
                {
                    plate = cmbplate.SelectedItem.Text
                },
                driverId = new Driver()
                {
                    driverId = Convert.ToInt32(cmbDriver.SelectedItem.Value.ToString())
                },
                lineId = new Line()
                {
                    lineName = cmblineName.SelectedItem.Text
                },
                stiftStart = Convert.ToDateTime(txtstiftStart.Text),
                shiftEnd   = Convert.ToDateTime(txtshiftEnd.Text)
            };
            stService.Save(sT);
        }
        txtshiftEnd.Clear();
        txtshiftTimeId.Clear();
        txtstiftStart.Clear();
        cmbdepartureTime.Clear();
        cmbDriver.Clear();
        cmblineName.Clear();
        cmbplate.Clear();
        X.Msg.Alert("UYARI", "Bilgiler kayıt edilmiştir.").Show();
        WindowST.Hide(this.Form);
        btnGet_DirectClick(new object(), new DirectEventArgs(null));
    }
Ejemplo n.º 2
0
 public ShiftTime Save(ShiftTime shifTime)
 {
     return(shifTimeService.Save(shifTime));
 }