Beispiel #1
0
        public MainForm(AppManager manager)
        {
            _flgLoading = true;
            InitializeComponent();

            _manager = manager;
            if (_manager == null)
            {
                CustomMessageBox cmb = new CustomMessageBox("The application manager has not been loaded for some reason.\nThe application can't work and will be closed.", "FATAL", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Fatal, false, false);
                cmb.ShowDialog();
                cmb.Dispose();
                this.Close();
            }

            InitializeStyle();
            InitializeGUIEventsHandlers();

            categoriesTabs.Manager = _manager;

            SetupUI();
            _SelectedCategory = -1;
            _SelectedGame = -1;
            EnableMenus(false);
            if (_manager.AppSettings.ReloadLatestDB && (_manager.RecentDBs != null && _manager.RecentDBs.Count > 0))
                OpenRecentDatabase(_manager.RecentDBs.First().Value.DBPath, false);

            _flgLoading = false;
        }
        public static DialogResult Show(string message, string type)
        {
            msgForm = new CustomMessageBox();
            msgForm.txtMessage.Text = message;
            msgForm.ActiveControl = msgForm.btnOk;

            if (type.Equals(Constant.MSG_ERROR))
            {
                msgForm.txtMessage.ForeColor = Color.Red;
                msgForm.btnCancel.Visible = false;
            }
            else if (type.Equals(Constant.MSG_WARNING))
            {
                msgForm.txtMessage.ForeColor = Color.Black;
                msgForm.btnCancel.Visible = true;
            }
            else
            {
                msgForm.txtMessage.ForeColor = Color.Black;
                msgForm.btnOk.Visible = false;
                msgForm.btnCancel.Visible = false;
                msgForm.lblCounter.Visible = true;
                msgForm.countDownTimer.Start();
            }
            msgForm.ShowDialog();
            return result;
        }
Beispiel #3
0
        private void btCalcular_Click(object sender, RoutedEventArgs e)
        {
            DataTable dtitem = new DataTable();
            try 
            { 
                dtitem = opr.selectItemCombyCom(info);
                if (dtitem.Rows.Count > 0)
                {
                    double totalcom = 0;
                    for (int i = 0; i <= dtitem.Rows.Count-1; i++)
                    {
                        if (dtitem.Rows[i][4].ToString() == "Em aberto")
                        {
                            cmb = new CustomMessageBox("Existem itens em aberto na comanda. Acuse a prontidão e tente novamente.");
                            cmb.ShowDialog();
                            return;
                        }
                        double vlr = 0;
                        vlr = double.Parse(dtitem.Rows[i][2].ToString()) * double.Parse(dtitem.Rows[i][3].ToString());
                        totalcom = totalcom + vlr;
                    }
                    info.vlrPag_com = totalcom.ToString();
                }
            }
            catch
            {
                cmb = new CustomMessageBox("Erro ao calcular total.");
                cmb.ShowDialog();
                return;
            }
            try
            {
                dtitem.Clear();
                dtitem = opr.PorcFunc(info);
                if (dtitem.Rows.Count > 0)
                {
                    info.comissao_com = (double.Parse(dtitem.Rows[0][0].ToString()) / 100 * double.Parse(info.vlrPag_com)).ToString();
                }
                else
                {
                    info.comissao_com = "0";
                }
            }
            catch
            {
                cmb = new CustomMessageBox("Erro ao aplicar porcentagem de serviço.");
                cmb.ShowDialog();
                return;
            }

            info.dataPag_com = DateTime.Now;
            info.est_com = "Fechada";
            btConfirma.IsEnabled = true;
            txtComissão.Text = info.comissao_com.Replace(",", ".");
            txtTotal.Text = info.vlrPag_com.Replace(",", ".");
            btConfirma.IsEnabled = true;
            cmb = new CustomMessageBox("Cálculo feito. Pressione Confirmar.");
            cmb.ShowDialog();
        }
Beispiel #4
0
        private void btConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (txtQnt.Text == "")
            {
                cmb = new CustomMessageBox("Campos obrigatórios: Quantidade");
                cmb.ShowDialog();
                return;
            }
            else
            {
                try
                {
                    info.cod_prod_item = Int32.Parse(((DataRowView)dtGridProd.SelectedItem).Row[0].ToString());
                    info.vlr_ven_item = ((DataRowView)dtGridProd.SelectedItem).Row[3].ToString().Replace(",", ".");
                    info.qtd_item = Int32.Parse(txtQnt.Text);
                    info.est_item = "Em aberto";

                    DataTable dtitem = opr.selectItemCombyProd(info);
                    if (dtitem.Rows.Count > 0)
                    {
                        info.qtd_item = int.Parse(dtitem.Rows[0][2].ToString()) + info.qtd_item;
                        int row = opr.updateItemCom(info);
                        if (row != 0)
                        {
                            cmb = new CustomMessageBox("Item cadastrado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na inserção!");
                            cmb.ShowDialog();
                        }
                    }
                    else
                    {


                        int rows = opr.insertItemCom(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Item cadastrado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na inserção!");
                            cmb.ShowDialog();
                        }
                    }
                }
                catch
                {
                    cmb = new CustomMessageBox("Erro interno do SQL.");
                    cmb.ShowDialog();
                }
            }
        }
 public static void ShowError(string message, string caption)
 {
     var box = new CustomMessageBox();
     box.Button_OK.Visibility = Visibility.Visible;
     box.TextBlock_Message.Text = message;
     box.Title = caption;
     box.ShowDialog();
 }
Beispiel #6
0
        private void btRemProd_Click(object sender, RoutedEventArgs e)
        {
            if (dtGriditCom.SelectedItem != null)
            {
                CustomMessageBox cmb = new CustomMessageBox("Tem certeza que deseja excluir ? ", "Atenção", "YesNo");
                cmb.ShowDialog();
                if (cmb.DialogResult.HasValue && cmb.DialogResult.Value)
                {
                    try
                    {
                        int ID = Int32.Parse(((DataRowView)dtGriditCom.SelectedItem).Row[0].ToString());
                        int ID2 = Int32.Parse(((DataRowView)dtGriditCom.SelectedItem).Row[5].ToString());

                        info.cod_com_item = ID;
                        info.cod_prod_item = ID2;
                        if (ID.ToString() == "" && ID2.ToString()=="")
                        {
                            cmb = new CustomMessageBox("Selecione um item para excluir.");
                            cmb.ShowDialog();
                        }
                        else
                        {

                            int rows = opr.deleteItemCom(info);
                            if (rows != 0)
                            {
                                cmb = new CustomMessageBox("Item excluído com sucesso!");
                                cmb.ShowDialog();
                                dtGriditCom.DataContext = opr.selectItemCombyCom(info);
                            }
                            else
                            {
                                cmb = new CustomMessageBox("Erro na operação");
                                cmb.ShowDialog();
                            }
                        }
                    }
                    catch
                    {
                        cmb = new CustomMessageBox("Erro interno no SQL.");
                        cmb.ShowDialog();
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                cmb = new CustomMessageBox("Não há itens para excluir.");
                cmb.ShowDialog();
                return;
            }
}
Beispiel #7
0
 private void btProcurar_Click(object sender, RoutedEventArgs e)
 {
     if (txtPesquisa.Text == "")
     {
         return;
     }
     
     switch (cbCamp.SelectedIndex)   
     {
         case 0:
             double num;
             if (double.TryParse(txtPesquisa.Text, out num))
             {
                 info.cod_com= Int32.Parse(txtPesquisa.Text);
                 dGrid.DataContext = opr.selectCombyId(info);
                 break;
             }
             else
             {
                 cmb = new CustomMessageBox("Insira apenas números!");
                 cmb.ShowDialog();
                 break;
             }
             
        case 1:
             DateTime dt;
             if (DateTime.TryParse(txtPesquisa.Text, out dt))
             {
                 dGrid.DataContext = opr.selectCombyDia(DateTime.Parse(txtPesquisa.Text));
                 break;
             }
             else
             {
                 cmb = new CustomMessageBox("Insira data no formato: dd/mm/yyyy");
                 cmb.ShowDialog();
                 break;
             }
         case 3:
             double valor;
             if (double.TryParse(txtPesquisa.Text, out valor))
             {
                 info.vlrPag_com = txtPesquisa.Text.Replace(",", ".") ;
                 dGrid.DataContext = opr.selectCombyValor(info);
                 break;
             }
             else
             {
                 cmb = new CustomMessageBox("Insira apenas números!");
                 cmb.ShowDialog();
                 break;
             }
         default:
             break;
     }
 }
 public static MessageBoxResult ShowSavePrompt()
 {
     var box = new CustomMessageBox();
     box.Button_Yes.Visibility = Visibility.Visible;
     box.Button_No.Visibility = Visibility.Visible;
     box.Button_Cancel.Visibility = Visibility.Visible;
     box.TextBlock_Message.Text = "Do you wish to save your changes?";
     box.Title = "Save Changes?";
     box.ShowDialog();
     return box.result;
 }
Beispiel #9
0
 private void btLogout_Click(object sender, RoutedEventArgs e)
 {
     cmb = new CustomMessageBox("Você tem certeza?", "Atenção", "YesNo");
     cmb.ShowDialog();
     if (cmb.DialogResult.HasValue && cmb.DialogResult.Value)
     {
         MainWindow log = new MainWindow();
         log.Show();
         this.Hide();
     }
    
 }
Beispiel #10
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         dGrid.DataContext = opr.selectCli();
     }
     catch
     {
         cmb = new CustomMessageBox("Falha na preenchimento da grid.");
         cmb.ShowDialog();
     }
 }
