protected void btnSaveTraining_Click(object sender, EventArgs e)
    {
        int     t = 0;
        TextBox txtTrainingName         = (TextBox)fvTraining.FindControl("txtTrainingName");
        TextBox txtTrainingNotes        = (TextBox)fvTraining.FindControl("txtTrainingNotes");
        TextBox txtTrainingURL          = (TextBox)fvTraining.FindControl("txtTrainingURL");
        TextBox txtTrainingRetakeMonths = (TextBox)fvTraining.FindControl("txtTrainingRetakeMonths");
        TextBox txtPassingScore         = (TextBox)fvTraining.FindControl("txtPassingScore");

        Training training = new Training();

        training.Name          = txtTrainingName.Text;
        training.Notes         = txtTrainingNotes.Text;
        training.URL           = txtTrainingURL.Text;
        training.RenewalMonths = (txtTrainingRetakeMonths.Text != "" ? (int?)Convert.ToInt32(txtTrainingRetakeMonths.Text) : null);
        training.PassingScore  = (txtPassingScore.Text != "" ? (int?)Convert.ToInt32(txtPassingScore.Text) : null);

        if (fvTraining.CurrentMode == FormViewMode.Insert)
        {
            t = Training.InsertTraining(training);
            TrainingOwner.InsertTrainingOwner(t, Person.LogonUserIdentity());
        }
        else if (fvTraining.CurrentMode == FormViewMode.Edit)
        {
            Label lblTrainingIdent = (Label)fvTraining.FindControl("lblTrainingIdent");
            training.Ident = Convert.ToInt32(lblTrainingIdent.Text);
            Training.UpdateTraining(training);
            t = training.Ident;
            TrainingOwner.InsertTrainingOwner(t, Person.LogonUserIdentity());
        }
        EditTraining(t);
    }
Beispiel #2
0
 protected void btnUnAssign_Click(object sender, EventArgs e)
 {
     foreach (Control var in dlOwner.Controls)
     {
         CheckBox ch = (CheckBox)var.FindControl("chkSelect");
         if (ch != null)
         {
             if (ch.Checked)
             {
                 Label lblEDIPI = (Label)var.FindControl("lblEDIPI");
                 TrainingOwner.DeleteTrainingOwnerByTrainingAndEDIPI(training.Ident, lblEDIPI.Text);
             }
         }
     }
     BindOwners();
 }
Beispiel #3
0
 protected void btnAssign_Click(object sender, EventArgs e)
 {
     foreach (Control var in dlNotOwner.Controls)
     {
         CheckBox ch = (CheckBox)var.FindControl("chkSelect");
         if (ch != null)
         {
             if (ch.Checked)
             {
                 Label lblEDIPI = (Label)var.FindControl("lblEDIPI");
                 int   newowner = TrainingOwner.InsertTrainingOwner(training.Ident, lblEDIPI.Text);
             }
         }
     }
     BindOwners();
 }