/// <summary> /// 이미지 선택창에서 사용자가 선택 및 옵션 결정을 하고 누르는 확인 버튼의 이벤트 메서드 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnComplete_Click(object sender, EventArgs e) { frmWaiting Wait = new frmWaiting(); Wait.Progress(5); Wait.Show(); TypeChanger tc = new TypeChanger(); BoardType boardType = this.Option.puzzleImage.boardType; int pieceNum = 0; int len = tc.BoardTypeLength + 2; if (boardType == BoardType.TypeAny || boardOption.ignoreBoardType) { for (int i = 3; i < len; i++) { ImgCrop(i, 600 / i); Wait.Progress(i * 10); } boardOption.puzzleImage.boardType = BoardType.Type5x5; } else { pieceNum = (int)boardType + 2; ImgCrop(pieceNum, 600 / pieceNum); Wait.Progress(80); } Wait.Progress(100); btnComplete.DialogResult = DialogResult.OK; this.Close(); Wait.Close(); }
public static void Open(string sMessage) { Thread t = new Thread(delegate() { frmWaiting window = new frmWaiting(sMessage); CloseWindow += () => window.Dispatcher.BeginInvoke(new ThreadStart(() => window.Close())); window.Closed += (sender2, e2) => Window.Dispatcher.InvokeShutdown(); window.Show(); System.Windows.Threading.Dispatcher.Run(); }); t.SetApartmentState(ApartmentState.STA); t.Start(); }
private void Button7_Click(object sender, EventArgs e) { panel3.Height = button7.Height; panel3.Top = button7.Top; this.Text = "الاعدادت"; frmWaiting = new frmWaiting(); groupBox1.Controls.Clear(); frmWaiting.TopLevel = false; groupBox1.Controls.Add(frmWaiting); frmWaiting.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; frmWaiting.Dock = DockStyle.Fill; frmWaiting.Show(); }
private void initImgPanel(int selectedIndex) { string sDir = (selectedIndex == 0)? "Default" : "user"; frmWaiting Wait = new frmWaiting(); //string cDir = Environment.CurrentDirectory; string[] Files = Directory.GetFiles(@"img\" + sDir, "*.jpg", SearchOption.TopDirectoryOnly); int len = Files.Length; Panel[] ImgPanel = new Panel[len]; PictureBox[] ImgPreview = new PictureBox[len]; StreamReader sr = null; string str = ""; string[] tmp = new string[3]; int num = 0; TypeChanger tc = new TypeChanger(); Wait.Show(); //MessageBox.Show(sDir); if (sDir == "Default") { sr = new StreamReader(@"img\Default\Desc.txt", Encoding.UTF8); while (true) { num++; str += sr.ReadLine() + "\t"; if (sr.EndOfStream) { break; } } sr.Close(); Wait.Progress(10); tmp = str.Split('\t'); for (int i = 0; i < num; i++) { puzzleImage[i].boardType = tc.ExtractToBoardType(tmp[0 + 3 * i]); puzzleImage[i].image = Image.FromFile(Files[i]); puzzleImage[i].name = tmp[1 + 3 * i]; puzzleImage[i].desc = tmp[2 + 3 * i]; puzzleImage[i].file = @"img\Default\" + tmp[0 + 3 * i]; } } else { string rootDir = Environment.CurrentDirectory + @"\img\user\"; len = rootDir.Length; num = Files.Length; for (int i = 0; i < num; i++) { string[] tmpName = Files[i].Split('\\'); puzzleImage[i].boardType = BoardType.TypeAny; puzzleImage[i].image = Image.FromFile(Files[i]); puzzleImage[i].name = tmpName[tmpName.Length - 1]; puzzleImage[i].desc = "사용자 정의"; puzzleImage[i].file = @"img\user\" + puzzleImage[i].name; } } Wait.Progress(20); len = Files.Length; for (int i = 0; i < len; i++) { ImgPanel[i] = new Panel(); ImgPreview[i] = new PictureBox(); ImgPreview[i].Image = puzzleImage[i].image; ImgPreview[i].Location = new System.Drawing.Point(3, 3); ImgPreview[i].Name = "ImgPreview" + i; ImgPreview[i].Size = new System.Drawing.Size(64, 64); ImgPreview[i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; ImgPreview[i].TabIndex = 0; ImgPreview[i].TabStop = false; ImgPanel[i].BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; ImgPanel[i].Location = new System.Drawing.Point(3, 3 + 70 * i); ImgPanel[i].Name = "imgPanel" + i; ImgPanel[i].Size = new System.Drawing.Size(230, 70); ImgPanel[i].TabIndex = 2 + i; ImgPanel[i].Paint += new PaintEventHandler(ImgPanel_Paint); ImgPanel[i].MouseMove += new MouseEventHandler(ImgPanel_MouseMove); ImgPanel[i].MouseLeave += new EventHandler(ImgPanel_MouseLeave); ImgPanel[i].Click += new EventHandler(ImgPanel_Click); ImgPanel[i].Controls.Add(ImgPreview[i]); panel_ImgSelector.Controls.Add(ImgPanel[i]); Wait.Progress(20 + i); } Wait.Progress(100); Wait.Close(); }
public void ShowWaitingForm() { frm = new frmWaiting(); frm.Show(); }
private void btnOK_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); string Result = ""; string personId; bool sendNotification = false; int systemUserId = -1; string SihayError = ""; if (uvPacient.Validate(true, false).IsValid) { #region Validation if (txtName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtFirstLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Paterno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSecondLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Materno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtDocNumber.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Número Documento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtMail.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Email .", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtMail.Text.Trim() != "") { if (!Sigesoft.Common.Utils.email_bien_escrito(txtMail.Text.Trim())) { MessageBox.Show("Por favor ingrese un Email con formato correcto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (dtpBirthdate.Checked == false) { MessageBox.Show("Por favor ingrese una fecha de nacimiento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int caracteres = txtDocNumber.TextLength; if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.DNI) { if (caracteres != 8) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.PASAPORTE) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.LICENCIACONDUCIR) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.CARNETEXTRANJ) { if (caracteres < 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (txtPassword2.Text.Trim() != txtPassword1.Text.Trim()) { MessageBox.Show("Los Password no coinciden Por favor verifique.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion if (_tmpListProtocolSystemUser == null) { _tmpListProtocolSystemUser = new List <protocolsystemuserDto>(); } if (_mode == "New") { // Validar la longitud de los numeros de documentos if (!IsValidDocumentNumberLenght()) { return; } // Populate the entity objPerson = new personDto(); objPerson.v_FirstName = txtName.Text.Trim(); objPerson.v_FirstLastName = txtFirstLastName.Text.Trim(); objPerson.v_SecondLastName = txtSecondLastName.Text.Trim(); objPerson.i_DocTypeId = Convert.ToInt32(ddlDocType.SelectedValue); objPerson.i_SexTypeId = Convert.ToInt32(ddlSexType.SelectedValue); objPerson.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); objPerson.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objPerson.v_DocNumber = txtDocNumber.Text.Trim(); objPerson.d_Birthdate = dtpBirthdate.Value; objPerson.v_BirthPlace = txtBirthPlace.Text.Trim(); objPerson.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objPerson.v_AdressLocation = txtAdressLocation.Text.Trim(); objPerson.v_Mail = txtMail.Text.Trim(); // Datos de usuario systemuserDto pobjSystemUser = new systemuserDto(); pobjSystemUser.v_UserName = txtUserName.Text.Trim(); pobjSystemUser.v_Password = SecurityBL.Encrypt(txtPassword2.Text.Trim()); pobjSystemUser.i_SystemUserTypeId = (int)SystemUserTypeId.External; //if (rbFEchaExpiracion.Checked) // pobjSystemUser.d_ExpireDate = dtpExpiredDate.Value.Date; // Graba persona systemUserId = _protocolBL.AddPersonUsuarioExterno(ref objOperationResult, objPerson, null, pobjSystemUser, Globals.ClientSession.GetAsList()); //Obtener Todos los protocolos de la Empresa var idEmpresa = cboEmpresa.SelectedValue.ToString().Split('|'); var ListaProtocolos = _protocolBL.DevolverProtocolosPorEmpresa(idEmpresa[0].ToString()); #region Eval CheckedList for create new -> chklPermisosOpciones / chklNotificaciones foreach (var item in ListaProtocolos) { _tmpListProtocolSystemUser = new List <protocolsystemuserDto>(); for (int i = 0; i < chklPermisosOpciones.CheckedItems.Count; i++) { protocolsystemuserDto protocolSystemUser = new protocolsystemuserDto(); KeyValueDTO obj = (KeyValueDTO)chklPermisosOpciones.CheckedItems[i]; protocolSystemUser.v_ProtocolId = item.v_ProtocolId; protocolSystemUser.i_ApplicationHierarchyId = int.Parse(obj.Id); _tmpListProtocolSystemUser.Add(protocolSystemUser); } // Graba UsuarioExterno SihayError = _protocolBL.AddSystemUserExternal_(ref objOperationResult, _tmpListProtocolSystemUser, Globals.ClientSession.GetAsList(), systemUserId); //for (int i = 0; i < chklNotificaciones.CheckedItems.Count; i++) //{ // protocolsystemuserDto protocolSystemUser = new protocolsystemuserDto(); // KeyValueDTO obj = (KeyValueDTO)chklNotificaciones.CheckedItems[i]; // protocolSystemUser.v_ProtocolId = item.v_ProtocolId; // protocolSystemUser.i_ApplicationHierarchyId = int.Parse(obj.Id); // _tmpListProtocolSystemUser.Add(protocolSystemUser); //} } #endregion if (SihayError == "-1") { if (objOperationResult.ErrorMessage != null) { //MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; MessageBox.Show(objOperationResult.ErrorMessage, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } this.Enabled = false; frmWaiting.Show(this); bgwSendEmail.RunWorkerAsync(); } else if (_mode == "Edit") { bool isChangeUserName = false; bool isChangeDocNumber = false; // Validar la longitud de los numeros de documentos if (!IsValidDocumentNumberLenght()) { return; } #region Validate SystemUSer // Almacenar temporalmente el nombre de usuario actual if (txtUserName.Text != _objSystemUserTemp.v_UserName) { isChangeUserName = true; sendNotification = true; } #endregion #region Validate Document Number // Almacenar temporalmente el número de documento del usuario actual if (txtDocNumber.Text != objPerson.v_DocNumber) { isChangeDocNumber = true; } #endregion // Almacenar temporalmente el password del usuario actual var passTemp = _objSystemUserTemp.v_Password; // Si el password actual es diferente al ingresado en la cajita de texto, quiere decir que se ha cambiado el password por lo tanto // se bede encriptar el nuevo password if (txtPassword2.Text != passTemp) { _objSystemUserTemp.v_Password = SecurityBL.Encrypt(txtPassword2.Text.Trim()); sendNotification = true; } else { _objSystemUserTemp.v_Password = txtPassword2.Text.Trim(); } #region Datos de persona // Datos de persona objPerson.v_PersonId = _personId; objPerson.v_FirstName = txtName.Text.Trim(); objPerson.v_FirstLastName = txtFirstLastName.Text.Trim(); objPerson.v_SecondLastName = txtSecondLastName.Text.Trim(); objPerson.i_DocTypeId = Convert.ToInt32(ddlDocType.SelectedValue); objPerson.i_SexTypeId = Convert.ToInt32(ddlSexType.SelectedValue); objPerson.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); objPerson.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objPerson.v_DocNumber = txtDocNumber.Text.Trim(); objPerson.d_Birthdate = dtpBirthdate.Value; objPerson.v_BirthPlace = txtBirthPlace.Text.Trim(); objPerson.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objPerson.v_AdressLocation = txtAdressLocation.Text.Trim(); objPerson.v_Mail = txtMail.Text.Trim(); #endregion #region Datos de Profesional // Datos de Profesional if (ddlProfession.SelectedNode.Tag.ToString() != "-1" || !string.IsNullOrEmpty(txtProfessionalCode.Text) || !string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto = new professionalDto(); _professionalDto.i_ProfessionId = Convert.ToInt32(ddlProfession.SelectedNode.Tag); if (!string.IsNullOrEmpty(txtProfessionalCode.Text)) { _professionalDto.v_ProfessionalCode = txtProfessionalCode.Text.Trim(); } if (!string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto.v_ProfessionalInformation = txtProfessionalInformation.Text.Trim(); } } #endregion #region Datos de Usuario // Datos de Usuario _objSystemUserTemp.i_SystemUserId = _objSystemUserTemp.i_SystemUserId; _objSystemUserTemp.v_PersonId = _personId; _objSystemUserTemp.v_UserName = txtUserName.Text; _objSystemUserTemp.d_InsertDate = _objSystemUserTemp.d_InsertDate; _objSystemUserTemp.i_InsertUserId = _objSystemUserTemp.i_SystemUserId; _objSystemUserTemp.i_IsDeleted = _objSystemUserTemp.i_IsDeleted; if (rbFEchaExpiracion.Checked) { _objSystemUserTemp.d_ExpireDate = dtpExpiredDate.Value.Date; } else if (rbNuncaCaduca.Checked) { _objSystemUserTemp.d_ExpireDate = null; } #endregion // LoadCheckedListForUpdate(); // Actualiza persona _protocolBL.UpdateSystemUserExternal(ref objOperationResult, isChangeDocNumber, objPerson, _professionalDto, isChangeUserName, _objSystemUserTemp, _listProtocolSystemUserPermisoUpdate, _listProtocolSystemUserPermisoDelete, _listProtocolSystemUserNotifcacionUpdate, _listProtocolSystemUserNotifcacionDelete, Globals.ClientSession.GetAsList()); if (sendNotification) { this.Enabled = false; frmWaiting.Show(this); bgwSendEmail.RunWorkerAsync(); } } if (objOperationResult.ErrorMessage != null) { //MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; MessageBox.Show(objOperationResult.ErrorMessage, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (objOperationResult.Success != 1) { MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); return; } } if (!sendNotification && _mode != "New") { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnOK_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); string Result = ""; string personId; bool sendNotification = false; Sigesoft.Api.Api API = new Sigesoft.Api.Api(); if (uvPacient.Validate(true, false).IsValid) { #region Validation if (txtName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtFirstLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Paterno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSecondLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Materno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtDocNumber.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Número Documento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtMail.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Email .", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtMail.Text.Trim() != "") { if (!Sigesoft.Common.Utils.email_bien_escrito(txtMail.Text.Trim())) { MessageBox.Show("Por favor ingrese un Email con formato correcto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (dtpBirthdate.Checked == false) { MessageBox.Show("Por favor ingrese una fecha de nacimiento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int caracteres = txtDocNumber.TextLength; if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.DNI) { if (caracteres != 8) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.PASAPORTE) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.LICENCIACONDUCIR) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocType.SelectedValue.ToString()) == (int)Common.Document.CARNETEXTRANJ) { if (caracteres < 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (txtPassword2.Text.Trim() != txtPassword1.Text.Trim()) { MessageBox.Show("Los Password no coinciden Por favor verifique.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion if (_tmpListProtocolSystemUser == null) { _tmpListProtocolSystemUser = new List <protocolsystemuserDto>(); } if (_mode == "New") { // Validar la longitud de los numeros de documentos if (!IsValidDocumentNumberLenght()) { return; } // Populate the entity objPerson = new personDto(); objPerson.v_FirstName = txtName.Text.Trim(); objPerson.v_FirstLastName = txtFirstLastName.Text.Trim(); objPerson.v_SecondLastName = txtSecondLastName.Text.Trim(); objPerson.i_DocTypeId = Convert.ToInt32(ddlDocType.SelectedValue); objPerson.i_SexTypeId = Convert.ToInt32(ddlSexType.SelectedValue); objPerson.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); objPerson.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objPerson.v_DocNumber = txtDocNumber.Text.Trim(); objPerson.d_Birthdate = dtpBirthdate.Value; objPerson.v_BirthPlace = txtBirthPlace.Text.Trim(); objPerson.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objPerson.v_AdressLocation = txtAdressLocation.Text.Trim(); objPerson.v_Mail = txtMail.Text.Trim(); // Datos de Profesional if (ddlProfession.SelectedNode.Tag.ToString() != "-1" || !string.IsNullOrEmpty(txtProfessionalCode.Text) || !string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto = new professionalDto(); _professionalDto.i_ProfessionId = Convert.ToInt32(ddlProfession.SelectedNode.Tag); if (!string.IsNullOrEmpty(txtProfessionalCode.Text)) { _professionalDto.v_ProfessionalCode = txtProfessionalCode.Text.Trim(); } if (!string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto.v_ProfessionalInformation = txtProfessionalInformation.Text.Trim(); } } // Datos de usuario systemuserDto pobjSystemUser = new systemuserDto(); pobjSystemUser.v_UserName = txtUserName.Text.Trim(); pobjSystemUser.v_Password = SecurityBL.Encrypt(txtPassword2.Text.Trim()); if (rbFEchaExpiracion.Checked) { pobjSystemUser.d_ExpireDate = dtpExpiredDate.Value.Date; } #region Eval CheckedList for create new -> chklPermisosOpciones / chklNotificaciones for (int i = 0; i < chklPermisosOpciones.CheckedItems.Count; i++) { protocolsystemuserDto protocolSystemUser = new protocolsystemuserDto(); KeyValueDTO obj = (KeyValueDTO)chklPermisosOpciones.CheckedItems[i]; protocolSystemUser.v_ProtocolId = _protocolId; protocolSystemUser.i_ApplicationHierarchyId = int.Parse(obj.Id); _tmpListProtocolSystemUser.Add(protocolSystemUser); } for (int i = 0; i < chklNotificaciones.CheckedItems.Count; i++) { protocolsystemuserDto protocolSystemUser = new protocolsystemuserDto(); KeyValueDTO obj = (KeyValueDTO)chklNotificaciones.CheckedItems[i]; protocolSystemUser.v_ProtocolId = _protocolId; protocolSystemUser.i_ApplicationHierarchyId = int.Parse(obj.Id); _tmpListProtocolSystemUser.Add(protocolSystemUser); } #endregion // Graba persona personId = _protocolBL.AddSystemUserExternal(ref objOperationResult, objPerson, _professionalDto, pobjSystemUser, _tmpListProtocolSystemUser, Globals.ClientSession.GetAsList()); if (_tmpListProtocolSystemUser.Find(p => p.i_ApplicationHierarchyId == 3003).i_ApplicationHierarchyId != null) { // #region API TRACKING // var oUsuarioExternoSeguimientoNew = new UsuarioExternoSeguimiento(); // oUsuarioExternoSeguimientoNew.v_PersonId = _personId; // oUsuarioExternoSeguimientoNew.Nombres = txtName.Text.Trim(); // oUsuarioExternoSeguimientoNew.ApellidoPaterno = txtFirstLastName.Text.Trim(); // oUsuarioExternoSeguimientoNew.ApellidoMaterno = txtSecondLastName.Text.Trim(); // oUsuarioExternoSeguimientoNew.TipoDocumentoId = Convert.ToInt32(ddlDocType.SelectedValue); // oUsuarioExternoSeguimientoNew.GeneroId = Convert.ToInt32(ddlSexType.SelectedValue); // oUsuarioExternoSeguimientoNew.EstadoCivilId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); // oUsuarioExternoSeguimientoNew.GradoInstruccionId = Convert.ToInt32(ddlLevelOfId.SelectedValue); // oUsuarioExternoSeguimientoNew.NroDocumento = txtDocNumber.Text.Trim(); // oUsuarioExternoSeguimientoNew.FechaNacimiento = dtpBirthdate.Value; // oUsuarioExternoSeguimientoNew.LugarNacimiento = txtBirthPlace.Text.Trim(); // oUsuarioExternoSeguimientoNew.Telefono = txtTelephoneNumber.Text.Trim(); // oUsuarioExternoSeguimientoNew.Direccion = txtAdressLocation.Text.Trim(); // oUsuarioExternoSeguimientoNew.Correo = txtMail.Text.Trim(); // var jsonPersonNew = new JavaScriptSerializer().Serialize(oUsuarioExternoSeguimientoNew); // var oUsuarioTrackingNew = new UsuarioTracking(); // oUsuarioTrackingNew.NombreUsuario = txtUserName.Text; // oUsuarioTrackingNew.Contrasenia = txtPassword1.Text; // oUsuarioTrackingNew.RolId = 2; // oUsuarioTrackingNew.EmpresaId = 1; // oUsuarioTrackingNew.FechaCaduca = dtpExpiredDate.Value; // var jsonUsuarioNew = new JavaScriptSerializer().Serialize(oUsuarioTrackingNew); // Dictionary<string, string> arg1New = new Dictionary<string, string>() //{ // { "String1", jsonPersonNew }, // { "String2", jsonUsuarioNew }, // { "Int1", "2" } //}; // var resultNew = API.Post<bool>("Persona/InsertNewPersona", arg1New); // //if (!result) // //{ // // MessageBox.Show("Error al grabar usuario en Seguimiento", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning); // //} // #endregion } if (personId == "-1") { if (objOperationResult.ErrorMessage != null) { //MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; MessageBox.Show(objOperationResult.ErrorMessage, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } this.Enabled = false; frmWaiting.Show(this); bgwSendEmail.RunWorkerAsync(); } else if (_mode == "Edit") { bool isChangeUserName = false; bool isChangeDocNumber = false; // Validar la longitud de los numeros de documentos if (!IsValidDocumentNumberLenght()) { return; } #region Validate SystemUSer // Almacenar temporalmente el nombre de usuario actual if (txtUserName.Text != _objSystemUserTemp.v_UserName) { isChangeUserName = true; sendNotification = true; } #endregion #region Validate Document Number // Almacenar temporalmente el número de documento del usuario actual if (txtDocNumber.Text != objPerson.v_DocNumber) { isChangeDocNumber = true; } #endregion // Almacenar temporalmente el password del usuario actual var passTemp = _objSystemUserTemp.v_Password; // Si el password actual es diferente al ingresado en la cajita de texto, quiere decir que se ha cambiado el password por lo tanto // se bede encriptar el nuevo password if (txtPassword2.Text != passTemp) { _objSystemUserTemp.v_Password = SecurityBL.Encrypt(txtPassword2.Text.Trim()); sendNotification = true; } else { _objSystemUserTemp.v_Password = txtPassword2.Text.Trim(); } #region Datos de persona // Datos de persona objPerson.v_PersonId = _personId; objPerson.v_FirstName = txtName.Text.Trim(); objPerson.v_FirstLastName = txtFirstLastName.Text.Trim(); objPerson.v_SecondLastName = txtSecondLastName.Text.Trim(); objPerson.i_DocTypeId = Convert.ToInt32(ddlDocType.SelectedValue); objPerson.i_SexTypeId = Convert.ToInt32(ddlSexType.SelectedValue); objPerson.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); objPerson.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objPerson.v_DocNumber = txtDocNumber.Text.Trim(); objPerson.d_Birthdate = dtpBirthdate.Value; objPerson.v_BirthPlace = txtBirthPlace.Text.Trim(); objPerson.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objPerson.v_AdressLocation = txtAdressLocation.Text.Trim(); objPerson.v_Mail = txtMail.Text.Trim(); #endregion #region Datos de Profesional // Datos de Profesional if (ddlProfession.SelectedNode.Tag.ToString() != "-1" || !string.IsNullOrEmpty(txtProfessionalCode.Text) || !string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto = new professionalDto(); _professionalDto.i_ProfessionId = Convert.ToInt32(ddlProfession.SelectedNode.Tag); if (!string.IsNullOrEmpty(txtProfessionalCode.Text)) { _professionalDto.v_ProfessionalCode = txtProfessionalCode.Text.Trim(); } if (!string.IsNullOrEmpty(txtProfessionalInformation.Text)) { _professionalDto.v_ProfessionalInformation = txtProfessionalInformation.Text.Trim(); } } #endregion #region Datos de Usuario // Datos de Usuario _objSystemUserTemp.i_SystemUserId = _objSystemUserTemp.i_SystemUserId; _objSystemUserTemp.v_PersonId = _personId; _objSystemUserTemp.v_UserName = txtUserName.Text; _objSystemUserTemp.d_InsertDate = _objSystemUserTemp.d_InsertDate; _objSystemUserTemp.i_InsertUserId = _objSystemUserTemp.i_SystemUserId; _objSystemUserTemp.i_IsDeleted = _objSystemUserTemp.i_IsDeleted; if (rbFEchaExpiracion.Checked) { _objSystemUserTemp.d_ExpireDate = dtpExpiredDate.Value.Date; } else if (rbNuncaCaduca.Checked) { _objSystemUserTemp.d_ExpireDate = null; } #endregion // LoadCheckedListForUpdate(); // Actualiza persona _protocolBL.UpdateSystemUserExternal(ref objOperationResult, isChangeDocNumber, objPerson, _professionalDto, isChangeUserName, _objSystemUserTemp, _listProtocolSystemUserPermisoUpdate, _listProtocolSystemUserPermisoDelete, _listProtocolSystemUserNotifcacionUpdate, _listProtocolSystemUserNotifcacionDelete, Globals.ClientSession.GetAsList()); if (sendNotification) { this.Enabled = false; frmWaiting.Show(this); bgwSendEmail.RunWorkerAsync(); } } var listaPermisosActualizados = new List <protocolsystemuserDto>(); for (int i = 0; i < chklPermisosOpciones.CheckedItems.Count; i++) { protocolsystemuserDto protocolSystemUser = new protocolsystemuserDto(); KeyValueDTO obj = (KeyValueDTO)chklPermisosOpciones.CheckedItems[i]; protocolSystemUser.v_ProtocolId = _protocolId; protocolSystemUser.i_ApplicationHierarchyId = int.Parse(obj.Id); listaPermisosActualizados.Add(protocolSystemUser); } //if (listaPermisosActualizados.Find(p => p.i_ApplicationHierarchyId == 3003).i_ApplicationHierarchyId != null) //{ // #region API TRACKING // var oUsuarioExternoSeguimiento = new UsuarioExternoSeguimiento(); // oUsuarioExternoSeguimiento.v_PersonId = _personId; // oUsuarioExternoSeguimiento.Nombres = txtName.Text.Trim(); // oUsuarioExternoSeguimiento.ApellidoPaterno = txtFirstLastName.Text.Trim(); // oUsuarioExternoSeguimiento.ApellidoMaterno = txtSecondLastName.Text.Trim(); // oUsuarioExternoSeguimiento.TipoDocumentoId = Convert.ToInt32(ddlDocType.SelectedValue); // oUsuarioExternoSeguimiento.GeneroId = Convert.ToInt32(ddlSexType.SelectedValue); // oUsuarioExternoSeguimiento.EstadoCivilId = Convert.ToInt32(ddlMaritalStatus.SelectedValue); // oUsuarioExternoSeguimiento.GradoInstruccionId = Convert.ToInt32(ddlLevelOfId.SelectedValue); // oUsuarioExternoSeguimiento.NroDocumento = txtDocNumber.Text.Trim(); // oUsuarioExternoSeguimiento.FechaNacimiento = dtpBirthdate.Value; // oUsuarioExternoSeguimiento.LugarNacimiento = txtBirthPlace.Text.Trim(); // oUsuarioExternoSeguimiento.Telefono = txtTelephoneNumber.Text.Trim(); // oUsuarioExternoSeguimiento.Direccion = txtAdressLocation.Text.Trim(); // oUsuarioExternoSeguimiento.Correo = txtMail.Text.Trim(); // var jsonPerson = new JavaScriptSerializer().Serialize(oUsuarioExternoSeguimiento); // var oUsuarioTracking = new UsuarioTracking(); // oUsuarioTracking.NombreUsuario = txtUserName.Text; // oUsuarioTracking.Contrasenia = txtPassword1.Text; // oUsuarioTracking.RolId = 2; // oUsuarioTracking.EmpresaId = 1; // oUsuarioTracking.FechaCaduca = dtpExpiredDate.Value; // var jsonUsuario = new JavaScriptSerializer().Serialize(oUsuarioTracking); // Dictionary<string, string> arg1 = new Dictionary<string, string>() // { // { "String1", jsonPerson }, // { "String2", jsonUsuario }, // { "Int1", "2" } // }; // var result = API.Post<bool>("Persona/InsertNewPersona", arg1); // //if (!result) // //{ // // MessageBox.Show("Error al grabar usuario en Seguimiento", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning); // //} // #endregion //} if (objOperationResult.ErrorMessage != null) { //MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; MessageBox.Show(objOperationResult.ErrorMessage, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (objOperationResult.Success != 1) { MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); return; } } if (!sendNotification && _mode != "New") { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }