Beispiel #1
0
 public void InsertGlobalPlan(GlobalPlan entity)
 {
     using (var context = new QualificationsDBEntities())
     {
         context.GlobalPlan.Attach(entity);
         context.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Added);
         context.SaveChanges();
     }
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int  version       = 0;
            long programaID    = 0;
            long moduloID      = 0;
            long openingID     = 0;
            long teachModuleID = 0;

            //long userID = long.Parse((string)Session["UserID"]);
            entity = new GlobalPlan();

            if (txt_Fundamentacion.Text != "")
            {
                if (txt_Objetivo.Text != "")
                {
                    //Obteniendo el ID del Programa Abierto
                    version = GetVersion((string)Session["Version"]);
                    //Obteniendo el ID del Programa
                    programaID = proxyProgram.GetProgramID((string)Session["Programa"]);
                    //Obteniendo el ID del OpeningProgram
                    openingID = proxyOpening.GetOpeningID(programaID, version);
                    //Obteniendo el ID del Modulo
                    moduloID = proxyModule.GetModuleID((string)Session["Modulo"]);
                    //Obteniendo el ID de la Asignación Docente Módulo
                    teachModuleID = proxyTeacherMdoule.GetTeacherModule(moduloID, openingID);
                    //lbl_Mensaje.Text = "Hasta aqui todo OK" + teachModuleID;
                    Session["TeachingModule"] = teachModuleID + "";
                    try
                    {
                        entity.TeachingModuleCode = teachModuleID;
                        entity.Foundamentation    = txt_Fundamentacion.Text;
                        entity.GeneralObjective   = txt_Objetivo.Text;
                        entity.Status             = 1;
                        entity.Fecha = DateTime.Now;

                        proxy.InsertGlobalPlan(entity);
                        lbl_Mensaje.Text           = "ÉXITO. Los datos han sido registrados.";
                        Button1.Visible            = false;
                        txt_Fundamentacion.Text    = "";
                        txt_Objetivo.Text          = "";
                        LinkButton1.Visible        = true;
                        Label4.Visible             = false;
                        txt_Fundamentacion.Visible = false;
                        txt_Objetivo.Visible       = false;
                        Label5.Visible             = false;
                    }
                    catch (Exception ex)
                    {
                        lbl_Mensaje.Text = "ERROR. Los datos no han sido registrados.";
                    }
                }
                else
                {
                    lbl_Mensaje.Text = "Registre el Objetivo General del Módulo.";
                }
            }
            else
            {
                lbl_Mensaje.Text = "Escriba la Fundamentación.";
            }
        }