Beispiel #11
0
        private void btProcurar_Click(object sender, RoutedEventArgs e)
        {
            if (txtPesquisa.Text == "")
            {
                return;
            }
            try {
                switch (cbCamp.SelectedIndex)
                {
                    case 0:
                        double num;
                        if (double.TryParse(txtPesquisa.Text, out num))
                        {
                            info.cod_cli = Int32.Parse(txtPesquisa.Text);
                            dGrid.DataContext = opr.selectCliByID(info);
                            break;
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Insira apenas números!");
                            cmb.ShowDialog();
                            break;
                        }

                    case 1:
                        info.nome_cli = txtPesquisa.Text;
                        dGrid.DataContext = opr.selectCliByNome(info);
                        break;
                    case 2:
                        DateTime dt;
                        if (DateTime.TryParse(txtPesquisa.Text, out dt))
                        {
                            info.datacad_cli = DateTime.Parse(txtPesquisa.Text);
                            dGrid.DataContext = opr.selectCliByDataCad(info);
                            break;
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Insira data no formato: dd/mm/yyyy");
                            cmb.ShowDialog();
                            break;
                        }
                    default:
                        break;
                }
            }
            catch
            {
                CustomMessageBox cmd = new CustomMessageBox("Erro interno do SQL.");
                cmd.ShowDialog();
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.RoomName = this.TextBox.Text;
            if(0 >= this.RoomName.Length || this.RoomName.Length > 18)
            {
                var messageBox = new CustomMessageBox("Invalid name length(max 18)");
                messageBox.ShowDialog();

            }
            else
            {
                this.Close();
            }
        }
Beispiel #13
0
        private void btConfirmar_Click(object sender, RoutedEventArgs e)
        {
            try 
	        {	        
                info.cod_log = userid;

                DataTable data = opr.selectLoginByID(info);
                if (data.Rows.Count != 0)
                {
                    info.user_log = data.Rows[0]["Usuário"].ToString();
                    info.pass_log = data.Rows[0]["Senha"].ToString();

                    if (info.pass_log == txtoldpass.Password)
                    {
                        info.pass_log = txtnewpass.Password;
                        int rows = opr.updatePassLog(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Senha alterada com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na conexão com banco de dados!");
                            cmb.ShowDialog();
                        }
                    }
                    else
                    {
                        cmb = new CustomMessageBox("Senha inválida!");
                        cmb.ShowDialog();
                        return;
                    }
                }
                else
                {
                    cmb = new CustomMessageBox("Erro na conexão com banco de dados!");
                    cmb.ShowDialog();
                    return;
                }
	        }
	        catch (Exception)
	        {
                CustomMessageBox cmd = new CustomMessageBox("Erro interno do SQL.");
                cmd.ShowDialog();
            }
            
        }
Beispiel #14
0
        private void btConfirmar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtGriItem.SelectedItem == null)
                {
                    return;
                }
                cmb = new CustomMessageBox("Tem certeza que deseja acusar prontidão?", "Atenção", "YesNo");
                cmb.ShowDialog();
                if (cmb.DialogResult.HasValue && cmb.DialogResult.Value)
                {
                    int ID = Int32.Parse(((DataRowView)dtGriItem.SelectedItem).Row[0].ToString());
                    int ID2 = Int32.Parse(((DataRowView)dtGriItem.SelectedItem).Row[5].ToString());
                    info.cod_com_item = ID;
                    info.cod_prod_item = ID2;

                    int rows = opr.AcusarProntidao(info);
                    if (rows != 0)
                    {
                        cmb = new CustomMessageBox("Item apontado.");
                        cmb.ShowDialog();
                        dtGriItem.DataContext = opr.selectItemCombyCom3();
                    }
                    else
                    {
                        cmb = new CustomMessageBox("Erro na operação");
                        cmb.ShowDialog();
                    }
                }
                else
                {
                    return;
                }
            }
            catch (Exception)
            {

                cmb = new CustomMessageBox("Não foi possível realizar a operação.");
                cmb.ShowDialog();
            }
        }
Beispiel #15
0
        public void SyncExternalLinking(Achievement achievement)
        {
            var petBattleLinks = dataManager.GetWithAchievementID(achievement.ID);

            petBattleLinks.AddRange(dataManager.GetWithParentID($"A{achievement.ID}"));

            foreach (var petBattleLink in petBattleLinks)
            {
                var xuFuEncounters = xuFuEncounterDataManager.GetMatches(petBattleLink);
                if (xuFuEncounters.Count == 0)
                {
                    MessageBox.Show($"No match found (count 0) for {petBattleLink.Name}");
                    continue;
                }

                XuFuEncounter xuFuEncounter = null;
                if (xuFuEncounters.Count > 1)
                {
                    WebClient x           = new WebClient();
                    string    source      = x.DownloadString($"https://www.wowhead.com/achievement={achievement.ID}");
                    string    name        = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?) - Achievement - World of Warcraft\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value;
                    string    description = Regex.Match(source, "<meta name=\"description\" content=\"(?<Description>.*?)\">", RegexOptions.IgnoreCase).Groups["Description"].Value;

                    var msBx = new CustomMessageBox($"Please select one of the following options for the achievement criteria that best matches this achievement{Environment.NewLine}{Environment.NewLine}{name}{Environment.NewLine}{Environment.NewLine}{description}{Environment.NewLine}{Environment.NewLine}{string.Join(Environment.NewLine, xuFuEncounters)}", xuFuEncounters.Select(x => x.ID.ToString()).ToList());
                    msBx.ShowDialog();

                    xuFuEncounter = xuFuEncounters.Single(x => x.ID == Convert.ToInt32(msBx.Selection));
                }
                else
                {
                    xuFuEncounter = xuFuEncounters[0];
                }

                if (xuFuEncounter == null)
                {
                    MessageBox.Show($"No match found (null) for {petBattleLink.Name}");
                    continue;
                }
                petBattleLink.ExternalLink = $"https://www.wow-petguide.com/Encounter/{xuFuEncounter.ID}";
                dataManager.UpdateExternalLink(petBattleLink);
            }
        }
Beispiel #16
0
        private void dgUsuario_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            EjecutarAsync(async() =>
            {
                Modelo.Usuario usuario = (Modelo.Usuario)dgUsuario.CurrentRow.DataBoundItem;

                if (dgUsuario.Columns[e.ColumnIndex].Name == "Editar")
                {
                    await usuarioListadoViewModel.ModificarAsync(usuario);
                }
                if (dgUsuario.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.eliminarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        await usuarioListadoViewModel.BorrarAsync(usuario);
                        await usuarioListadoViewModel.BuscarAsync();
                    }
                }
            });
        }
        private void dgProveedor_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            Ejecutar(() =>
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                Modelo.Proveedor proveedor = (Modelo.Proveedor)dgProveedor.CurrentRow.DataBoundItem;

                if (dgProveedor.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.quitarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        productoDetalleViewModel.QuitarProveedor(proveedor);
                    }
                }
            });
        }
