private void btnSave_Click(object sender, EventArgs e)
        {
            AuthorizedPersonBL  oAuthorizedPersonBL = new AuthorizedPersonBL();
            authorizedpersonDto oauthorizedpersonDto;
            OperationResult     objOperationResult = new OperationResult();


            frmFecha frm = new frmFecha();

            frm.ShowDialog();

            DialogResult Result = MessageBox.Show("¿Está seguro de agendar?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                oAuthorizedPersonBL.DeleteAuthorizedPersonAll(ref objOperationResult);

                foreach (var item in _TempPacientList)
                {
                    oauthorizedpersonDto                        = new authorizedpersonDto();
                    oauthorizedpersonDto.d_BirthDate            = item.d_Birthdate;
                    oauthorizedpersonDto.i_DocTypeId            = item.i_DocTypeId;
                    oauthorizedpersonDto.i_SexTypeId            = item.i_SexTypeId;
                    oauthorizedpersonDto.v_DocNumber            = item.v_DocNumber;
                    oauthorizedpersonDto.v_DocTypeName          = item.v_DocTypeName;
                    oauthorizedpersonDto.v_FirstLastName        = item.v_FirstLastName == null? "": item.v_FirstLastName;
                    oauthorizedpersonDto.v_FirstName            = item.v_FirstName == null ? "" : item.v_FirstName;
                    oauthorizedpersonDto.v_OccupationName       = item.v_CurrentOccupation;
                    oauthorizedpersonDto.v_OrganitationName     = item.v_OrganitationName;
                    oauthorizedpersonDto.v_ProtocolId           = item.v_ProtocolName;
                    oauthorizedpersonDto.v_ProtocolName         = item.v_ProtocolName;
                    oauthorizedpersonDto.v_SecondLastName       = item.v_SecondLastName == null ? "" : item.v_SecondLastName;
                    oauthorizedpersonDto.v_SexTypeName          = item.v_SexTypeName;
                    oauthorizedpersonDto.d_EntryToMedicalCenter = frm.Fecha;
                    oAuthorizedPersonBL.AddAuthorizedPerson(ref objOperationResult, oauthorizedpersonDto, Globals.ClientSession.GetAsList());
                }



                if (objOperationResult.Success == 1) // Operación sin error
                {
                    //this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    btnImprimir.Enabled = true;
                }
                else // Operación con error
                {
                    MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    // Se queda en el formulario.
                    btnImprimir.Enabled = false;
                }

                MessageBox.Show("El Volcado de Lista de Trabajadores al sistema se completo con exito.", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            AuthorizedPersonBL  oAuthorizedPersonBL = new AuthorizedPersonBL();
            authorizedpersonDto oauthorizedpersonDto;
            OperationResult     objOperationResult = new OperationResult();

            foreach (var item in _TempPacientList)
            {
                oauthorizedpersonDto                    = new authorizedpersonDto();
                oauthorizedpersonDto.d_BirthDate        = item.d_Birthdate;
                oauthorizedpersonDto.i_DocTypeId        = item.i_DocTypeId;
                oauthorizedpersonDto.i_SexTypeId        = item.i_SexTypeId;
                oauthorizedpersonDto.v_DocNumber        = item.v_DocNumber;
                oauthorizedpersonDto.v_DocTypeName      = item.v_DocTypeName;
                oauthorizedpersonDto.v_FirstLastName    = item.v_FirstLastName.Trim();
                oauthorizedpersonDto.v_FirstName        = item.v_FirstName.Trim();
                oauthorizedpersonDto.v_OccupationName   = item.v_CurrentOccupation.Trim();
                oauthorizedpersonDto.v_OrganitationName = item.v_OrganitationName.Trim();
                oauthorizedpersonDto.v_ProtocolId       = _ProtocolId;
                oauthorizedpersonDto.v_ProtocolName     = txtProtocolName.Text.Trim();
                oauthorizedpersonDto.v_SecondLastName   = item.v_SecondLastName.Trim();
                oauthorizedpersonDto.v_SexTypeName      = item.v_SexTypeName.Trim();
                //oauthorizedpersonDto.d_EntryToMedicalCenter = DateTime.Now;
                oAuthorizedPersonBL.AddAuthorizedPerson(ref objOperationResult, oauthorizedpersonDto, Globals.ClientSession.GetAsList());
            }


            if (objOperationResult.Success == 1)  // Operación sin error
            {
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else  // Operación con error
            {
                MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                // Se queda en el formulario.
            }

            MessageBox.Show("El Volcado de Lista de Trabajadores al sistema se completo con exito.", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }