PageRenderTime 91ms CodeModel.GetById 16ms app.highlight 67ms RepoModel.GetById 1ms app.codeStats 0ms

/Consilium.DAO/ClaseDAO.cs

https://github.com/ecruzado/spa
C# | 1022 lines | 763 code | 249 blank | 10 comment | 0 complexity | 714bc6ef5975717da6f6fa5df30608b1 MD5 | raw file
   1using Microsoft.VisualBasic;
   2using System;
   3using System.Collections;
   4using System.Collections.Generic;
   5using System.Data;
   6using System.Diagnostics;
   7using System.Linq;
   8using System.Xml.Linq;
   9using System.Data.SqlClient;
  10using Consilium.Entity;
  11
  12using System.Configuration;
  13namespace Consilium.DAO
  14{
  15
  16	public class ClaseDAO
  17	{
  18
  19		private SqlParameter ObjSqlParameter(string pParameterName, object pValue, System.Data.ParameterDirection pDirection, DbType pDbType)
  20		{
  21			SqlParameter lSqlParameter = new SqlParameter();
  22			lSqlParameter.ParameterName = pParameterName;
  23			lSqlParameter.Value = pValue;
  24			lSqlParameter.Direction = pDirection;
  25			lSqlParameter.DbType = pDbType;
  26			return lSqlParameter;
  27		}
  28
  29		public int crear_clase(AreaEntity ClaseEntity)
  30		{
  31
  32			//validar usuario de acceso
  33
  34			string spName = "sp_crear_clase";
  35			int retVal = 0;
  36
  37
  38			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
  39
  40				try {
  41					SqlCommand command = new SqlCommand(spName, conn);
  42					command.CommandType = CommandType.StoredProcedure;
  43
  44					command.Parameters.Add(ObjSqlParameter("@clase_titulo", ClaseEntity.clase_titulo, ParameterDirection.Input, System.Data.DbType.String));
  45					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
  46					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
  47					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
  48					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
  49					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
  50					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
  51					command.Parameters.Add(ObjSqlParameter("@fecha_reg", DateTime.Now.ToString(), ParameterDirection.Input, System.Data.DbType.Date));
  52					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
  53					command.Parameters.Add(ObjSqlParameter("@formato", ClaseEntity.formato, ParameterDirection.Input, System.Data.DbType.String));
  54					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
  55					command.CommandType = CommandType.StoredProcedure;
  56					conn.Open();
  57					command.ExecuteNonQuery();
  58                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
  59
  60					return retVal;
  61
  62				} catch (Exception ex) {
  63					throw ex;
  64				} finally {
  65					conn.Close();
  66				}
  67
  68			}
  69
  70		}
  71
  72		public int crear_capacidad_clase(AreaEntity AreaEntity)
  73		{
  74
  75			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
  76
  77				string spName = "sp_crear_capacidad_clase";
  78				int retVal = 0;
  79
  80				try {
  81					SqlCommand command = new SqlCommand(spName, conn);
  82					command.CommandType = CommandType.StoredProcedure;
  83					command.Parameters.Add(ObjSqlParameter("@operativa_id", AreaEntity.operativa_id, ParameterDirection.Input, System.Data.DbType.Int32));
  84					command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
  85					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
  86					command.CommandType = CommandType.StoredProcedure;
  87					conn.Open();
  88					command.ExecuteNonQuery();
  89                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
  90                    return retVal;
  91
  92				} catch (Exception ex) {
  93					throw ex;
  94				} finally {
  95					conn.Close();
  96				}
  97
  98			}
  99
 100		}
 101
 102		public int crear_contenido_clase(AreaEntity AreaEntity)
 103		{
 104
 105			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 106
 107				string spName = "sp_crear_contenido_clase";
 108				int retVal = 0;
 109
 110				try {
 111					SqlCommand command = new SqlCommand(spName, conn);
 112					command.CommandType = CommandType.StoredProcedure;
 113					command.Parameters.Add(ObjSqlParameter("@organi3_id", AreaEntity.Organizador3_id, ParameterDirection.Input, System.Data.DbType.Int32));
 114					command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 115					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 116					command.CommandType = CommandType.StoredProcedure;
 117					conn.Open();
 118					command.ExecuteNonQuery();
 119                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 120                    return retVal;
 121
 122				} catch (Exception ex) {
 123					throw ex;
 124				} finally {
 125					conn.Close();
 126				}
 127
 128			}
 129
 130		}
 131
 132		public int crear_valores_clase(AreaEntity AreaEntity)
 133		{
 134
 135			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 136
 137				string spName = "sp_crear_valores_clase";
 138				int retVal = 0;
 139
 140				try {
 141					SqlCommand command = new SqlCommand(spName, conn);
 142					command.CommandType = CommandType.StoredProcedure;
 143					command.Parameters.Add(ObjSqlParameter("@actitud_id", AreaEntity.actitud_id, ParameterDirection.Input, System.Data.DbType.Int32));
 144					command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 145					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 146					command.CommandType = CommandType.StoredProcedure;
 147					conn.Open();
 148					command.ExecuteNonQuery();
 149                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 150                    return retVal;
 151
 152				} catch (Exception ex) {
 153					throw ex;
 154				} finally {
 155					conn.Close();
 156				}
 157
 158			}
 159
 160		}
 161
 162		public int crear_metodo_clase(AreaEntity AreaEntity)
 163		{
 164
 165			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 166
 167				string spName = "sp_crear_metodo_clase";
 168				int retVal = 0;
 169
 170				try {
 171					SqlCommand command = new SqlCommand(spName, conn);
 172					command.CommandType = CommandType.StoredProcedure;
 173					command.Parameters.Add(ObjSqlParameter("@metecnica_id", AreaEntity.metecnica_id, ParameterDirection.Input, System.Data.DbType.Int32));
 174					command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 175					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 176					command.CommandType = CommandType.StoredProcedure;
 177					conn.Open();
 178					command.ExecuteNonQuery();
 179                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 180                    return retVal;
 181
 182				} catch (Exception ex) {
 183					throw ex;
 184				} finally {
 185					conn.Close();
 186				}
 187
 188			}
 189
 190		}
 191
 192		public int crear_item_registro_reactivo_clase(AreaEntity AreaEntity)
 193		{
 194
 195			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 196
 197				string spName = "sp_crear_item_registro_reactivo_clase";
 198				int retVal = 0;
 199
 200				try {
 201					SqlCommand command = new SqlCommand(spName, conn);
 202					command.CommandType = CommandType.StoredProcedure;
 203					command.Parameters.Add(ObjSqlParameter("@item_reg_act_id", AreaEntity.item_registro_reactivo_id, ParameterDirection.Input, System.Data.DbType.Int32));
 204					command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 205					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 206					command.CommandType = CommandType.StoredProcedure;
 207					conn.Open();
 208					command.ExecuteNonQuery();
 209                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 210                    return retVal;
 211
 212				} catch (Exception ex) {
 213					throw ex;
 214				} finally {
 215					conn.Close();
 216				}
 217
 218			}
 219
 220		}
 221
 222		public int crear_matriz(AreaEntity ClaseEntity)
 223		{
 224
 225			//validar usuario de acceso
 226
 227			string spName = "sp_matriz_clase";
 228			int retVal = 0;
 229
 230
 231			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 232
 233				try {
 234					SqlCommand command = new SqlCommand(spName, conn);
 235					command.CommandType = CommandType.StoredProcedure;
 236					command.Parameters.Add(ObjSqlParameter("@formativa", ClaseEntity.formativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 237					command.Parameters.Add(ObjSqlParameter("@sumativa", ClaseEntity.sumativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 238					command.Parameters.Add(ObjSqlParameter("@autoevaluativa", ClaseEntity.autoevaluativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 239					command.Parameters.Add(ObjSqlParameter("@coevaluativa", ClaseEntity.coevaluativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 240					command.Parameters.Add(ObjSqlParameter("@heteroevaluacion", ClaseEntity.heteroevaluacion, ParameterDirection.Input, System.Data.DbType.Boolean));
 241					command.Parameters.Add(ObjSqlParameter("@censal", ClaseEntity.censal, ParameterDirection.Input, System.Data.DbType.Boolean));
 242					command.Parameters.Add(ObjSqlParameter("@muestral", ClaseEntity.muestral, ParameterDirection.Input, System.Data.DbType.Boolean));
 243					command.Parameters.Add(ObjSqlParameter("@indicador_logro", ClaseEntity.indicador_logro, ParameterDirection.Input, System.Data.DbType.String));
 244					command.Parameters.Add(ObjSqlParameter("@pruebatxt", ClaseEntity.pruebatxt, ParameterDirection.Input, System.Data.DbType.String));
 245					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 246					command.Parameters.Add(ObjSqlParameter("@obsclase", ClaseEntity.obsclase, ParameterDirection.Input, System.Data.DbType.String));
 247					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 248					command.CommandType = CommandType.StoredProcedure;
 249					conn.Open();
 250					command.ExecuteNonQuery();
 251                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 252                    return retVal;
 253
 254				} catch (Exception ex) {
 255					throw ex;
 256				} finally {
 257					conn.Close();
 258				}
 259
 260			}
 261
 262		}
 263
 264		public int crear_actividades_clase(AreaEntity ClaseEntity)
 265		{
 266
 267			//validar usuario de acceso
 268
 269			string spName = "sp_crear_actividades_clase";
 270			int retVal = 0;
 271
 272
 273			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 274
 275				try {
 276					SqlCommand command = new SqlCommand(spName, conn);
 277					command.CommandType = CommandType.StoredProcedure;
 278					command.Parameters.Add(ObjSqlParameter("@actividades", ClaseEntity.actividad, ParameterDirection.Input, System.Data.DbType.String));
 279					command.Parameters.Add(ObjSqlParameter("@actividades_hora", ClaseEntity.actividad_hora, ParameterDirection.Input, System.Data.DbType.String));
 280					command.Parameters.Add(ObjSqlParameter("@actividades1", ClaseEntity.actividad1, ParameterDirection.Input, System.Data.DbType.String));
 281					command.Parameters.Add(ObjSqlParameter("@actividades_hora1", ClaseEntity.actividad_hora1, ParameterDirection.Input, System.Data.DbType.String));
 282					command.Parameters.Add(ObjSqlParameter("@actividades2", ClaseEntity.actividad2, ParameterDirection.Input, System.Data.DbType.String));
 283					command.Parameters.Add(ObjSqlParameter("@actividades_hora2", ClaseEntity.actividad_hora2, ParameterDirection.Input, System.Data.DbType.String));
 284					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 285					command.Parameters.Add("@new_identity", SqlDbType.Int, 12).Direction = ParameterDirection.Output;
 286					command.CommandType = CommandType.StoredProcedure;
 287					conn.Open();
 288					command.ExecuteNonQuery();
 289                    retVal = Convert.ToInt32(command.Parameters["@new_identity"].Value);
 290                    return retVal;
 291
 292				} catch (Exception ex) {
 293					throw ex;
 294				} finally {
 295					conn.Close();
 296				}
 297
 298			}
 299
 300		}
 301
 302		public int _delete_item_registro_reactivo_clase(ArrayList delreg)
 303		{
 304
 305			string spName = "sp_delete_clase_item_registro_reactivo";
 306			int retVal = 0;
 307
 308
 309			foreach (AreaEntity AreaEntity in delreg) {
 310				using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 311
 312					try {
 313						SqlCommand command = new SqlCommand(spName, conn);
 314						command.CommandType = CommandType.StoredProcedure;
 315						command.Parameters.Add(ObjSqlParameter("@clase_item_reg_act_id", AreaEntity.id_unico, ParameterDirection.Input, System.Data.DbType.Int32));
 316						//command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32))
 317						command.CommandType = CommandType.StoredProcedure;
 318						conn.Open();
 319						retVal = command.ExecuteNonQuery();
 320
 321					} catch (Exception ex) {
 322						throw ex;
 323					} finally {
 324						conn.Close();
 325					}
 326
 327				}
 328			}
 329
 330			return retVal;
 331
 332		}
 333
 334
 335		public DataTable _lst_clase(AreaEntity ClaseEntity)
 336		{
 337
 338			string spName = "sp_clase_lst";
 339			DataTable dt = new DataTable();
 340
 341			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 342
 343
 344				try {
 345					SqlCommand command = new SqlCommand(spName, conn);
 346					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 347					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 348					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 349					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 350					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 351					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 352					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 353
 354					command.CommandType = CommandType.StoredProcedure;
 355					conn.Open();
 356					IDataReader dr = command.ExecuteReader();
 357					dt.Load(dr);
 358					return dt;
 359				} catch (Exception ex) {
 360					throw ex;
 361				} finally {
 362					conn.Close();
 363				}
 364
 365			}
 366
 367		}
 368
 369
 370		public int _delete_clase(ArrayList delreg)
 371		{
 372
 373			string spName = "sp_delete_clase";
 374			int retVal = 0;
 375
 376
 377			foreach (AreaEntity AreaEntity in delreg) {
 378				using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 379
 380					try {
 381						SqlCommand command = new SqlCommand(spName, conn);
 382						command.CommandType = CommandType.StoredProcedure;
 383						command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 384						//command.Parameters.Add(ObjSqlParameter("@clase_id", AreaEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32))
 385						command.CommandType = CommandType.StoredProcedure;
 386						conn.Open();
 387						retVal = command.ExecuteNonQuery();
 388
 389					} catch (Exception ex) {
 390						throw ex;
 391					} finally {
 392						conn.Close();
 393					}
 394
 395				}
 396			}
 397
 398			return retVal;
 399
 400		}
 401
 402		public DataTable _lst_clase_mod(AreaEntity ClaseEntity)
 403		{
 404
 405			string spName = "sp_clase_mod";
 406			DataTable dt = new DataTable();
 407
 408			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 409
 410
 411				try {
 412					SqlCommand command = new SqlCommand(spName, conn);
 413					command.CommandType = CommandType.StoredProcedure;
 414					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 415					conn.Open();
 416					IDataReader dr = command.ExecuteReader();
 417					dt.Load(dr);
 418					return dt;
 419				} catch (Exception ex) {
 420					throw ex;
 421				} finally {
 422					conn.Close();
 423				}
 424
 425			}
 426
 427		}
 428
 429		public int modificar_actividades_clase1(AreaEntity ClaseEntity)
 430		{
 431
 432			//validar usuario de acceso
 433
 434			string spName = "sp_update_actividades_clase1";
 435			int retVal = 0;
 436
 437
 438			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 439
 440				try {
 441					SqlCommand command = new SqlCommand(spName, conn);
 442					command.CommandType = CommandType.StoredProcedure;
 443					command.Parameters.Add(ObjSqlParameter("@actividades1", ClaseEntity.actividad1, ParameterDirection.Input, System.Data.DbType.String));
 444					command.Parameters.Add(ObjSqlParameter("@actividades_hora1", ClaseEntity.actividad_hora1, ParameterDirection.Input, System.Data.DbType.String));
 445					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 446					command.CommandType = CommandType.StoredProcedure;
 447					conn.Open();
 448					retVal = command.ExecuteNonQuery();
 449					return retVal;
 450
 451				} catch (Exception ex) {
 452					throw ex;
 453				} finally {
 454					conn.Close();
 455				}
 456
 457			}
 458
 459		}
 460
 461
 462		public int modificar_actividades_clase(AreaEntity ClaseEntity)
 463		{
 464
 465			//validar usuario de acceso
 466
 467			string spName = "sp_update_actividades_clase";
 468			int retVal = 0;
 469
 470
 471			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 472
 473				try {
 474					SqlCommand command = new SqlCommand(spName, conn);
 475					command.CommandType = CommandType.StoredProcedure;
 476					command.Parameters.Add(ObjSqlParameter("@actividades", ClaseEntity.actividad, ParameterDirection.Input, System.Data.DbType.String));
 477					command.Parameters.Add(ObjSqlParameter("@actividades_hora", ClaseEntity.actividad_hora, ParameterDirection.Input, System.Data.DbType.String));
 478					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 479					command.CommandType = CommandType.StoredProcedure;
 480					conn.Open();
 481					retVal = command.ExecuteNonQuery();
 482					return retVal;
 483
 484				} catch (Exception ex) {
 485					throw ex;
 486				} finally {
 487					conn.Close();
 488				}
 489
 490			}
 491
 492		}
 493
 494		public int modificar_actividades_clase2(AreaEntity ClaseEntity)
 495		{
 496
 497			//validar usuario de acceso
 498
 499			string spName = "sp_update_actividades_clase2";
 500			int retVal = 0;
 501
 502
 503			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 504
 505				try {
 506					SqlCommand command = new SqlCommand(spName, conn);
 507					command.CommandType = CommandType.StoredProcedure;
 508					command.Parameters.Add(ObjSqlParameter("@actividades2", ClaseEntity.actividad2, ParameterDirection.Input, System.Data.DbType.String));
 509					command.Parameters.Add(ObjSqlParameter("@actividades_hora2", ClaseEntity.actividad_hora2, ParameterDirection.Input, System.Data.DbType.String));
 510					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 511					command.CommandType = CommandType.StoredProcedure;
 512					conn.Open();
 513					retVal = command.ExecuteNonQuery();
 514					return retVal;
 515
 516				} catch (Exception ex) {
 517					throw ex;
 518				} finally {
 519					conn.Close();
 520				}
 521
 522			}
 523
 524		}
 525
 526		public int modificar_matriz_clase(AreaEntity ClaseEntity)
 527		{
 528
 529			//validar usuario de acceso
 530
 531			string spName = "sp_update_matriz_clase";
 532			int retVal = 0;
 533
 534
 535			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 536
 537				try {
 538					SqlCommand command = new SqlCommand(spName, conn);
 539					command.CommandType = CommandType.StoredProcedure;
 540					command.Parameters.Add(ObjSqlParameter("@formativa", ClaseEntity.formativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 541					command.Parameters.Add(ObjSqlParameter("@sumativa", ClaseEntity.sumativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 542					command.Parameters.Add(ObjSqlParameter("@autoevaluativa", ClaseEntity.autoevaluativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 543					command.Parameters.Add(ObjSqlParameter("@coevaluativa", ClaseEntity.coevaluativa, ParameterDirection.Input, System.Data.DbType.Boolean));
 544					command.Parameters.Add(ObjSqlParameter("@heteroevaluacion", ClaseEntity.heteroevaluacion, ParameterDirection.Input, System.Data.DbType.Boolean));
 545					command.Parameters.Add(ObjSqlParameter("@censal", ClaseEntity.censal, ParameterDirection.Input, System.Data.DbType.Boolean));
 546					command.Parameters.Add(ObjSqlParameter("@muestral", ClaseEntity.muestral, ParameterDirection.Input, System.Data.DbType.Boolean));
 547					command.Parameters.Add(ObjSqlParameter("@indicador_logro", ClaseEntity.indicador_logro, ParameterDirection.Input, System.Data.DbType.String));
 548					command.Parameters.Add(ObjSqlParameter("@pruebatxt", ClaseEntity.pruebatxt, ParameterDirection.Input, System.Data.DbType.String));
 549					command.Parameters.Add(ObjSqlParameter("@obsclase", ClaseEntity.obsclase, ParameterDirection.Input, System.Data.DbType.String));
 550					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 551					command.CommandType = CommandType.StoredProcedure;
 552					conn.Open();
 553					retVal = command.ExecuteNonQuery();
 554					return retVal;
 555
 556				} catch (Exception ex) {
 557					throw ex;
 558				} finally {
 559					conn.Close();
 560				}
 561
 562			}
 563
 564		}
 565
 566		public int modificar_clase(AreaEntity ClaseEntity)
 567		{
 568
 569			//validar usuario de acceso
 570
 571			string spName = "proc_modificar_clase";
 572			int retVal = 0;
 573
 574
 575			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 576
 577				try {
 578					SqlCommand command = new SqlCommand(spName, conn);
 579					command.CommandType = CommandType.StoredProcedure;
 580
 581					command.Parameters.Add(ObjSqlParameter("@clase_titulo", ClaseEntity.clase_titulo, ParameterDirection.Input, System.Data.DbType.String));
 582					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 583					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 584					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 585					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 586					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 587					command.Parameters.Add(ObjSqlParameter("@clase_id", ClaseEntity.clase_id, ParameterDirection.Input, System.Data.DbType.Int32));
 588					command.CommandType = CommandType.StoredProcedure;
 589					conn.Open();
 590					retVal = command.ExecuteNonQuery();
 591					return retVal;
 592
 593				} catch (Exception ex) {
 594					throw ex;
 595				} finally {
 596					conn.Close();
 597				}
 598
 599			}
 600
 601		}
 602
 603		public DataTable _lst_clase_nivel_grado(AreaEntity ClaseEntity)
 604		{
 605
 606			string spName = "sp_clase_filtro_nivel_grado";
 607			DataTable dt = new DataTable();
 608
 609			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 610
 611
 612				try {
 613					SqlCommand command = new SqlCommand(spName, conn);
 614					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 615					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 616					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 617					command.CommandType = CommandType.StoredProcedure;
 618					conn.Open();
 619					IDataReader dr = command.ExecuteReader();
 620					dt.Load(dr);
 621					return dt;
 622				} catch (Exception ex) {
 623					throw ex;
 624				} finally {
 625					conn.Close();
 626				}
 627
 628			}
 629
 630		}
 631
 632		public DataTable _lst_clase_area(AreaEntity ClaseEntity)
 633		{
 634
 635			string spName = "sp_clase_filtro_area";
 636			DataTable dt = new DataTable();
 637
 638			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 639
 640
 641				try {
 642					SqlCommand command = new SqlCommand(spName, conn);
 643					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 644					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 645					command.CommandType = CommandType.StoredProcedure;
 646					conn.Open();
 647					IDataReader dr = command.ExecuteReader();
 648					dt.Load(dr);
 649					return dt;
 650				} catch (Exception ex) {
 651					throw ex;
 652				} finally {
 653					conn.Close();
 654				}
 655
 656			}
 657
 658		}
 659
 660		public DataTable _lst_clase_fecha(AreaEntity ClaseEntity)
 661		{
 662
 663			string spName = "sp_clase_filtro_fecha";
 664			DataTable dt = new DataTable();
 665
 666			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 667
 668
 669				try {
 670					SqlCommand command = new SqlCommand(spName, conn);
 671					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 672					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 673					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 674					command.CommandType = CommandType.StoredProcedure;
 675					conn.Open();
 676					IDataReader dr = command.ExecuteReader();
 677					dt.Load(dr);
 678					return dt;
 679				} catch (Exception ex) {
 680					throw ex;
 681				} finally {
 682					conn.Close();
 683				}
 684
 685			}
 686
 687		}
 688
 689		public DataTable _lst_clase_usuario(AreaEntity ClaseEntity)
 690		{
 691
 692			string spName = "sp_clase_filtro_usuario";
 693			DataTable dt = new DataTable();
 694
 695			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 696
 697
 698				try {
 699					SqlCommand command = new SqlCommand(spName, conn);
 700					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 701					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 702					command.CommandType = CommandType.StoredProcedure;
 703					conn.Open();
 704					IDataReader dr = command.ExecuteReader();
 705					dt.Load(dr);
 706					return dt;
 707				} catch (Exception ex) {
 708					throw ex;
 709				} finally {
 710					conn.Close();
 711				}
 712
 713			}
 714
 715		}
 716
 717		public DataTable _lst_clase_nivel_area(AreaEntity ClaseEntity)
 718		{
 719
 720			string spName = "sp_clase_filtro_nivel_area";
 721			DataTable dt = new DataTable();
 722
 723			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 724
 725
 726				try {
 727					SqlCommand command = new SqlCommand(spName, conn);
 728					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 729					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 730					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 731					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 732					command.CommandType = CommandType.StoredProcedure;
 733					conn.Open();
 734					IDataReader dr = command.ExecuteReader();
 735					dt.Load(dr);
 736					return dt;
 737				} catch (Exception ex) {
 738					throw ex;
 739				} finally {
 740					conn.Close();
 741				}
 742
 743			}
 744
 745		}
 746
 747		public DataTable _lst_clase_nivel_usuario(AreaEntity ClaseEntity)
 748		{
 749
 750			string spName = "sp_clase_filtro_nivel_usuario";
 751			DataTable dt = new DataTable();
 752
 753			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 754
 755
 756				try {
 757					SqlCommand command = new SqlCommand(spName, conn);
 758					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 759					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 760					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 761					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 762					command.CommandType = CommandType.StoredProcedure;
 763					conn.Open();
 764					IDataReader dr = command.ExecuteReader();
 765					dt.Load(dr);
 766					return dt;
 767				} catch (Exception ex) {
 768					throw ex;
 769				} finally {
 770					conn.Close();
 771				}
 772
 773			}
 774
 775		}
 776
 777		public DataTable _lst_clase_nivel_area_fecha(AreaEntity ClaseEntity)
 778		{
 779
 780			string spName = "sp_clase_filtro_nivel_area_fecha";
 781			DataTable dt = new DataTable();
 782
 783			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 784
 785
 786				try {
 787					SqlCommand command = new SqlCommand(spName, conn);
 788					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 789					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 790					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 791					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 792					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 793					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 794					command.CommandType = CommandType.StoredProcedure;
 795					conn.Open();
 796					IDataReader dr = command.ExecuteReader();
 797					dt.Load(dr);
 798					return dt;
 799				} catch (Exception ex) {
 800					throw ex;
 801				} finally {
 802					conn.Close();
 803				}
 804
 805			}
 806
 807		}
 808
 809		public DataTable _lst_clase_nivel_fecha(AreaEntity ClaseEntity)
 810		{
 811
 812			string spName = "sp_clase_filtro_nivel_fecha";
 813			DataTable dt = new DataTable();
 814
 815			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 816
 817
 818				try {
 819					SqlCommand command = new SqlCommand(spName, conn);
 820					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 821					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 822					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 823					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 824					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 825					command.CommandType = CommandType.StoredProcedure;
 826					conn.Open();
 827					IDataReader dr = command.ExecuteReader();
 828					dt.Load(dr);
 829					return dt;
 830				} catch (Exception ex) {
 831					throw ex;
 832				} finally {
 833					conn.Close();
 834				}
 835
 836			}
 837
 838		}
 839
 840		public DataTable _lst_clase_nivel_fecha_usuario(AreaEntity ClaseEntity)
 841		{
 842
 843			string spName = "sp_clase_filtro_nivel_fecha_usuario";
 844			DataTable dt = new DataTable();
 845
 846			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 847
 848
 849				try {
 850					SqlCommand command = new SqlCommand(spName, conn);
 851					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 852					command.Parameters.Add(ObjSqlParameter("@nivel_id", ClaseEntity.nivel_id, ParameterDirection.Input, System.Data.DbType.Int32));
 853					command.Parameters.Add(ObjSqlParameter("@grado_id", ClaseEntity.grado_id, ParameterDirection.Input, System.Data.DbType.Int32));
 854					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 855					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 856					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 857					command.CommandType = CommandType.StoredProcedure;
 858					conn.Open();
 859					IDataReader dr = command.ExecuteReader();
 860					dt.Load(dr);
 861					return dt;
 862				} catch (Exception ex) {
 863					throw ex;
 864				} finally {
 865					conn.Close();
 866				}
 867
 868			}
 869
 870		}
 871
 872		public DataTable _lst_clase_area_fecha_usuario(AreaEntity ClaseEntity)
 873		{
 874
 875			string spName = "sp_clase_filtro_area_fecha_usuario";
 876			DataTable dt = new DataTable();
 877
 878			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 879
 880
 881				try {
 882					SqlCommand command = new SqlCommand(spName, conn);
 883					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 884					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 885					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 886					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 887					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 888					command.CommandType = CommandType.StoredProcedure;
 889					conn.Open();
 890					IDataReader dr = command.ExecuteReader();
 891					dt.Load(dr);
 892					return dt;
 893				} catch (Exception ex) {
 894					throw ex;
 895				} finally {
 896					conn.Close();
 897				}
 898
 899			}
 900
 901		}
 902
 903		public DataTable _lst_clase_area_fecha(AreaEntity ClaseEntity)
 904		{
 905
 906			string spName = "sp_clase_filtro_area_fecha";
 907			DataTable dt = new DataTable();
 908
 909			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 910
 911
 912				try {
 913					SqlCommand command = new SqlCommand(spName, conn);
 914					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 915					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 916					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 917					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 918					command.CommandType = CommandType.StoredProcedure;
 919					conn.Open();
 920					IDataReader dr = command.ExecuteReader();
 921					dt.Load(dr);
 922					return dt;
 923				} catch (Exception ex) {
 924					throw ex;
 925				} finally {
 926					conn.Close();
 927				}
 928
 929			}
 930
 931		}
 932
 933		public DataTable _lst_clase_area_usuario(AreaEntity ClaseEntity)
 934		{
 935
 936			string spName = "sp_clase_filtro_area_usuario";
 937			DataTable dt = new DataTable();
 938
 939			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 940
 941
 942				try {
 943					SqlCommand command = new SqlCommand(spName, conn);
 944					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 945					command.Parameters.Add(ObjSqlParameter("@area_id", ClaseEntity.area_id, ParameterDirection.Input, System.Data.DbType.Int32));
 946					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 947					command.CommandType = CommandType.StoredProcedure;
 948					conn.Open();
 949					IDataReader dr = command.ExecuteReader();
 950					dt.Load(dr);
 951					return dt;
 952				} catch (Exception ex) {
 953					throw ex;
 954				} finally {
 955					conn.Close();
 956				}
 957
 958			}
 959
 960		}
 961
 962		public DataTable _lst_clase_fecha_usuario(AreaEntity ClaseEntity)
 963		{
 964
 965			string spName = "sp_clase_filtro_fecha_usuario";
 966			DataTable dt = new DataTable();
 967
 968			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
 969
 970
 971				try {
 972					SqlCommand command = new SqlCommand(spName, conn);
 973					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
 974					command.Parameters.Add(ObjSqlParameter("@fecha_inicio", ClaseEntity.fecha_inicio, ParameterDirection.Input, System.Data.DbType.Date));
 975					command.Parameters.Add(ObjSqlParameter("@fecha_fin", ClaseEntity.fecha_fin, ParameterDirection.Input, System.Data.DbType.Date));
 976					command.Parameters.Add(ObjSqlParameter("@usuario", ClaseEntity.usuario, ParameterDirection.Input, System.Data.DbType.String));
 977					command.CommandType = CommandType.StoredProcedure;
 978					conn.Open();
 979					IDataReader dr = command.ExecuteReader();
 980					dt.Load(dr);
 981					return dt;
 982				} catch (Exception ex) {
 983					throw ex;
 984				} finally {
 985					conn.Close();
 986				}
 987
 988			}
 989
 990		}
 991
 992
 993		public DataTable _lst_clase_null(AreaEntity ClaseEntity)
 994		{
 995
 996			string spName = "sp_clase_filtro_null";
 997			DataTable dt = new DataTable();
 998
 999			using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["base"].ToString())) {
1000
1001
1002				try {
1003					SqlCommand command = new SqlCommand(spName, conn);
1004					command.CommandType = CommandType.StoredProcedure;
1005					command.Parameters.Add(ObjSqlParameter("@colegio_id", ClaseEntity.colegio_id, ParameterDirection.Input, System.Data.DbType.Int32));
1006					conn.Open();
1007					command.CommandType = CommandType.StoredProcedure;
1008					IDataReader dr = command.ExecuteReader();
1009					dt.Load(dr);
1010					return dt;
1011				} catch (Exception ex) {
1012					throw ex;
1013				} finally {
1014					conn.Close();
1015				}
1016
1017			}
1018
1019		}
1020
1021	}
1022}