public DataTable adminClsMaster(RequestAdminClsMaster request) { try { DataTable response = new DataTable(); SqlParameter[] param = new SqlParameter[12]; DataBase db = new DataBase(); param[0] = new SqlParameter("@id", request.id); param[1] = new SqlParameter("@catalogId", request.catalogId); param[2] = new SqlParameter("@value", request.value); param[3] = new SqlParameter("@subValue", request.subValue); param[4] = new SqlParameter("@detail", request.detail); param[5] = new SqlParameter("@child", request.child); param[6] = new SqlParameter("@stateRecord", request.stateRecord); param[7] = new SqlParameter("@userRegister", request.userRegister); param[8] = new SqlParameter("@dateRegister", request.dateRegister); param[9] = new SqlParameter("@userUpdate", request.userUpdate); param[10] = new SqlParameter("@dateUpdate", request.dateUpdate); param[11] = new SqlParameter("@flag", request.flag); response = db.executeDataTable("spAdminClsMaster", param); return(response); } catch (Exception ex) { throw ex; } }
public ActionResult UpdateClsMaster(RequestAdminClsMaster request) { if (ModelState.IsValid) { LogicAdminClsMaster adm = new LogicAdminClsMaster(); ResponseAdminClsMaster response = new ResponseAdminClsMaster(); request.flag = 'M'; request.dateUpdate = DateTime.Now; request.userUpdate = Session["user"].ToString(); request.userRegister = ""; response = adm.setClsMaster(request); if (response.code == 50000) { Session.Add("msgOk", response.message); } else { Session.Add("msgEr", response.message); } } return(RedirectToAction("ClsMaster")); }
public ActionResult addClsMaster(ResponseAdminClsMasterList item1, RequestAdminClsMaster item2, ResponseAdminClsMasterDetail item3, ResponseAdminClsMaster item4) { // Método para agregar opciones de catálogo if (ModelState.IsValid) { LogicAdminClsMaster adm = new LogicAdminClsMaster(); item2.stateRecord = true; item2.flag = 'N'; item2.dateRegister = DateTime.Now; item2.userRegister = Session["user"].ToString(); item2.dateUpdate = DateTime.Now; item2.userUpdate = Session["user"].ToString(); item4 = adm.setClsMaster(item2); if (item4.code == 50000) { Session.Add("msgOk", item4.message); } else { Session.Add("msgEr", item4.message); } } Tuple <ResponseAdminClsMasterList, RequestAdminClsMaster, ResponseAdminClsMasterDetail, ResponseAdminClsMaster> response = new Tuple <ResponseAdminClsMasterList, RequestAdminClsMaster, ResponseAdminClsMasterDetail, ResponseAdminClsMaster>(item1, item2, item3, item4); return(RedirectToAction("ClsMaster")); }
public ResponseAdminClsMaster adminClsMaster(RequestAdminClsMaster request) { try { DataTable dt = new DataTable(); DataAdminClsMaster dat = new DataAdminClsMaster(); ResponseAdminClsMaster response = new ResponseAdminClsMaster(); if (request.subValue == null) { request.subValue = ""; } if (request.detail == null) { request.detail = ""; } dt = dat.adminClsMaster(request); if (dt != null) { if (dt.Rows.Count > 0) { response.code = int.Parse(dt.Rows[0]["code"].ToString()); response.message = dt.Rows[0]["message"].ToString(); response.status = int.Parse(dt.Rows[0]["state"].ToString()); } } return(response); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado throw exSql; } catch (Exception ex) { // Registrar el error real DataLogError datError = new DataLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "adminClsMaster"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); datError.newError(error); // Modificar la excepción Exception exResult = new Exception("Error no controlado, favor consultar con el administrador del sistema."); throw exResult; } }
public ActionResult ClsMaster() { // Obtener el listado de catálogos RequestAdminClsMaster req = new RequestAdminClsMaster(); ResponseAdminClsMasterList res = new ResponseAdminClsMasterList(); LogicAdminClsMaster logic = new LogicAdminClsMaster(); req.id = 0; req.catalogId = ""; req.child = true; res = logic.getClsMasterList(req); req.stateRecord = true; Tuple <ResponseAdminClsMasterList, RequestAdminClsMaster, ResponseAdminClsMasterDetail, ResponseAdminClsMaster> response = new Tuple <ResponseAdminClsMasterList, RequestAdminClsMaster, ResponseAdminClsMasterDetail, ResponseAdminClsMaster>(res, req, null, null); return(View(response)); }
public ActionResult ShowClsMaster(string id) { // Cargar los datos de la opción a modificar RequestAdminClsMaster req = new RequestAdminClsMaster(); ResponseAdminClsMasterList res = new ResponseAdminClsMasterList(); LogicAdminClsMaster logic = new LogicAdminClsMaster(); req.id = int.Parse(id); res = logic.getClsMasterList(req); req.catalogId = res.lst[0].catalogId; req.child = res.lst[0].child; req.subValue = res.lst[0].subValue; req.detail = res.lst[0].detail; req.value = res.lst[0].value; req.stateRecord = res.lst[0].stateRecord; return(View(req)); }
public ResponseAdminClsMaster setClsMaster(RequestAdminClsMaster req) { ResponseAdminClsMaster response = new ResponseAdminClsMaster(); try { LogicCommon com = new LogicCommon(); string json = com.HttpPost("ClsMaster/adminClsMaster", req); response = JsonConvert.DeserializeObject <ResponseAdminClsMaster>(json); return(response); } catch (Exception ex) { response.code = -1; response.message = ex.Message; } return(response); }
public DataTable getAdminClsMaster(RequestAdminClsMaster request) { try { DataTable response = new DataTable(); SqlParameter[] param = new SqlParameter[3]; DataBase db = new DataBase(); param[0] = new SqlParameter("@id", request.id); param[1] = new SqlParameter("@catalogId", request.catalogId); param[2] = new SqlParameter("@filterChild", request.child); response = db.executeDataTable("spGetAdminClsMaster", param); return(response); } catch (Exception ex) { throw ex; } }
public ResponseAdminClsMaster adminClsMaster(RequestAdminClsMaster request) { ResponseAdminClsMaster response = new ResponseAdminClsMaster(); try { LogicAdminClsMaster logic = new LogicAdminClsMaster(); request.dateRegister = System.DateTime.Now; request.dateUpdate = System.DateTime.Now; response = logic.adminClsMaster(request); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado response.code = exSql.ErrorCode; response.message = exSql.Message; response.status = exSql.State; } catch (Exception ex) { // Registrar el error real LogicLogError logicError = new LogicLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "adminClsMaster"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); logicError.newError(error); response.code = -1; response.message = "Error no controlado, favor consultar con el administrador del sistema."; } return(response); }
public ResponseAdminUserList getUserList(RequestAdminUser req) { ResponseAdminUserList response = new ResponseAdminUserList(); try { LogicCommon com = new LogicCommon(); string json = com.HttpPost("User/getAdminUser", req); response = JsonConvert.DeserializeObject <ResponseAdminUserList>(json); // Cargar el listado completo de Roles RequestAdminRole reqRole = new RequestAdminRole(); ResponseAdminRoleList resRole = new ResponseAdminRoleList(); LogicAdminRole logicRole = new LogicAdminRole(); List <SelectListItem> lstTmpRole = new List <SelectListItem>(); // Obtener el listado completo de Roles reqRole.id = 0; resRole = logicRole.getRoleList(reqRole); // Llenar el listado de Roles foreach (ResponseAdminRoleDetail r in resRole.lst) { lstTmpRole.Add(new SelectListItem { Text = r.detail, Value = r.id.ToString(), Selected = r.id == req.idRole ? true : false }); } // Agregar el listado de Roles response.lstRole = lstTmpRole; // Cargar el catálogo de tipos de documentos RequestAdminClsMaster reqCls = new RequestAdminClsMaster(); ResponseAdminClsMasterList resCls = new ResponseAdminClsMasterList(); LogicAdminClsMaster logicCls = new LogicAdminClsMaster(); List <SelectListItem> lstTmpCls = new List <SelectListItem>(); // Obtener el catálogo de tipos de documentos reqCls.catalogId = "TIPOSDOCUMENTO"; reqCls.child = true; resCls = logicCls.getClsMasterList(reqCls); // Llenar el listado de acuerdo al catálogo foreach (ResponseAdminClsMasterDetail r in resCls.lst) { lstTmpCls.Add(new SelectListItem { Text = r.detail, Value = r.id.ToString(), Selected = r.id == req.typeDocument ? true : false }); } // Agregar el listado del catálogo documentos response.lstTypeDocument = lstTmpCls; return(response); } catch (Exception ex) { response.code = -1; response.message = ex.Message; } return(response); }
public ResponseAdminClsMasterList getAdminClsMasterList(RequestAdminClsMaster request) { try { ResponseAdminClsMasterList response = new ResponseAdminClsMasterList(); DataTable dt = new DataTable(); DataAdminClsMaster data = new DataAdminClsMaster(); ResponseAdminClsMasterDetail detail; request.catalogId = request.catalogId == null ? "" : request.catalogId; dt = data.getAdminClsMaster(request); if (dt != null) { if (dt.Rows.Count > 0) { response.code = 1; response.message = "Se encontraron registros"; response.status = 1; response.lst = new List <ResponseAdminClsMasterDetail>(); foreach (DataRow dr in dt.Rows) { detail = new ResponseAdminClsMasterDetail(); detail.id = int.Parse(dr["id"].ToString()); detail.catalogId = dr["catalogId"].ToString(); detail.value = dr["value"].ToString(); detail.subValue = dr["subValue"].ToString(); detail.detail = dr["detail"].ToString(); detail.child = bool.Parse(dr["child"].ToString()); detail.stateRecord = bool.Parse(dr["stateRecord"].ToString()); detail.userRegister = dr["userRegister"].ToString(); detail.dateRegister = DateTime.Parse(dr["dateRegister"].ToString()); detail.userUpdate = dr["userUpdate"].ToString(); detail.dateUpdate = DateTime.Parse(dr["dateUpdate"].ToString()); response.lst.Add(detail); } } else { response.code = 0; response.message = "No se encontraron registros"; response.status = 0; } } else { response.code = 0; response.message = "No se encontraron registros"; response.status = 0; } return(response); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado throw exSql; } catch (Exception ex) { // Registrar el error real DataLogError datError = new DataLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "getAdminClsMasterList"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); datError.newError(error); // Modificar la excepción Exception exResult = new Exception("Error no controlado, favor consultar con el administrador del sistema."); throw exResult; } }