예제 #1
0
        public void AddApplicationHierarchy(ref OperationResult pobjOperationResult, applicationhierarchyDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                applicationhierarchy  objEntity = applicationhierarchyAssembler.ToEntity(pobjDtoEntity);

                objEntity.d_InsertDate   = DateTime.Now;
                objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]);
                objEntity.i_IsDeleted    = 0;
                //// Autogeneramos el Pk de la tabla
                int SecuentialId = Utils.GetNextSecuentialId(int.Parse(ClientSession[0].ToString()), 1);
                objEntity.i_ApplicationHierarchyId = SecuentialId;
                dbContext.AddToapplicationhierarchy(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "APLICACIÓN JERÁRQUICA", "i_ApplicationHierarchyId=" + objEntity.i_ApplicationHierarchyId.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = ex.Message;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "APLICACIÓN JERÁRQUICA", "i_ApplicationHierarchyId=" + pobjDtoEntity.i_ApplicationHierarchyId.ToString(), Success.Failed, ex.Message);
                return;
            }
        }
예제 #2
0
        public applicationhierarchyDto GetApplicationHierarchy(ref OperationResult pobjOperationResult, int pintApplicationHierarchyId)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel   dbContext    = new SigesoftEntitiesModel();
                applicationhierarchyDto objDtoEntity = null;

                var objEntity = (from a in dbContext.applicationhierarchy
                                 where a.i_ApplicationHierarchyId == pintApplicationHierarchyId
                                 select a).FirstOrDefault();

                if (objEntity != null)
                {
                    objDtoEntity = applicationhierarchyAssembler.ToDTO(objEntity);
                }

                pobjOperationResult.Success = 1;
                return(objDtoEntity);
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = ex.Message;
                return(null);
            }
        }
예제 #3
0
        private void LoadData()
        {
            OperationResult objOperationResult       = new OperationResult();
            OperationResult objOperationResultCommon = new OperationResult();

            //Llenado de combos

            Utils.LoadDropDownList(ddlApplicationHierarchyTypeId, "Value1", "Id", _objProxyCommon.GetSystemParameterForCombo(ref objOperationResultCommon, 106), DropDownListAction.Select);
            Utils.LoadDropDownList(ddlScopeId, "Value1", "Id", _objProxyCommon.GetSystemParameterForCombo(ref objOperationResultCommon, 104), DropDownListAction.Select);
            Utils.LoadDropDownList(ddlTypeFormId, "Value1", "Id", _objProxyCommon.GetSystemParameterForCombo(ref objOperationResultCommon, 151), DropDownListAction.Select);
            Utils.LoadDropDownList(ddlBusinessRule, "Value1", "Id", _objProxyCommon.GetSystemParameterForCombo(ref objOperationResultCommon, 108), DropDownListAction.Select);

            //Llenar combo Parameter Tree
            ddlParentId.DataTextField              = "Description";
            ddlParentId.DataValueField             = "Id";
            ddlParentId.DataSimulateTreeLevelField = "Level";
            ddlParentId.DataEnableSelectField      = "EnabledSelect";
            List <DtvAppHierarchy> t = _objProxySecurity.GetApplicationHierarchyForCombo(ref objOperationResult).ToList();

            ddlParentId.DataSource = t;
            ddlParentId.DataBind();
            this.ddlParentId.Items.Insert(0, new FineUI.ListItem("-- Seleccione --", "-1"));

            string Mode = Request.QueryString["Mode"].ToString();
            int    ApplicationHierarchyId = -1;

            if (Request.QueryString["i_ApplicationHierarchyId"] != null)
            {
                ApplicationHierarchyId = int.Parse(Request.QueryString["i_ApplicationHierarchyId"].ToString());
            }

            if (Mode == "New")
            {
                // Additional logic here.
            }
            else if (Mode == "Edit")
            {
                // Get the Entity Data
                applicationhierarchyDto objEntity = _objProxySecurity.GetApplicationHierarchy(ref objOperationResult, ApplicationHierarchyId);

                // Save the entity on the session
                Session["objEntity"] = objEntity;

                // Show the data on the form
                ddlTypeFormId.SelectedValue = objEntity.i_TypeFormId.ToString();
                ddlApplicationHierarchyTypeId.SelectedValue = objEntity.i_ApplicationHierarchyTypeId.ToString();
                txtDescription.Text       = objEntity.v_Description;
                txtForm.Text              = objEntity.v_Form;
                txtCode.Text              = objEntity.v_Code;
                ddlParentId.SelectedValue = objEntity.i_ParentId.ToString();
                ddlScopeId.SelectedValue  = objEntity.i_ScopeId.ToString();
            }
        }