Beispiel #18
0
 private void btConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (dpData.SelectedDate == null)
     {
         cmb = new CustomMessageBox("Campos obrigatórios: Data");
         cmb.ShowDialog();
         return;
     }
     else
     {
         try
         {
             if (opr.selectCombyDia(dpData.SelectedDate.Value).Rows.Count == 0)
             {
                 cmb = new CustomMessageBox("Não existe comandas ou despesas para realizar o fluxo de caixa no dia escolhido.");
                 cmb.ShowDialog();
                 return;
             }
             else
             {
                 int rows = opr.insertCaixa(dpData.SelectedDate.Value);
                 if (rows != 0)
                 {
                     cmb = new CustomMessageBox("Fluxo de caixa cadastrado com sucesso!");
                     cmb.ShowDialog();
                     this.Close();
                 }
                 else
                 {
                     cmb = new CustomMessageBox("Erro na inserção!");
                     cmb.ShowDialog();
                 }
             }
         }
         catch (Exception)
         {
             cmb = new CustomMessageBox("Erro interno no SQL.");
             cmb.ShowDialog();
         }
     }
 }
        public CustomMessageBox MessageBoxShow(string message, string caption, int imageIndex, bool oneButton, bool modal)
        {
            CustomMessageBox customMessageBox = new CustomMessageBox();

            customMessageBox.Text = caption;
            customMessageBox.pictureBox1.Image = customMessageBox.imageListMessages.Images[imageIndex];
            customMessageBox.rchInfo.Text      = message;
            if (message.Length > 132)
            {
                int num    = customMessageBox.Width;
                int height = customMessageBox.Height;
                int num2   = (message.Length - 132) / 33;
                num += 80 * num2;
                customMessageBox.Width  = num;
                customMessageBox.Height = height + 30;
                int x = customMessageBox.btnYes.Location.X + 80 * num2 / 2;
                customMessageBox.btnYes.Location = new Point(x, customMessageBox.btnYes.Location.Y + 30);
                int x2 = customMessageBox.btnNo.Location.X + 80 * num2 / 2;
                customMessageBox.btnNo.Location = new Point(x2, customMessageBox.btnNo.Location.Y + 30);
            }
            else
            {
                customMessageBox.Height         -= 30;
                customMessageBox.btnYes.Location = new Point(customMessageBox.btnYes.Location.X, customMessageBox.btnYes.Location.Y - 30);
                customMessageBox.btnNo.Location  = new Point(customMessageBox.btnNo.Location.X, customMessageBox.btnNo.Location.Y - 30);
            }
            if (oneButton)
            {
                customMessageBox.btnYes.Text   = "OK";
                customMessageBox.btnNo.Visible = false;
                int x3 = customMessageBox.Width / 2 - customMessageBox.btnYes.Width / 2;
                int y  = customMessageBox.btnYes.Location.Y;
                customMessageBox.btnYes.Location = new Point(x3, y);
            }
            customMessageBox.TopMost = true;
            if (modal)
            {
                customMessageBox.ShowDialog();
            }
            return(customMessageBox);
        }
        private void deleteArtSupply()
        {
            var selected = artSuppliesLv.SelectedIndices;

            if (selected.Count == 1)
            {
                var selectedIndex = selected[0];
                var item          = _artSupplyRepo.GetForEdit(_artSuppliesIds[selectedIndex]);
                if (item == null)
                {
                    return;
                }
                var dialog = new CustomMessageBox("Warning", $"Do you really want to delete {item.Name}?");
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _artSupplyRepo.Delete(_artSuppliesIds[selectedIndex]);
                    reloadArtSupplies();
                }
            }
        }
        private int LocateFile()
        {
            string folderPathImport = @"S:\LogisticsVariance\PFSolutions";
            string filePath         = @"S:\LogisticsVariance\PFSolutions\PFSolutionsVariance.csv";

            if (!Directory.Exists(folderPathImport))
            {
                _messageBox.Message = string.Format("Folder path {0} was not found.  Cannot import data.", folderPathImport);
                _messageBox.ShowDialog();
                return(0);
            }
            if (!File.Exists(filePath))
            {
                _messageBox.Message = string.Format("A file named PFSolutionsVariance.csv was not found in {0}.  Cannot import data.", folderPathImport);
                _messageBox.ShowDialog();
                return(0);
            }
            return(1);
        }
Beispiel #22
0
 private void DeleteSelected()
 {
     if (CustomMessageBox.ShowDialog(this, new CmbBasicSettings(
                                         Localisation.StartupManager_Message_Delete_Title, Localisation.StartupManager_Message_Delete_Header,
                                         Localisation.StartupManager_Message_Delete_Details,
                                         SystemIcons.Question, Buttons.ButtonRemove, Buttons.ButtonCancel)) ==
         CustomMessageBox.PressedButton.Middle)
     {
         try
         {
             foreach (var item in Selection)
             {
                 item.Delete();
             }
         }
         catch (Exception ex)
         {
             PremadeDialogs.GenericError(ex);
         }
     }
 }
Beispiel #23
0
        private void deleteColoringBookPage()
        {
            var selected = coloringBookDetailLv.SelectedIndices;

            if (selected.Count == 1)
            {
                var selectedIndex = selected[0];
                var item          = _coloringBookPageRepo.GetForEdit(_coloringBookPageIds[selectedIndex]);
                if (item == null)
                {
                    return;
                }
                var dialog = new CustomMessageBox("Warning", $"Do you really want to delete page {item.PageDescription}?");
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _coloringBookPageRepo.Delete(_coloringBookPageIds[selectedIndex]);
                    reloadColoringBookPages();
                }
            }
        }
Beispiel #24
0
        private void deleteRecord()
        {
            var selected = cyclingDiaryLv.SelectedIndices;

            if (selected.Count == 1)
            {
                var selectedIndex = selected[0];
                var item          = _recordRepo.GetForEdit(_recordIds[selectedIndex]);
                if (item == null)
                {
                    return;
                }
                var dialog = new CustomMessageBox("Warning", "Do you really want to delete this record?");
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _recordRepo.Delete(_recordIds[selectedIndex]);
                    reloadAll();
                }
            }
        }
Beispiel #25
0
        public void ChangeFileNamePattern()
        {
            CustomMessageBox tempDialog = new CustomMessageBox(
                caption: "Type in a new pattern for file name generation.",
                icon: CustomMessageBoxIcon.Question,
                buttons: CustomMessageBoxButtons.OkAndCancel,
                messageRows: new List <string>()
            {
                "Supported placeholders:", "(Date), (Guid)", "If you do not provide a placeholder to create unique file names, RecNForget will do it for you."
            },
                prompt: appSettingService.FilenamePrefix,
                controlFocus: CustomMessageBoxFocus.Prompt,
                promptValidationMode: CustomMessageBoxPromptValidation.EraseIllegalPathCharacters);

            tempDialog.TrySetViewablePositionFromOwner(OwnerControl);

            if (tempDialog.ShowDialog().HasValue&& tempDialog.Ok)
            {
                appSettingService.FilenamePrefix = tempDialog.PromptContent;
            }
        }
Beispiel #26
0
        private void mesBtnCopy_Click(object sender, EventArgs e)
        {
            int r = gridView1.GetSelectedRows()[0];

            if (r < 0)
            {
                return;
            }

            string status = (gridView1.GetRowCellValue(r, "Status") != null) ? gridView1.GetRowCellValue(r, "Status").ToString() : "";

            if (status == "Awarded" || status == "Closed")
            {
                _messageBox.Message = "Cannot copy an Awarded or Closed activity.";
                _messageBox.ShowDialog();
                return;
            }

            _type = ActivityType.Copy;
            SalesLeadActivity();
        }
        private void finishInsertBtn_Click(object sender, EventArgs e)
        {
            // odavde proveravaj
            if (string.IsNullOrWhiteSpace(storagePositionCmbBox.Text) || string.IsNullOrWhiteSpace(pricelTxtBox.Text) ||
                string.IsNullOrWhiteSpace(rentingDataPicker.Text) || string.IsNullOrWhiteSpace(endDataOfRentPicker.Text)
                )
            {
                CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg);
                return;
            }
            DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da iznajmite\n Odeljak : {storagePositionCmbBox.Text}\nCena : {pricelTxtBox.Text} RSD\n Od : {rentingDataPicker.Text}\n Do : {endDataOfRentPicker.Text}\n");

            if (result == DialogResult.No || result == DialogResult.Cancel)
            {
                return;
            }
            string dateOfRenting    = rentingDataPicker.Value.Date.ToString("yyyy-MM-dd");
            string dateOfRentingEnd = endDataOfRentPicker.Value.Date.ToString("yyyy-MM-dd");

            storageId = (storagePositionCmbBox.SelectedItem as ComboBoxItem).Value;

            MySqlCommand mySqlCommand = new MySqlCommand
            {
                CommandText = "INSERT INTO `renting_storage` (`fk_storage_id`, `price`, `renting_data`, `end_of_renting_data`, `fk_client_id`) VALUES (@storageId, @price, @dateOfRenting, @end_of_renting_data, @clientId);"
            };

            mySqlCommand.Parameters.AddWithValue("@storageId", storageId);
            mySqlCommand.Parameters.AddWithValue("@price", Decimal.Parse(pricelTxtBox.Text));
            mySqlCommand.Parameters.AddWithValue("@dateOfRenting", dateOfRenting);
            mySqlCommand.Parameters.AddWithValue("@end_of_renting_data", dateOfRentingEnd);
            mySqlCommand.Parameters.AddWithValue("@clientId", fkClientId);

            StoragePDF storagePDF = new StoragePDF(_client);

            storagePDF.exportgridview(storagePositionCmbBox.Text, rentingDataPicker.Text, endDataOfRentPicker.Text, pricelTxtBox.Text);


            DbConnection.executeQuery(mySqlCommand);
            Close();
        }
Beispiel #28
0
        private async void Default_OnClick(object sender, RoutedEventArgs e)
        {
            var messageBox = new CustomMessageBox
            {
                Button1 = new CustomButton
                {
                    Text         = Cultures.Resources.YesButton,
                    DialogResult = true
                },
                Button2 = new CustomButton
                {
                    Text = Cultures.Resources.NoButton
                },
                Message = Cultures.Resources.ResetMessage,
                Owner   = Window.GetWindow(this)
            };

            messageBox.ShowDialog();

            if (messageBox.DialogResult != true)
            {
                return;
            }

            ComboBoxLanguage.SelectionChanged -= ComboBoxLanguage_OnSelectionChanged;
            Properties.Settings.Default.Reset();
            ViewModel.MainWindowViewModel.Config.ViewModel.CheckConfigFile();

            try
            {
                await MainWindowViewModel.SetDefaultLightsSettings();
            }
            catch
            {
                Properties.Settings.Default.AppKey = "";
            }

            Process.Start(Application.ResourceAssembly.Location, "-reset");
            Application.Current.Shutdown();
        }
 private void SaveChangesButton_Click(object sender, RoutedEventArgs e)
 {
     if (nameTB.Text != "")
     {
         if (pcNameTB.Text != "")
         {
             if (passwordTB.Password.Length > 3)
             {
                 if (passwordTB.Password.Equals(confirmPasswordTB.Password))
                 {
                     if (Tools.IsValidEmail(mailTB.Text))
                     {
                         SaveChanges();
                     }
                     else
                     {
                         CustomMessageBox.ShowDialog(Window, "כתובת הדוא''ל שהוזנה אינה חוקית.", "כתובת דוא''ל לא חוקית", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
                     }
                 }
                 else
                 {
                     CustomMessageBox.ShowDialog(Window, "הסיסמאות שהוזנו אינן תואמות אחת לשנייה.", "הסיסמאות אינן תואמות", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
                 }
             }
             else
             {
                 CustomMessageBox.ShowDialog(Window, "אורך הסיסמה חייב להיות ארוך משלושה תווים.", "הסיסמה קצרה מידי", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
             }
         }
         else
         {
             CustomMessageBox.ShowDialog(Window, "שם המחשב אינו יכול להיות ריק.", "שגיאה", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
         }
     }
     else
     {
         CustomMessageBox.ShowDialog(Window, "שם מנהל המערכת אינו יכול להיות ריק.", "שגיאה", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
     }
 }
Beispiel #30
0
        public DialogResult?CheckForDuplicateTTCFiles(AFS2GridSquare afs2GridSquare, out List <string> ttcFiles)
        {
            // A null dialog result means that there are no duplicates
            DialogResult?result = null;

            var gridSquareDirectory = AeroSceneryManager.Instance.Settings.WorkingDirectory + afs2GridSquare.Name;

            ttcFiles = this.EnumerateFilesRecursive(gridSquareDirectory, "*.ttc").ToList();

            List <string> ttcFileNames = new List <string>();

            foreach (var ttcFile in ttcFiles)
            {
                var tccFileName = Path.GetFileName(ttcFile);
                ttcFileNames.Add(tccFileName);
            }

            // Check for duplicate ttc files
            if (ttcFileNames.Count != ttcFileNames.Distinct().Count())
            {
                StringBuilder sbDuplicates = new StringBuilder();

                sbDuplicates.AppendLine(String.Format("Duplicate ttc files were found in the folder for grid square ({0})", afs2GridSquare.Name));
                sbDuplicates.AppendLine("This may be because you have downloaded this grid square with multiple map image providers.");
                sbDuplicates.AppendLine("If you continue with the install you may get a mismatched set of ttc files.");

                var duplicatesMessageBox = new CustomMessageBox(sbDuplicates.ToString(),
                                                                "AeroScenery",
                                                                MessageBoxIcon.Warning);

                duplicatesMessageBox.SetButtons(
                    new string[] { "Continue", "Cancel" },
                    new DialogResult[] { DialogResult.OK, DialogResult.Cancel });

                result = duplicatesMessageBox.ShowDialog();
            }

            return(result);
        }
        /// <summary>
        ///     Returns false if user wants to cancel
        /// </summary>
        internal static PressedButton ProtectedItemsWarningQuestion(string[] affectedKeyNames)
        {
            if (!affectedKeyNames.Any())
            {
                return(PressedButton.Yes);
            }

            switch (
                CustomMessageBox.ShowDialog(DefaultOwner,
                                            new CmbBasicSettings(Localisable.MessageBoxes_Title_Modify_protected_items,
                                                                 Localisable.MessageBoxes_ProtectedItemsWarningQuestion_Message,
                                                                 string.Format(CultureInfo.InvariantCulture, Localisable.MessageBoxes_ProtectedItemsWarningQuestion_Details,
                                                                               string.Join("\n", affectedKeyNames)),
                                                                 SystemIcons.Warning, Buttons.ButtonRemove, Buttons.ButtonCancel)))
            {
            case CustomMessageBox.PressedButton.Middle:
                return(PressedButton.Yes);

            default:
                return(PressedButton.Cancel);
            }
        }
        private void ArticlesDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 3)
            {
                DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da ne ubacite ovu paletu ?");
                if (result == DialogResult.No || result == DialogResult.Cancel)
                {
                    return;
                }
                DataGridViewRow _selectedRow = insertPalleteDataGridView.CurrentRow;
                insertPalleteDataGridView.Rows.Remove(_selectedRow);
            }
            if (e.ColumnIndex == 2)
            {
                int _id_pallete = Convert.ToInt32(insertPalleteDataGridView.Rows[e.RowIndex].Cells["id_pallet"].Value);

                string query2 = @$ "SELECT receipts.fk_client_id, clients.first_name, clients.last_name, items_receipt.fk_receipt_id, items_receipt.fk_article_id, items_receipt.id_items_receipt, items_receipt.quantity, items_receipt.status, articles.article_name, articles.sort, articles.organic, articles.category, item_pallete.fk_id_item_recepit, item_pallete.fk_id_pallete, pallete.pallet_number, pallete.id_pallete FROM receipts INNER JOIN clients ON receipts.fk_client_id = clients.id_client INNER JOIN items_receipt ON items_receipt.fk_receipt_id = receipts.id_receipt INNER JOIN articles ON articles.id_article = items_receipt.fk_article_id INNER JOIN item_pallete ON items_receipt.id_items_receipt = item_pallete.fk_id_item_recepit INNER JOIN pallete ON pallete.id_pallete = item_pallete.fk_id_pallete WHERE pallete.id_pallete = '{_id_pallete}'";

                CustomMessageBox.ShowDialog(this, "Na ovoj paleti se nalazi : \n\t" + DbConnection.fillCustom(query2, "first_name", "last_name", "article_name", "sort", "organic", "category", "quantity"));
                return;
            }
        }
Beispiel #33
0
        //计算BMI
        //公式:体质指数(BMI)=体重(kg)÷ 身高²(m)
        private void txtQ4_Leave(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtQ4.Text) && weight > 0)
            {
                txtQ4.Text = weight.ToString();
            }

            if (!string.IsNullOrEmpty(txtQ3.Text) && !string.IsNullOrEmpty(txtQ4.Text))
            {
                double subheight = (int)double.Parse(txtQ3.Text) * 0.01;
                double subweight = Math.Round(double.Parse(txtQ4.Text), 1);
                double bmiResult = Math.Round((subweight / (subheight * subheight)), 1);
                txtQ5.Text = bmiResult.ToString();
                bmi        = bmiResult;
            }
            else
            {
                var msgBox = new CustomMessageBox("请填写身高与体重!");
                msgBox.ShowDialog();
                return;
            }
        }
Beispiel #34
0
        public List <MyAbandonGameFound> SearchGames(string GameName)
        {
            try
            {
                //Preparing URL and result holder
                string queryResult = string.Empty;
                string queryUri    = string.Format(baseSearchUri, GameName);

                //Performing web request to retrieve the page.
                request  = (HttpWebRequest)WebRequest.Create(queryUri);
                response = (HttpWebResponse)request.GetResponse();

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream       receiveStream = response.GetResponseStream();
                    StreamReader readStream    = null;

                    readStream = new StreamReader(receiveStream, Encoding.UTF8);

                    queryResult = WebUtility.HtmlDecode(readStream.ReadToEnd());

                    response.Close();
                    readStream.Close();
                }

                //Scraping the response to extract the founded games
                List <MyAbandonGameFound> result = ParseSearchResult(queryResult);

                return(result);
            }
            catch (Exception e)
            {
                CustomMessageBox cmb = new CustomMessageBox(e.Message, _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
                cmb.ShowDialog();
                cmb.Dispose();

                return(null);
            }
        }
Beispiel #35
0
        private void LoadSettings()
        {
            if (File.Exists($"config.cfg"))
            {
                try
                {
                    _config = MySerializer.DeserializeXml <Config>("config.cfg");
                }
                catch (InvalidOperationException)
                {
                    _config.SetDeffault();

                    CustomMessageBox messageBox = new CustomMessageBox("File config.cfg is damaged. Reset to default settings");
                    messageBox.ShowDialog();
                    MySerializer.SerializeXml <Config>(_config, "config.cfg");
                }
            }
            else
            {
                _config.SetDeffault();
            }
        }
        public DialogResult ConfirmSceneryInstallation(AFS2GridSquare afs2GridSquare)
        {
            var gridSquareDirectory = AeroSceneryManager.Instance.Settings.WorkingDirectory + afs2GridSquare.Name;

            DialogResult result = DialogResult.No;

            // Does this grid square exist
            if (Directory.Exists(gridSquareDirectory))
            {
                // Do we have an Aerofly folder to install into?
                string afsSceneryInstallDirectory = DirectoryHelper.FindAFSSceneryInstallDirectory(AeroSceneryManager.Instance.Settings);

                if (afsSceneryInstallDirectory != null)
                {
                    // Confirm that the user does want to install scenery
                    StringBuilder sb = new StringBuilder();

                    sb.AppendLine("Are you sure you want to install all scenery for this grid square?");
                    sb.AppendLine("Any existing files in the same destination folder will be overwritten.");
                    sb.AppendLine("");
                    sb.AppendLine(String.Format("Destination: {0}", afsSceneryInstallDirectory));

                    var messageBox = new CustomMessageBox(sb.ToString(),
                                                          "AeroScenery",
                                                          MessageBoxIcon.Question);

                    messageBox.SetButtons(
                        new string[] { "Yes", "No" },
                        new DialogResult[] { DialogResult.Yes, DialogResult.No });

                    result = messageBox.ShowDialog();
                }
            }
            else
            {
            }

            return(result);
        }
Beispiel #37
0
        private void insertBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(priceTxtBox.Text) || string.IsNullOrWhiteSpace(quantityTxtBox.Text) ||
                string.IsNullOrWhiteSpace(travelTxtBox.Text))
            {
                CustomMessageBox.ShowDialog(this, Properties.Resources.emptyInputErrorMsg);
                return;
            }
            decimal priceSingle = Math.Round(Convert.ToDecimal(priceTxtBox.Text), 2);
            decimal quantity    = Math.Round(Convert.ToDecimal(quantityTxtBox.Text), 2);
            decimal travel      = Math.Round(Convert.ToDecimal(travelTxtBox.Text), 2);
            decimal price       = Math.Round((priceSingle * quantity * travel), 2);

            TransportItem transportItem = new TransportItem(0, _selectedClient._id, priceSingle, quantity, travel, price);

            transportDataGridView.Rows.Add(transportItem._id, transportItem._priceSingle, transportItem._quantity, transportItem._traveled, transportItem._price);

            priceTxtBox.ResetText();
            quantityTxtBox.ResetText();
            travelTxtBox.ResetText();

            priceTxtBox.Focus();
        }
        private void HandleDirectoryMoveError(Exception ex, string sourceDirectory, string destinationDirectory)
        {
            var errorSb = new StringBuilder();

            errorSb.AppendLine("There was an error renaming the directory");
            errorSb.AppendLine(sourceDirectory);
            errorSb.AppendLine("to");
            errorSb.AppendLine(destinationDirectory);
            errorSb.AppendLine("");
            errorSb.AppendLine("Please close any files in that directory and restart AeroScenery.");
            errorSb.AppendLine("Also check that the destination directory doesn't exist.");
            errorSb.AppendLine("");
            errorSb.AppendLine("If the error presists, try restarting your computer, then restarting AeroScenery.");
            errorSb.AppendLine("If that fails, try the rename manually with Windows Explorer.");
            errorSb.AppendLine("");
            errorSb.AppendLine(string.Format("Error: {0}", ex.Message));

            var errorMessageBox = new CustomMessageBox(errorSb.ToString(),
                                                       "AeroScenery",
                                                       MessageBoxIcon.Error);

            errorMessageBox.ShowDialog();
        }
        private async void BtnOK_Click(object sender, EventArgs e)
        {
            try
            {
                lockWeight = true;
                string msg = string.Format("ต้องการบันทึกน้ำหนัก: {0} kg.", lblWeight.Text);
                var frmConfirm = new CustomMessageBox(msg);
                if (frmConfirm.ShowDialog() == DialogResult.OK)
                {
                    BtnOK.Enabled = false;
                    btnStop.Enabled = false;
                    //BtnControl(false, false, false);
                    lblMessage.Text = Constants.PROCESSING;
                    SaveData();
                    //Console.Beep();
                    //lblWeight.BackColor = Color.FromArgb(33, 150, 83);
                    //lblWeight.ForeColor = Color.White;
                    await Task.Delay(1000);
                    lblMessage.Text = Constants.SAVE_SUCCESS;
                    LoadData(lblReceiveNo.Text);
                    //lblWeight.BackColor = Color.White;
                    //lblWeight.ForeColor = Color.Black;

                    //รอรับน้ำหนัก  MinWeight
                    lockWeight = false;
                    lblWeight.Text = $"0.0";
                    //TmMinWeight.Enabled = true;
                }
                lockWeight = false;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Beispiel #40
0
 private void btExcluir_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dGrid.SelectedItem == null)
         {
             return;
         }
         cmb = new CustomMessageBox("Tem certeza que deseja excluir?", "Atenção", "YesNo");
         cmb.ShowDialog();
         if (cmb.DialogResult.HasValue && cmb.DialogResult.Value)
         {
             info.data_fluxo = DateTime.Parse(((DataRowView)dGrid.SelectedItem).Row[0].ToString());
             int rows = opr.deleteCaixa(info);
             if (rows != 0)
             {
                 cmb = new CustomMessageBox("Item excluído com sucesso!");
                 cmb.ShowDialog();
                 dGrid.DataContext = opr.selectCaixa();
             }
             else
             {
                 cmb = new CustomMessageBox("Erro na operação");
                 cmb.ShowDialog();
             }
         }
         else
         {
             return;
         }
     }
     catch (Exception)
     {
         cmb = new CustomMessageBox("Erro interno no SQL.");
         cmb.ShowDialog();
     }
 }
        internal static PressedButton QuietUninstallersNotAvailableQuestion(string[] nonQuiet)
        {
            if (!Settings.Default.MessagesAskRemoveLoudItems)
            {
                return(PressedButton.Yes);
            }

            var check = new CmbCheckboxSettings(Localisable.MessageBoxes_RememberChoiceCheckbox)
            {
                DisableRightButton  = true,
                DisableMiddleButton = true
            };
            var result =
                CustomMessageBox.ShowDialog(DefaultOwner,
                                            new CmbBasicSettings(Localisable.MessageBoxes_Title_Quiet_uninstall,
                                                                 Localisable.MessageBoxes_QuietUninstallersNotAvailableQuestion_Message,
                                                                 string.Format(CultureInfo.InvariantCulture, Localisable.MessageBoxes_QuietUninstallersNotAvailableQuestion_Details,
                                                                               string.Join("\n", nonQuiet)),
                                                                 SystemIcons.Question, Buttons.ButtonUseLoud, Buttons.ButtonRemove, Buttons.ButtonCancel), check);

            switch (result)
            {
            case CustomMessageBox.PressedButton.Left:
                if (check.Result.HasValue && check.Result.Value)
                {
                    Settings.Default.MessagesAskRemoveLoudItems = false;
                }
                return(PressedButton.Yes);

            case CustomMessageBox.PressedButton.Middle:
                return(PressedButton.No);

            default:
                return(PressedButton.Cancel);
            }
        }
        private void getOrderButton_Click(object sender, RoutedEventArgs e)
        {
            if (ordersGrid.SelectedItems.Count == 1)
            {
                try
                {
                    Orders order = ordersGrid.SelectedItem as Orders;

                    if (order != null)
                    {
                        order.FileData = Encryption.Decrypt(order.FileData, hashService.GetHash());
                        Directory.CreateDirectory(Constant.RootToSaveRetrievedFromDb);
                        using FileStream fs = new FileStream($"{Constant.RootToSaveRetrievedFromDb}" + order.FileName + ".docx", FileMode.OpenOrCreate);
                        fs.Write(order.FileData, 0, order.FileData.Length);

                        CustomMessageBox messageBox = new CustomMessageBox($"Військове бойове донесення збережено.");
                        messageBox.ShowDialog();
                    }
                    else
                    {
                        CustomMessageBox messageBox = new CustomMessageBox("Військове бойове донесення не знайдено.");
                        messageBox.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    CustomMessageBox messageBox = new CustomMessageBox(ex.Message);
                    messageBox.ShowDialog();
                }
            }
            else
            {
                CustomMessageBox messageBox = new CustomMessageBox("Виберіть лише один файл для збереження!");
                messageBox.ShowDialog();
            }
        }
Beispiel #43
0
        private void VentaForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (!txtCodigoDescirpcion.AutoCompleteShowing &&
                (e.KeyCode == Keys.Down ||
                 e.KeyCode == Keys.Up ||
                 e.KeyCode == Keys.Left ||
                 e.KeyCode == Keys.Right))
            {
                dgProductos.Focus();
                int RowSeleccionada = dgProductos.SelectedRows[0].Index;
                if (e.KeyCode == Keys.Up && RowSeleccionada > 0)
                {
                    dgProductos.ClearSelection();
                    dgProductos.Rows[RowSeleccionada - 1].Selected = true;
                }
                if (e.KeyCode == Keys.Down && RowSeleccionada < dgProductos.Rows.Count - 1)
                {
                    dgProductos.ClearSelection();
                    dgProductos.Rows[RowSeleccionada + 1].Selected = true;
                }
            }

            if (e.KeyCode == Keys.Escape && dgProductos.CurrentRow != null)
            {
                VentaItem ventaItems = (VentaItem)dgProductos.CurrentRow.DataBoundItem;
                if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.quitarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                {
                    ventaViewModel.Quitar(ventaItems);
                }
            }

            if (e.KeyCode == Keys.F12)
            {
                btnCobrar.PerformClick();
            }
        }
Beispiel #44
0
        private void dgProductos_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            Ejecutar(() =>
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                VentaItem ventaItems = (VentaItem)dgProductos.CurrentRow.DataBoundItem;
                if (dgProductos.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.quitarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        ventaViewModel.Quitar(ventaItems);
                    }
                }
                else
                {
                    //inicio la edicion de la current celda
                    dgProductos.BeginEdit(true);
                }
            });
        }
        public void ShowDialog(string title, string Message, string screenID)
        {
            ScreenID    = screenID;
            chkDontShow = false;
            CommonMessagingWindowVM.ProcessMiscellaneousMessages(Message, "Alert");

            CustomMessageBox objcustwindow = Application.Current.Windows.OfType <CustomMessageBox>().FirstOrDefault();

            if (objcustwindow != null)
            {
                Title          = title;
                CapitalInfoMsg = Message;
                objcustwindow.Focus();
                objcustwindow.Activate();
                objcustwindow.ShowDialog();
            }
            else
            {
                objcustwindow  = new CustomMessageBox();
                Title          = title;
                CapitalInfoMsg = Message;
                objcustwindow.ShowDialog();
            }
        }
Beispiel #46
0
        private void finishInsertBtn_Click(object sender, EventArgs e)
        {
            if (transportDataGridView.Rows.Count < 1)
            {
                CustomMessageBox.ShowDialog(this, Properties.Resources.emptyDGVMsg);
                return;
            }

            DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da unesete putne naloge?");

            if (result == DialogResult.No || result == DialogResult.Cancel)
            {
                return;
            }

            decimal totalPrice = 0;

            foreach (DataGridViewRow row in transportDataGridView.Rows)
            {
                decimal priceSingle = Convert.ToDecimal(row.Cells["price"].Value);
                decimal quantity    = Convert.ToDecimal(row.Cells["quantity"].Value);
                decimal traveled    = Convert.ToDecimal(row.Cells["traveled"].Value);
                decimal price       = Convert.ToDecimal(row.Cells["totalPrice"].Value);

                totalPrice += price;

                TransportItem item = new TransportItem(0, _selectedClient._id, priceSingle, quantity, traveled, price);
                transportItems.Add(item);
            }

            DbConnection.executeTransportQuery(transportItems, totalPrice);
            TransportPDF createPDF = new TransportPDF(_selectedClient);

            createPDF.exportgridview(transportDataGridView);
            transportDataGridView.Rows.Clear();
        }
