Ejemplo n.º 1
0
        public ActionResult UpdateGlobalParam(RequestAdminGlobalParam request)
        {
            if (ModelState.IsValid)
            {
                LogicAdminGlobalParam    adm      = new LogicAdminGlobalParam();
                ResponseAdminGlobalParam response = new ResponseAdminGlobalParam();

                request.flag         = 'M';
                request.dateUpdate   = DateTime.Now;
                request.userUpdate   = Session["user"].ToString();
                request.userRegister = "";
                response             = adm.setGlobalParam(request);

                if (response.code == 50000)
                {
                    Session.Add("msgOk", response.message);
                }
                else
                {
                    Session.Add("msgEr", response.message);
                }
            }

            return(RedirectToAction("Parameter"));
        }
Ejemplo n.º 2
0
        public ActionResult addGlobalParam(ResponseAdminGlobalParamList item1, RequestAdminGlobalParam item2, ResponseAdminGlobalParamDetail item3,
                                           ResponseAdminGlobalParam item4)
        {
            // Método para agregar parámetro
            if (ModelState.IsValid)
            {
                LogicAdminGlobalParam adm = new LogicAdminGlobalParam();

                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.setGlobalParam(item2);

                if (item4.code == 50000)
                {
                    Session.Add("msgOk", item4.message);
                }
                else
                {
                    Session.Add("msgEr", item4.message);
                }
            }

            Tuple <ResponseAdminGlobalParamList, RequestAdminGlobalParam, ResponseAdminGlobalParamDetail, ResponseAdminGlobalParam> response =
                new Tuple <ResponseAdminGlobalParamList, RequestAdminGlobalParam, ResponseAdminGlobalParamDetail, ResponseAdminGlobalParam>(item1, item2, item3, item4);

            return(RedirectToAction("Parameter"));
        }