예제 #4
0
        private void ClonAction()
        {
            applicationhierarchyDto objEntity          = new applicationhierarchyDto();
            OperationResult         objOperationResult = new OperationResult();
            // Obtener los IDs de la fila seleccionada
            int _i_ApplicationHierarchyId = Convert.ToInt32(grdData.DataKeys[grdData.SelectedRowIndex][0]);

            objEntity = _objBL.GetApplicationHierarchy(ref objOperationResult, _i_ApplicationHierarchyId);
            objEntity.v_Description = objEntity.v_Description + "_Copia";
            // Save the data
            _objBL.AddApplicationHierarchy(ref objOperationResult, objEntity, ((ClientSession)Session["objClientSession"]).GetAsList());
        }
예제 #5
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            string          Mode = Request.QueryString["Mode"].ToString();
            OperationResult objOperationResult = new OperationResult();

            if (Mode == "New")
            {
                // Create the entity
                applicationhierarchyDto objEntity = new applicationhierarchyDto();

                // Populate the entity
                objEntity.i_ApplicationHierarchyTypeId = int.Parse(ddlApplicationHierarchyTypeId.SelectedValue);
                objEntity.i_TypeFormId  = int.Parse(ddlTypeFormId.SelectedValue);
                objEntity.v_Description = txtDescription.Text;
                objEntity.v_Form        = txtForm.Text;
                objEntity.v_Code        = txtCode.Text;
                objEntity.i_ParentId    = int.Parse(ddlParentId.SelectedValue);
                objEntity.i_ScopeId     = int.Parse(ddlScopeId.SelectedValue);
                // Save the data
                _objProxySecurity.AddApplicationHierarchy(ref objOperationResult, objEntity, ((ClientSession)Session["objClientSession"]).GetAsList());
            }
            else if (Mode == "Edit")
            {
                // Get the entity from the session
                applicationhierarchyDto objEntity = (applicationhierarchyDto)Session["objEntity"];

                // Populate the entity
                objEntity.i_ApplicationHierarchyTypeId = int.Parse(ddlApplicationHierarchyTypeId.SelectedValue);
                objEntity.i_TypeFormId  = int.Parse(ddlTypeFormId.SelectedValue);
                objEntity.v_Description = txtDescription.Text;
                objEntity.v_Form        = txtForm.Text;
                objEntity.v_Code        = txtCode.Text;
                objEntity.i_ParentId    = int.Parse(ddlParentId.SelectedValue.ToString());
                objEntity.i_ScopeId     = int.Parse(ddlScopeId.SelectedValue); // Save the data
                _objProxySecurity.UpdateApplicationHierarchy(ref objOperationResult, objEntity, ((ClientSession)Session["objClientSession"]).GetAsList());
            }

            //Analizar el resultado de la operación
            if (objOperationResult.Success == 1)  // Operación sin error
            {
                // Cerrar página actual y hacer postback en el padre para actualizar
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else  // Operación con error
            {
                Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                // Se queda en el formulario.
            }
        }
예제 #6
0
        public void UpdateApplicationHierarchy(ref OperationResult pobjOperationResult, applicationhierarchyDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                // Obtener la entidad fuente
                var objEntitySource = (from a in dbContext.applicationhierarchy
                                       where a.i_ApplicationHierarchyId == pobjDtoEntity.i_ApplicationHierarchyId
                                       select a).FirstOrDefault();

                // Crear la entidad con los datos actualizados
                //pobjDtoEntity.i_ApplicationHierarchyId = pintApplicationHierarchyId;
                pobjDtoEntity.d_UpdateDate   = DateTime.Now;
                pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                applicationhierarchy objEntity = applicationhierarchyAssembler.ToEntity(pobjDtoEntity);

                // Copiar los valores desde la entidad actualizada a la Entidad Fuente
                dbContext.applicationhierarchy.ApplyCurrentValues(objEntity);

                // Guardar los cambios
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "APLICACIÓN JERÁRQUICA", "i_ApplicationHierarchyId=" + objEntity.i_ApplicationHierarchyId.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = ex.Message;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "APLICACIÓN JERÁRQUICA", "i_ApplicationHierarchyId=" + pobjDtoEntity.i_ApplicationHierarchyId.ToString(), Success.Failed, ex.Message);
                return;
            }
        }