Beispiel #47
0
 private void mnEstoque_Click(object sender, RoutedEventArgs e)
 {
     cmb = new CustomMessageBox("Essa parte do sistema ainda está em construção!");
     cmb.ShowDialog();
 }
        private void btnGetGameData_Click(object sender, EventArgs e)
        {
            if(_selectedGame != null){
                if (_game == null || _game.GameURI != _selectedGame.Uri)
                {
                    _game = _scraper.RetrieveGameData(_selectedGame.Uri);

                    if (_game == null)
                        return;

                    //Retrieving first available screenshot
                    if (_game.Screenshots != null && _game.Screenshots.Count > 0)
                    {
                        _scraper.DownloadFileCompleted += _scraper_DownloadFileCompleted;
                        _scraper.DownloadMedia(_game.Screenshots[0], Application.StartupPath + "\\tmp.img");
                    }

                }
                else if( _game != null )
                {
                    CustomMessageBox cmb = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 77, "Download Completed!!!"),
                                                                _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 59, "Information"),
                                                                MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Information, false, false);
                    cmb.ShowDialog();
                    cmb.Dispose();

                }

            }
        }
Beispiel #49
0
        private void OpenRecentDatabase(string dbPath, bool closePreviousConnection)
        {
            if (!File.Exists(dbPath))
            {
                CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 7, "We are not able to find the selected database inside this computer.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 10, "Do you want to remove it from the list?"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention"), MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false);
                customMessageBox.ShowDialog();
                if (customMessageBox.Result == MessageBoxDialogResult.Yes)
                {

                    if (_manager.SettingsDB.RemoveRecentDatabase(dbPath))
                    {
                        _manager.RecentDBs.Remove(dbPath);
                        ReloadRecentDBsMenuItems();

                    }

                }
                customMessageBox.Dispose();
            }
            else
            {
                if (closePreviousConnection)
                    _manager.DB.Disconnect();

                if (!_manager.DB.Connect(dbPath))
                {
                    CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 6, "It has not been possible to open the database!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 30, "Warning"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Warning, false, false);
                    customMessageBox.ShowDialog();
                    customMessageBox.Dispose();
                }
                else
                {
                    AddDBToRecentAndSetupUI(dbPath, false);
                }
            }
        }
        void _scraper_DownloadFileCompleted(object sender, string DestinationFile)
        {
            try
            {
                if (File.Exists(Application.StartupPath + "\\tmp.img"))
                {
                    _gameScreenshot = Application.StartupPath + "\\tmp.img";

                    CustomMessageBox cmb = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 77, "Download Completed!!!"),
                                                                _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 59, "Information"),
                                                                MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Information, false, false);
                    cmb.ShowDialog();
                    cmb.Dispose();

                }
                else
                    _gameScreenshot = string.Empty ;
            }
            catch (Exception)
            {
                _gameScreenshot = string.Empty;
            }
        }
Beispiel #51
0
        private void btLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                info.user_log = txtUser.Text;
                info.pass_log = txtPass.Password;

                DataTable log = opr.selectLogin(info);
                if (log.Rows.Count == 0)
                {
                    cmb = new CustomMessageBox("Login Incorreto!");
                    cmb.ShowDialog();
                }
                else
                {
                    cmb = new CustomMessageBox("Bem-vindo!");
                    cmb.ShowDialog();
                    Menu m = new Menu(txtUser.Text, (Int32)log.Rows[0]["Código"], log.Rows[0]["Nível"].ToString());
                    m.Show();
                    this.Close();
                }
            }
            catch (Exception)
            {
                CustomMessageBox cmd = new CustomMessageBox("Erro interno do SQL.");
                cmd.ShowDialog();
            }
            
        }
Beispiel #52
0
        private MyAbandonGameInfo ParseGamePage(string queryResult)
        {
            MyAbandonGameInfo result = null;

            if (queryResult != string.Empty)
            {
                htmlDoc.LoadHtml(queryResult);
                if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
                {
                    // Handle any parse errors as required
                    string errorMessage = string.Empty;
                    foreach (HtmlParseError error in htmlDoc.ParseErrors)
                    {
                        errorMessage += error.Reason + "\n";
                    }

                    CustomMessageBox cmb = new CustomMessageBox(errorMessage, _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"),
                                                                MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
                    cmb.ShowDialog();
                    cmb.Dispose();

                }
                else
                {

                    if (htmlDoc.DocumentNode != null)
                    {
                        HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body//div[@class='box']");

                        if (bodyNode != null)
                        {
                            result = new MyAbandonGameInfo();

                            //Game Name
                            HtmlNode nameNode = bodyNode.SelectSingleNode("//h2[@itemprop='name']");
                            if (nameNode != null)
                            {
                                result.Title = nameNode.InnerText.Trim();
                            }

                            //Game Data
                            HtmlNode gameDataNode = bodyNode.SelectSingleNode("//div[@class='gameData']/dl");
                            if (gameDataNode != null)
                            {
                                foreach(HtmlNode itemNode in gameDataNode.ChildNodes)
                                {

                                    if (itemNode.Name.ToLower() == "dt")
                                    {
                                        if (itemNode.InnerText.Trim().ToLower() == "year")
                                            flags.SetFlags(true, false, false, false, false, false, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "platform")
                                            flags.SetFlags(false, true, false, false, false, false, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "released in")
                                            flags.SetFlags(false, false, true, false, false, false, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "genre")
                                            flags.SetFlags(false, false, false, true, false, false, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "theme")
                                            flags.SetFlags(false, false, false, false, true, false, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "publisher")
                                            flags.SetFlags(false, false, false, false, false, true, false, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "developer")
                                            flags.SetFlags(false, false, false, false, false, false, true, false, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "perspectives")
                                            flags.SetFlags(false, false, false, false, false, false, false, true, false);

                                        if (itemNode.InnerText.Trim().ToLower() == "dosbox support")
                                            flags.SetFlags(false, false, false, false, false, false, false, false, true);

                                    }

                                    if(itemNode.Name.ToLower() == "dd")
                                    {

                                        if(flags.IsYear)
                                            result.Year= WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if (flags.IsPlatform)
                                            result.Platform = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if (flags.IsReleasedIn)
                                            result.ReleasedIn = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if(flags.IsGenre)
                                            result.Genre = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if (flags.IsTheme)
                                        {
                                            string themeString = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                            if (themeString != string.Empty)
                                                result.Themes = themeString.Replace(", ",",").Split(',').ToList();
                                        }

                                        if (flags.IsPublisher)
                                            result.Publisher = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if (flags.IsDeveloper)
                                            result.Developer = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                        if (flags.IsPerspectives)
                                        {
                                            string perspectiveString = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                            if (perspectiveString != string.Empty)
                                                result.Perspectives = perspectiveString.Replace(", ", ",").Split(',', ' ').ToList();
                                        }

                                        if (flags.IsDosBox)
                                            result.DosBoxVersion = WebUtility.HtmlDecode(itemNode.InnerText.Trim());

                                    }
                                }

                            }

                            //Game Vote
                            HtmlNode voteNode = bodyNode.SelectSingleNode("//span[@itemprop='ratingValue']");
                            if (voteNode != null)
                                result.Vote = voteNode.InnerText;

                            //Game Descritpion
                            //First I check if exists the proper node
                            HtmlNode descriptionNode = bodyNode.SelectSingleNode("//div[@class='gameDescription dscr']");
                            if (descriptionNode != null)
                            {
                                result.Description = WebUtility.HtmlDecode(descriptionNode.InnerText);
                            }
                            else
                            {
                                //As it seems missing I try the other one
                                descriptionNode = bodyNode.SelectSingleNode("//div[@class='box']/h3[@class='cBoth']");
                                if (descriptionNode != null)
                                {
                                    HtmlNode descNone = descriptionNode.ParentNode.SelectSingleNode("p");
                                    if (descNone != null)
                                        result.Description = WebUtility.HtmlDecode(descNone.InnerText);
                                }
                            }

                            //Game Screenshots
                            HtmlNodeCollection screenshotsNodes = bodyNode.SelectNodes("//body//div[@class='thumb']/a[@class='lb']/img");
                            if (screenshotsNodes != null)
                            {
                                foreach (HtmlNode screen in screenshotsNodes)
                                {
                                    if(screen.Name.ToLower().Trim() == "img")
                                    {
                                        if (result.Screenshots == null)
                                            result.Screenshots = new List<string>();

                                        result.Screenshots.Add(GetMediaURI(screen.Attributes["src"].Value));
                                    }

                                }
                            }

                            //Game Download & Size
                            HtmlNode downloadNode = bodyNode.SelectSingleNode("//a[@class='button download']");
                            if (downloadNode != null)
                            {
                                result.DownloadLink = downloadNode.Attributes["href"].Value;

                                HtmlNode downloadSize = downloadNode.SelectSingleNode("//a[@class='button download']/span");
                                if (downloadSize != null)
                                {
                                    result.DownloadSize = downloadSize.InnerText.Trim();
                                }
                            }

                        }
                    }
                }
            }

            return result;
        }
Beispiel #53
0
        public bool RemoveGame(int GameID)
        {
            try
            {
                if (_Connection.State != System.Data.ConnectionState.Open)
                    //I raise an error as there is no connection to the database
                    throw new Exception("There is no connection to the database");

                String sql = String.Format("DELETE FROM Games WHERE id = {0}", GameID);

                SQLiteCommand command = new SQLiteCommand(sql, _Connection);
                command.ExecuteNonQuery();

                return true;

            }
            catch (Exception e)
            {
                CustomMessageBox cmb = new CustomMessageBox("An error raised trying to remove the selected game:\n" + e.Message, "Error",MessageBoxDialogButtons.Ok,MessageBoxDialogIcon.Error,false,false);
                cmb.ShowDialog();
                cmb.Dispose();
                return false;
            }
        }
Beispiel #54
0
        public List<MyAbandonGameFound> SearchGames(string GameName)
        {
            try
            {
                //Preparing URL and result holder
                string queryResult = string.Empty;
                string queryUri = string.Format(baseSearchUri, GameName);

                //Performing web request to retrieve the page.
                request = (HttpWebRequest)WebRequest.Create(queryUri);
                response = (HttpWebResponse)request.GetResponse();

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream receiveStream = response.GetResponseStream();
                    StreamReader readStream = null;

                    readStream = new StreamReader(receiveStream, Encoding.UTF8);

                    queryResult = WebUtility.HtmlDecode(readStream.ReadToEnd());

                    response.Close();
                    readStream.Close();
                }

                //Scraping the response to extract the founded games
                List<MyAbandonGameFound> result = ParseSearchResult(queryResult);

                return result;
            }
            catch (Exception e)
            {
                CustomMessageBox cmb = new CustomMessageBox(e.Message, _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
                cmb.ShowDialog();
                cmb.Dispose();

                return null;
            }
        }
Beispiel #55
0
 private void RecentDatabaseItemClickHandler(object sender, EventArgs e)
 {
     string text = ((ToolStripItem)sender).Text;
     if (_manager.DB != null && _manager.DB.ConnectionStatus == ConnectionState.Open)
     {
         CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 9, "You are already connected to another database.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 11, "Do you want to close the previous database and open the selected one?"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention"), MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false);
         customMessageBox.ShowDialog();
         if (customMessageBox.Result == MessageBoxDialogResult.Yes)
             OpenRecentDatabase(text, true);
         customMessageBox.Dispose();
     }
     else
         OpenRecentDatabase(text, false);
 }
Beispiel #56
0
        private void btConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (mode == 0)
            {
                if (txtNome.Text.Trim() == "" || txtvlrVenda.Text.Trim() == "" || cbEst.Text == "") 
                {
                    cmb = new CustomMessageBox("Campos obrigatórios: Nome, Valor de Venda, Estado");
                    cmb.ShowDialog();
                    return;
                }
                else
                {
                    try
                    {
                        
                        info.nome_prod = txtNome.Text;
                        info.desc_prod = txtDesc.Text;
                        info.vlrUnit_ven = txtvlrVenda.Text;
                        info.vlrUnit_cpr = txtvlrCompra.Text;
                        info.est_prod = cbEst.Text;
                        int rows = opr.insertProd(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Produto cadastrado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na inserção!");
                            cmb.ShowDialog();
                        }
                    }
                    catch (Exception)
                    {

                        cmb = new CustomMessageBox("Erro interno no SQL!");
                        cmb.ShowDialog();
                    }    
                }
            }
            else
	        {
                if (txtNome.Text.Trim() == "" || txtvlrVenda.Text.Trim() == "" || cbEst.Text == "")
                {
                    cmb = new CustomMessageBox("Campos obrigatórios: Nome, Valor de Venda, Estado");
                    cmb.ShowDialog();
                    return;
                }
                else
                {
                    try
                    {
                        info.nome_prod = txtNome.Text;
                        info.desc_prod = txtDesc.Text;
                        info.vlrUnit_ven = txtvlrVenda.Text;
                        info.vlrUnit_cpr = txtvlrCompra.Text;
                        info.est_prod = cbEst.Text;
                        int rows = opr.updateProd(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Produto alterado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na alteração!");
                            cmb.ShowDialog();
                        }
                    }
                    catch (Exception)
                    {
                        cmb = new CustomMessageBox("Erro interno no SQL!");
                        cmb.ShowDialog();
                    }    
                }
	         }
        }
Beispiel #57
0
 private void cmdTerminar_Click(object sender, EventArgs e)
 {
     BackgroundWorker bg_insert_or_update = new BackgroundWorker();
     bg_insert_or_update.DoWork += new DoWorkEventHandler(bg_insert_or_update_DoWork);
     lista_bgwBaseDeDatos.Add(bg_insert_or_update);
     if (reg != null)
     {
         if (this.RegistroGuardado)
         {
             if (!vp.IsShown)
                 this.mostrarVistasPrevias(this.FinalOutputPath_Etq);
             return;
         }
         bg_insert_or_update.RunWorkerAsync();
         if (!this.MsjColorEtqMostrado)
         {
             try
             {
                 CustomMessageBox MBox;
                 if (DiccionarioColores.ContainsKey(etq.ColorEtiquetaCaja))
                 {
                     if (etq.ColorEtiquetaCaja != "BLANCO")
                     {
                         MBox = new CustomMessageBox(DiccionarioColores[etq.ColorEtiquetaCaja], etq.ColorEtiquetaCaja);
                         MBox.ShowDialog();
                     }
                 }
                 else if (etq.ColorEtiquetaCaja.Contains(',')) //mostrar mensaje para etiquetas multiples
                 {
                     string[] colores = etq.ColorEtiquetaCaja.Split(',');
                     MBox = new CustomMessageBox(DiccionarioColores[colores[0]], DiccionarioColores[colores[1]], etq.ColorEtiquetaCaja);
                     MBox.ShowDialog();
                 }
             }
             catch { }
             this.MsjColorEtqMostrado = true;
             this.CrearBotonFinal();
         }
         this.UnirPDFs();
         this.btnTerminar.Visible = true;
         if (!vp.IsShown)
             this.mostrarVistasPrevias(this.FinalOutputPath_Etq);
         this.RegistroGuardado = true;
     }
     else
     {
         if (this.RegistroGuardado)
         {
             if (!vp.IsShown)
                 this.mostrarVistasPrevias(this.FinalOutputPath_Etq);
             return;
         }
         bg_insert_or_update.RunWorkerAsync();
         if (!this.MsjColorEtqMostrado)
         {
             try
             {
                 CustomMessageBox MBox;
                 if (DiccionarioColores.ContainsKey(etq.ColorEtiquetaCaja))
                 {
                     if (etq.ColorEtiquetaCaja != "BLANCO")
                     {
                         MBox = new CustomMessageBox(DiccionarioColores[etq.ColorEtiquetaCaja], etq.ColorEtiquetaCaja);
                         MBox.ShowDialog();
                     }
                 }
                 else if (etq.ColorEtiquetaCaja.Contains(',')) //mostrar mensaje para etiquetas multiples
                 {
                     string[] colores = etq.ColorEtiquetaCaja.Split(',');
                     int count = 0;
                     for (int i = 0; i < colores.Length; i++)
                     {
                         if (colores[i] == "BLANCO")
                             count++;
                     }
                     if (count != colores.Length)
                     {
                         MBox = new CustomMessageBox(DiccionarioColores[colores[0]], DiccionarioColores[colores[1]], etq.ColorEtiquetaCaja);
                         MBox.ShowDialog();
                     }
                 }
             }
             catch { }
             this.MsjColorEtqMostrado = true;
             this.CrearBotonFinal();
         }
         this.UnirPDFs();
         this.btnTerminar.Visible = true;
         if (!vp.IsShown)
             this.mostrarVistasPrevias(this.FinalOutputPath_Etq);
         this.RegistroGuardado = true;
     }
 }
 public void Message(string type, string msg)
 {
     CustomMessageBox msgBox = new CustomMessageBox(type, msg);
     msgBox.ShowDialog();
 }
Beispiel #59
0
 private void RunGame(int GameID)
 {
     if (GameID == -1)
         return;
     Game gamesFromId = _manager.DB.GetGameFromID(GameID);
     string str = _manager.DosBoxHelper.BuildArgs(false, gamesFromId, _manager.AppSettings);
     if (str == null)
     {
         CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 22, "DOSBox cannot be run (was it removed?)!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 23, "Run Game"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
         customMessageBox.ShowDialog();
         customMessageBox.Dispose();
     }
     else
     {
         if (_manager.AppSettings.ReduceToTrayOnPlay)
         {
             notifyIcon.Visible = true;
             notifyIcon.BalloonTipText = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 73, "DOSBox Manager is still running and will raise back once closing the game.");
             notifyIcon.BalloonTipTitle = "DOSBox Manager";
             notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
             notifyIcon.ShowBalloonTip(500);
             Hide();
         }
         Process process = new Process();
         process.StartInfo.WorkingDirectory = gamesFromId.Directory != string.Empty ? gamesFromId.Directory : _manager.FileHelper.ExtractFilePath(gamesFromId.DOSExePath);
         process.StartInfo.FileName = _manager.AppSettings.DosboxPath;
         process.StartInfo.Arguments = str;
         process.Start();
         process.WaitForExit();
         if (_manager.AppSettings.ReduceToTrayOnPlay)
         {
             notifyIcon.Visible = false;
             Show();
         }
     }
 }
Beispiel #60
0
        private void btConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (mode == 0)
            {
                if (txtNome.Text.Trim() == "" || txtSenha.Password.Trim() == "" || cbTipo.Text == "")
                {
                    cmb = new CustomMessageBox("Campos obrigatórios: Nome, Senha, Tipo");
                    cmb.ShowDialog();
                    return;
                }
                else
                {
                    try
                    {
                        info.user_log = txtNome.Text;
                        info.pass_log = txtSenha.Password;
                        info.nivel_log = cbTipo.Text;
                        int rows = opr.insertLog(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Usuário (Login) cadastrado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na inserção!");
                            cmb.ShowDialog();
                        }
                    }
                    catch (Exception)
                    {
                        CustomMessageBox cmd = new CustomMessageBox("Erro interno do SQL.");
                        cmd.ShowDialog();
                    }    
                }
            }
            else
	        {
                if (txtNome.Text.Trim() == "" || txtSenha.Password.Trim() == "" || cbTipo.Text == "")
                {
                    cmb = new CustomMessageBox("Campos obrigatórios: Nome, Senha, Tipo");
                    cmb.ShowDialog();
                    return;
                }
                else
                {
                    try
                    {
                        info.user_log = txtNome.Text;
                        info.pass_log = txtSenha.Password;
                        info.nivel_log = cbTipo.Text;
                        int rows = opr.updateLog(info);
                        if (rows != 0)
                        {
                            cmb = new CustomMessageBox("Usuário (Login) alterado com sucesso!");
                            cmb.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            cmb = new CustomMessageBox("Erro na alteração!");
                            cmb.ShowDialog();
                        }
                    }
                    catch (Exception)
                    {

                        throw;
                    }    
                }
            }
        }