Esempio n. 1
0
        private void LoadData()
        {
            string Mode         = Request.QueryString["Mode"].ToString();
            int    systemUserId = -1;
            string personId     = string.Empty;

            LoadComboBox();

            if (Mode == "New")
            {
                // Additional logic here.

                txtFirstName.Focus(true);
            }
            else if (Mode == "Edit")
            {
                if (Request.QueryString["systemUserId"] != null)
                {
                    systemUserId = int.Parse(Request.QueryString["systemUserId"].ToString());
                }
                if (Request.QueryString["personId"] != null)
                {
                    personId = Request.QueryString["personId"].ToString();
                }

                OperationResult objCommonOperationResultedit = new OperationResult();
                personDto       personDTO = _objPacientBL.GetPerson(ref objCommonOperationResultedit, personId);

                Session["objEntity"] = personDTO;

                // Informacion de la persona
                txtFirstName.Text        = personDTO.v_FirstName;
                txtFirstLastName.Text    = personDTO.v_FirstLastName;
                txtSecondLastName.Text   = personDTO.v_SecondLastName;
                txtDocNumber.Text        = personDTO.v_DocNumber;
                dpBirthdate.SelectedDate = personDTO.d_Birthdate;
                txtBirthPlace.Text       = personDTO.v_BirthPlace;


                ddlDocType.SelectedValue = personDTO.i_DocTypeId.ToString();
                ddlSexType.SelectedValue = personDTO.i_SexTypeId.ToString();
                txtTelephoneNumber.Text  = personDTO.v_TelephoneNumber;

                txtMail.Text = personDTO.v_Mail;

                // Informacion del usuario
                OperationResult objOperationResult = new OperationResult();
                systemuserDto   objSystemUser      = _objSecurityBL.GetSystemUser(ref objOperationResult, systemUserId);

                Session["objSystemUser"] = objSystemUser;

                txtUserName.Text  = objSystemUser.v_UserName;
                txtPassword1.Text = objSystemUser.v_Password;
                txtPassword2.Text = objSystemUser.v_Password;


                //Obtener la empresa por medio del systemuserId
                var EmpresaId_ProtocoloId = _protocolBL.ObtenerEmpresaPorSystemUserId(systemUserId);
                //ddlEmpresaCliente.SelectedValue = EmpresaId_ProtocoloId.EmpresaId;

                var ListaEmpresas = oOrganizationBL.GetEmpresasPorUsuarioExterno(objSystemUser.i_SystemUserId);
                Session["ListaEmpresas"] = ListaEmpresas;
                grdData.DataSource       = ListaEmpresas;
                grdData.DataBind();

                //Obtener Los permisos por el ProtocolId
                var Permisos = _protocolBL.ObtenerPermisosPorProtocoloId(EmpresaId_ProtocoloId.ProtocoloId, systemUserId);
                foreach (var item in Permisos)
                {
                    if (item.i_ApplicationHierarchyId == 1084)
                    {
                        chkAdminServicios.Checked = true;
                    }
                    if (item.i_ApplicationHierarchyId == 2000)
                    {
                        chkAgenda.Checked = true;
                    }
                    if (item.i_ApplicationHierarchyId == 3000)
                    {
                        chkEstadistica.Checked = true;
                    }
                    else if (item.i_ApplicationHierarchyId == 1087)
                    {
                        chkCertificado.Checked = true;
                    }
                    if (item.i_ApplicationHierarchyId == 165)
                    {
                        chkExamenes.Checked = true;
                    }
                    else if (item.i_ApplicationHierarchyId == 1086)
                    {
                        chkFichaOcupacional.Checked = true;
                    }
                    else if (item.i_ApplicationHierarchyId == 1085)
                    {
                        chkSegTrabajador.Checked = true;
                    }
                }
            }
        }