//Métodos de Interfaz public void IniciarValores() { Buscador.Rows.Clear(); Id = 0; Nombre = string.Empty; Version = 1.0; Fecha = DateTime.Today.Date; Descripcion = string.Empty; Paquete = string.Empty; Precondicion = string.Empty; Postcondicion = string.Empty; Prioridad = 0; Urgencia = 0; Estabilidad = 0; Estado = true; Categoria = 0; Comentario = string.Empty; Autores.Rows.Clear(); Fuentes.Rows.Clear(); Objetivos.Rows.Clear(); Requisitos.Rows.Clear(); Actores.Rows.Clear(); SecNormal.Clear(); SecExcepc.Clear(); BGrupo.Rows.Clear(); BObjetivos.Rows.Clear(); BFuentes.Rows.Clear(); BRequisitos.Rows.Clear(); BActores.Rows.Clear(); }
public void Cargar(int id) { DataRow Requisito = ClsBaseDatos.BDTable("Select * from ReqFun where Id = " + id + ";").Rows[0]; Id = int.Parse(Requisito[0].ToString()); Nombre = Requisito[1].ToString(); Version = (double)Requisito[2]; Fecha = (DateTime)Requisito[3]; Descripcion = Requisito[4].ToString(); Paquete = ClsBaseDatos.BDString("Select Nombre from Paquetes where Id = " + Requisito[5].ToString() + ";"); Precondicion = Requisito[6].ToString(); Postcondicion = Requisito[7].ToString(); Complejidad = int.Parse(Requisito[8].ToString()); Prioridad = int.Parse(Requisito[9].ToString()); Urgencia = int.Parse(Requisito[10].ToString()); Estabilidad = int.Parse(Requisito[11].ToString()); Estado = ((int)Requisito[12] == 1) ? true : false; Categoria = int.Parse(Requisito[13].ToString()); Comentario = Requisito[14].ToString(); Autores = ClsBaseDatos.BDTable("Select g.Id as Id, g.Nombre as Nombre from Grupo g, ReqAuto r where g.Id = r.IdAutor and r.IdReq = " + Id + " Order By Categoria Desc, Nombre;"); Fuentes = ClsBaseDatos.BDTable("Select g.Id as Id, g.Nombre as Nombre from Grupo g, ReqFuen r where g.Id = r.IdFuen and r.IdReq = " + Id + " Order By Categoria Desc, Nombre;"); Objetivos = ClsBaseDatos.BDTable("Select o.Id as Id, o.Nombre as Nombre from Objetivos o, ReqObj r where o.Id = r.IdObj and r.IdReq = " + Id + " Order By Categoria Desc, Nombre;"); Actores = ClsBaseDatos.BDTable("Select a.Id as Id, a.Nombre as Nombre from Actores a, ReqAct r where a.Id = r.IdAct and r.IdReq = " + Id + " Order By Categoria Desc, Nombre;"); Requisitos = ClsBaseDatos.BDTable("Select rn.Id as Id, r.TipoReq as Tipo, rn.Nombre as Nombre from ReqFun rn, ReqReqR r where rn.Id = r.IdReqr and r.IdReq = " + Id + " and r.TipoReq = " + DefValues.ReqInfo + " Order By Categoria Desc, Nombre;"); DataTable TablaAux; DataRow Fila; SecNormal.Clear(); SecExcepc.Clear(); TablaAux = ClsBaseDatos.BDTable("Select Descrip from ReqSecNor where IdReq = " + Id + ";"); for (int i = 0; i <= (TablaAux.Rows.Count - 1); i++) { Fila = TablaAux.Rows[i]; SecNormal.Add(new ClsDatDG() { Descrip = Fila[0].ToString() }); } TablaAux = ClsBaseDatos.BDTable("Select Descrip from ReqSecExc where IdReq = " + Id + ";"); for (int i = 0; i <= (TablaAux.Rows.Count - 1); i++) { Fila = TablaAux.Rows[i]; SecExcepc.Add(new ClsDatDG() { Descrip = Fila[0].ToString() }); } Requisitos.Rows.Clear(); TablaAux = ClsBaseDatos.BDTable("Select rn.Id as Id, r.TipoReq as Tipo, rn.Nombre as Nombre from ReqInfo rn, ReqReqR r where rn.Id = r.IdReqr and r.IdReq = " + Id + " and r.TipoReq = " + DefValues.ReqInfo + " Order By Categoria Desc, Nombre;"); CargarTablaReq(TablaAux); TablaAux = ClsBaseDatos.BDTable("Select rn.Id as Id, r.TipoReq as Tipo, rn.Nombre as Nombre from ReqNFunc rn, ReqReqR r where rn.Id = r.IdReqr and r.IdReq = " + Id + " and r.TipoReq = " + DefValues.ReqNFun + " Order By Categoria Desc, Nombre;"); CargarTablaReq(TablaAux); TablaAux = ClsBaseDatos.BDTable("Select rn.Id as Id, r.TipoReq as Tipo, rn.Nombre as Nombre from ReqFun rn, ReqReqR r where rn.Id = r.IdReqr and r.IdReq = " + Id + " and r.TipoReq = " + DefValues.ReqFun + " Order By Categoria Desc, Nombre;"); CargarTablaReq(TablaAux); BObjetivos = ClsBaseDatos.BDTable("Select Id,Nombre from Objetivos where Id not IN (select idObj from ReqObj where idReq = " + Id + ") Order By Categoria Desc, Nombre;"); BGrupo = ClsBaseDatos.BDTable("Select Id,Nombre from Grupo where Id not IN (select IdAutor from ReqAuto where idReq = " + Id + ") Order By Categoria Desc, Nombre;"); BFuentes = ClsBaseDatos.BDTable("Select Id,Nombre from Grupo where Id not IN (select IdFuen from ReqFuen where idReq = " + Id + ") Order By Categoria Desc, Nombre;"); BActores = ClsBaseDatos.BDTable("Select Id,Nombre from Actores where Id not IN (select IdAct from ReqAct where idReq = " + Id + ") Order By Categoria Desc, Nombre;"); }