Ejemplo n.º 3
0
        public DataTable adminGlobalParam(RequestAdminGlobalParam request)
        {
            try {
                DataTable      response = new DataTable();
                SqlParameter[] param    = new SqlParameter[9];
                DataBase       db       = new DataBase();

                param[0] = new SqlParameter("@id", request.id);
                param[1] = new SqlParameter("@detail", request.detail);
                param[2] = new SqlParameter("@value", request.value);
                param[3] = new SqlParameter("@stateRecord", request.stateRecord);
                param[4] = new SqlParameter("@userRegister", request.userRegister);
                param[5] = new SqlParameter("@dateRegister", request.dateRegister);
                param[6] = new SqlParameter("@userUpdate", request.userUpdate);
                param[7] = new SqlParameter("@dateUpdate", request.dateUpdate);
                param[8] = new SqlParameter("@flag", request.flag);

                response = db.executeDataTable("spAdminGlobalParam", param);

                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public ActionResult ShowGlobalParam(string id)
        {
            // Cargar los datos del rol a modificar
            RequestAdminGlobalParam      req   = new RequestAdminGlobalParam();
            ResponseAdminGlobalParamList res   = new ResponseAdminGlobalParamList();
            LogicAdminGlobalParam        logic = new LogicAdminGlobalParam();

            req.id = id;
            res    = logic.getParameterList(req);

            req.detail      = res.lst[0].detail;
            req.value       = res.lst[0].value;
            req.stateRecord = res.lst[0].stateRecord;

            return(View(req));
        }
Ejemplo n.º 5
0
        public ActionResult Parameter()
        {
            // Obtener el listado de Roles
            RequestAdminGlobalParam      req   = new RequestAdminGlobalParam();
            ResponseAdminGlobalParamList res   = new ResponseAdminGlobalParamList();
            LogicAdminGlobalParam        logic = new LogicAdminGlobalParam();

            req.id = "";
            res    = logic.getParameterList(req);

            req.stateRecord = true;
            Tuple <ResponseAdminGlobalParamList, RequestAdminGlobalParam, ResponseAdminGlobalParamDetail, ResponseAdminGlobalParam> response =
                new Tuple <ResponseAdminGlobalParamList, RequestAdminGlobalParam, ResponseAdminGlobalParamDetail, ResponseAdminGlobalParam>(res, null, null, null);

            return(View(response));
        }
Ejemplo n.º 6
0
        public DataTable getAdminGlobalParam(RequestAdminGlobalParam request)
        {
            try
            {
                DataTable      response = new DataTable();
                SqlParameter[] param    = new SqlParameter[1];
                DataBase       db       = new DataBase();

                param[0] = new SqlParameter("@id", request.id);
                response = db.executeDataTable("spGetAdminGlobalParam", param);

                return(response);
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        public ResponseAdminGlobalParam adminGlobalParam(RequestAdminGlobalParam request)
        {
            try {
                DataTable                dt             = new DataTable();
                DataAdminGlobalParam     datGlobalParam = new DataAdminGlobalParam();
                ResponseAdminGlobalParam response       = new ResponseAdminGlobalParam();

                dt = datGlobalParam.adminGlobalParam(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       = "adminGlobalParam";
                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;
            }
        }
Ejemplo n.º 8
0
        public ResponseAdminGlobalParam setGlobalParam(RequestAdminGlobalParam req)
        {
            ResponseAdminGlobalParam response = new ResponseAdminGlobalParam();

            try
            {
                LogicCommon com  = new LogicCommon();
                string      json = com.HttpPost("GlobalParam/adminGlobalParam", req);
                response = JsonConvert.DeserializeObject <ResponseAdminGlobalParam>(json);

                return(response);
            }
            catch (Exception ex)
            {
                response.code    = -1;
                response.message = ex.Message;
            }

            return(response);
        }
Ejemplo n.º 9
0
        public ResponseAdminGlobalParam adminGlobalParam(RequestAdminGlobalParam request)
        {
            ResponseAdminGlobalParam response = new ResponseAdminGlobalParam();

            try
            {
                LogicAdminGlobalParam logicGlobalParam = new LogicAdminGlobalParam();
                request.dateRegister = System.DateTime.Now;
                request.dateUpdate   = System.DateTime.Now;

                response = logicGlobalParam.adminGlobalParam(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       = "adminGlobalParam";
                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);
        }
Ejemplo n.º 10
0
        public ResponseAdminGlobalParamList getAdminGlobalParamList(RequestAdminGlobalParam request)
        {
            try {
                DataTable                      dt             = new DataTable();
                DataAdminGlobalParam           datGlobalParam = new DataAdminGlobalParam();
                ResponseAdminGlobalParamDetail adminGlobalParam;
                ResponseAdminGlobalParamList   response = new ResponseAdminGlobalParamList();

                dt = datGlobalParam.getAdminGlobalParam(request);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        response.code    = 1;
                        response.message = "Se encontraron registros";
                        response.status  = 1;
                        response.lst     = new List <ResponseAdminGlobalParamDetail>();

                        foreach (DataRow dr in dt.Rows)
                        {
                            adminGlobalParam = new ResponseAdminGlobalParamDetail();

                            adminGlobalParam.id           = dr["id"].ToString();
                            adminGlobalParam.value        = dr["value"].ToString();
                            adminGlobalParam.detail       = dr["detail"].ToString();
                            adminGlobalParam.stateRecord  = bool.Parse(dr["stateRecord"].ToString());
                            adminGlobalParam.userRegister = dr["userRegister"].ToString();
                            adminGlobalParam.dateRegister = DateTime.Parse(dr["dateRegister"].ToString());
                            adminGlobalParam.userUpdate   = dr["userUpdate"].ToString();
                            adminGlobalParam.dateUpdate   = DateTime.Parse(dr["dateUpdate"].ToString());

                            response.lst.Add(adminGlobalParam);
                        }
                    }
                    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       = "getAdminGlobalParam";
                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;
            }
        }