protected void btnCargarSecciones_Click(object sender, EventArgs e) { try { string strArchivo = fulPreguntas.FileName; string strExtension = strArchivo.Substring(strArchivo.LastIndexOf(".") + 1); if (!(strExtension.ToUpper() == "XLS")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "SessionUsuario", "alert('ATENCION: Debe seleccionar un archivo (XLS).');", true); return; } string strRuta = ""; strRuta = System.AppDomain.CurrentDomain.BaseDirectory + "tmp\\carga_secciones_" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + ".xls"; if (System.IO.File.Exists(strRuta)) { System.IO.File.Delete(strRuta); } this.fulPreguntas.SaveAs(strRuta); BFSECCION objBFSE = new BFSECCION(); lstSeccion = objBFSE.GetSeccionesExcel(strRuta); objWEB.LlenaGrilla(ref this.grdSecciones, lstSeccion.Cast <DomainObject>().ToList(), 100); ViewState["ListaSecciones"] = lstSeccion; } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void AgregarSeccion() { try { lstSeccion = (List <ESECCION>)ViewState["ListaSecciones"]; BFSECCION objBFSE = new BFSECCION(); ESECCION objSE = new ESECCION(); objSE.PONDERACION = 100; objSE.ORDEN = 1; lstSeccion.Add(objSE); foreach (ESECCION obj in lstSeccion) { if (obj.PREGUNTAS.Count == 0) { EPREGUNTA objPR = new EPREGUNTA(); objPR.PONDERACION = 100; obj.PREGUNTAS.Add(objPR); } } objWEB.LlenaGrilla(ref this.grdSecciones, lstSeccion.Cast <DomainObject>().ToList(), 100); ViewState["ListaSecciones"] = lstSeccion; } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }