Example #1
0
 private void RenameTab()
 {
     try
     {
         var interfaceControl = GetInterfaceControl();
         if (interfaceControl == null)
         {
             return;
         }
         using (var frmInputBox = new FrmInputBox(Language.strNewTitle, Language.strNewTitle,
                                                  ((ConnectionTab)interfaceControl.Parent).TabText))
         {
             var dr = frmInputBox.ShowDialog();
             if (dr != DialogResult.OK)
             {
                 return;
             }
             if (!string.IsNullOrEmpty(frmInputBox.returnValue))
             {
                 ((ConnectionTab)interfaceControl.Parent).TabText = frmInputBox.returnValue.Replace("&", "&&");
             }
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionMessage("RenameTab (UI.Window.ConnectionWindow) failed", ex);
     }
 }
Example #2
0
        private void PbAgregarUsuario_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult result = MessageBox.Show("¿Desea añadir un nuevo empleado?", "Empleados", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    if (tvClientes.SelectedNode.Name != string.Empty)
                    {
                        using GendocsModeloDatos.models.GenDocsContext db = new GendocsModeloDatos.models.GenDocsContext();
                        var lst = (from a in db.GdEmpleados
                                   where a.IdEmpleado == Convert.ToInt32(tvClientes.SelectedNode.Name)
                                   select a).ToList();

                        if (lst.Count() > 0)
                        {
                            FrmInputBox frm = new FrmInputBox();
                            frm.ShowDialog();
                            string NombreEmpleado = frm.DatosIntroducidos;
                            frm.Close();
                            if (NombreEmpleado != null)
                            {
                                GdEmpleados Emp = new GdEmpleados
                                {
                                    Empleado           = NombreEmpleado,
                                    IdCliente          = (int)Interaction.IIf(cmbClientes.SelectedIndex == 0, 1, 2), // TODO
                                    IdEmpleadoSuperior = (int)Interaction.IIf(lst[0].IdEmpleado != null, lst[0].IdEmpleado, null)
                                };

                                db.GdEmpleados.Add(Emp);
                                db.SaveChanges();
                            }
                            else
                            {
                                MessageBox.Show("No ha introducido el nombre de un empleado", "Empleados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No ha seleccionado ningún empleado", "Empleados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                tvClientes.Nodes.Clear();
                TvEmpleadosCargarNodo(null, null);
            }
            catch (Exception ex)
            {
                _ = ex.Message;
            }
        }
Example #3
0
        public static void InputBox(string descripcion, string txt_btn1,
                                    string txt_btn2, out DialogResult result, out string mensaje)
        {
            FrmInputBox FrmInputBox = new FrmInputBox();

            FrmInputBox.StartPosition = FormStartPosition.CenterScreen;
            FrmInputBox.Descripcion   = descripcion;
            FrmInputBox.Texto_boton1  = txt_btn1;
            FrmInputBox.Texto_boton2  = txt_btn2;
            FrmInputBox.TopLevel      = true;
            FrmInputBox.TopMost       = true;
            FrmInputBox.ShowDialog();
            result  = FrmInputBox.DialogResult;
            mensaje = FrmInputBox.Mensaje;
        }
Example #4
0
        private static void cMenConnectionPanelRename_Click(object sender, EventArgs e)
        {
            try
            {
                var conW = (ConnectionWindow)((ToolStripMenuItem)sender).Tag;

                using (var newTitle = new FrmInputBox(Language.strNewTitle, Language.strNewTitle + ":", ""))
                    if (newTitle.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(newTitle.returnValue))
                    {
                        conW.SetFormText(newTitle.returnValue.Replace("&", "&&"));
                    }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionStackTrace("cMenConnectionPanelRename_Click: Caught Exception: ",
                                                                ex);
            }
        }
Example #5
0
        private void dgvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvDetail.Rows.Count >= 1)
            {
                if (dgvDetail.Rows[e.RowIndex].Tag != null)
                {
                    Person obj = ((Person)dgvDetail.Rows[e.RowIndex].Tag);

                    string lastContent = obj.AttachInfo;

                    FrmInputBox box = new FrmInputBox(lastContent);
                    if (box.ShowDialog() == DialogResult.OK)
                    {
                        obj.AttachInfo = box.SelectedText;
                        obj.copyTo(ConnectionManager.Context.table("Person")).where ("ID='" + obj.ID + "'").update();

                        RefreshView();
                    }
                }
            }
        }