Example #1
0
 private void closeToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     DialogResult a = new System.Windows.Forms.DialogResult();
     a = MessageBox.Show(null, "Deseja realmente fechar o programa. ", "Aviso ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
     if (a == System.Windows.Forms.DialogResult.OK)
         Application.Exit();
 }
Example #2
0
 private void BtnExt_Click(object sender, EventArgs e)
 {
     var result=new System.Windows.Forms.DialogResult();
     result = MessageBox.Show("Вы уверены, что желаете закрыть программу?", "FMDb: Выход из программы",
                   MessageBoxButtons.YesNo,
                   MessageBoxIcon.Question);
     if (result == DialogResult.Yes)
     {
         appendText = DateTime.Now.ToString() + ": пользователь " + login + " вышел из системы.\n";
         File.AppendAllText(path, appendText, Encoding.UTF8);
         Application.Exit();
     }
 }
Example #3
0
 public SkinButton(string basePath) : base(basePath)
 {
     this.components = null;
     this.mButtonState = 0;
     this.mMouseOver = false;
     this.mMouseDown = false;
     this.mDisabledForecolor = Color.Gray;
     this.FirstMouseEnter = true;
     this.mIsDefaultButton = false;
     this.mDialogResult = System.Windows.Forms.DialogResult.OK;
     this.InitializeComponent();
     this.Construct();
 }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var result = new System.Windows.Forms.DialogResult();
            result = MessageBox.Show("Вы уверены, что желаете сохранить изменения?", "FMDb: сохранение изменений ",
                          MessageBoxButtons.YesNo,
                          MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                try
                {
                    appendText = DateTime.Now.ToString() + ": пользователь " + log + " внес изменения в один из рабочих списков (жанры, страны, актеры, режиссеры).\n";
                    File.AppendAllText(path, appendText, Encoding.UTF8);

                    if (dgvGenre.DataSource == genreBindingSource)
                    {
                        this.Validate();
                        genreBindingSource.EndEdit();
                        genreTableAdapter.Update(fMDbDataSet);
                        genreTableAdapter.Fill(fMDbDataSet.Genre);
                    }
                    if (dgvCountry.DataSource == countryBindingSource)
                    {
                        this.Validate();
                        countryBindingSource.EndEdit();
                        countryTableAdapter.Update(fMDbDataSet);
                        countryTableAdapter.Fill(fMDbDataSet.Country);
                    }
                    if (dgvActors.DataSource == actorsBindingSource)
                    {
                        this.Validate();
                        actorsBindingSource.EndEdit();
                        actorsTableAdapter.Update(fMDbDataSet);
                        actorsTableAdapter.Fill(fMDbDataSet.Actors);
                    }
                    if (dgvProd.DataSource == producerBindingSource)
                    {
                        this.Validate();
                        producerBindingSource.EndEdit();
                        producerTableAdapter.Update(fMDbDataSet);
                        producerTableAdapter.Fill(fMDbDataSet.Producer);
                    }
                }

                catch (Exception except)
                {
                    MessageBox.Show(except.Message, "Ошибка!");
                }
            }
        }
        private void btnClean_Click(object sender, EventArgs e)
        {
            var result = new System.Windows.Forms.DialogResult();
            result = MessageBox.Show("Вы уверены, что желаете удалить лог?", "FMDb: Удаление лога",
                          MessageBoxButtons.YesNo,
                          MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                rtbShow.Clear();
                File.Delete(path);
                appendText = DateTime.Now.ToString() + " Лог был очищен.\n";
                File.AppendAllText(path, appendText, Encoding.UTF8);

            }
        }
Example #6
0
        private void folder_select_btn_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            var path = dialog.SelectedPath.ToString();
            //ConfigurationManager.AppSettings["folder_path"] = result.ToString();

            var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var settings   = configFile.AppSettings.Settings;

            if (settings["folder_path"] == null)
            {
                settings.Add("folder_path", path);
            }
            else
            {
                settings["folder_path"].Value = path;
            }
            configFile.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);

            folder_select_text_box.Text = ConfigurationManager.AppSettings["folder_path"];
        }
Example #7
0
        private void Button_java_path_Click(object sender, RoutedEventArgs e)
        {
            string javaPath = "./";

            if (!String.IsNullOrEmpty(Textbox_java_path.Text))
            {
                javaPath = Textbox_java_path.Text.Trim();
            }

            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.Description         = "请选择JDK所在的文件夹";
            folderDialog.ShowNewFolderButton = true;
            //folderDialog.RootFolder = Environment.SpecialFolder.ProgramFiles;
            folderDialog.SelectedPath = javaPath;
            System.Windows.Forms.DialogResult result = folderDialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string folderName = folderDialog.SelectedPath;
                if (!String.IsNullOrEmpty(folderName))
                {
                    Textbox_java_path.Text = folderName;
                }
            }
        }
Example #8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            /* Removed use of Windows Core API Code Pack
             *
             * var dlg = new CommonOpenFileDialog();
             * dlg.Title = "Browse to the Freb folder";
             * dlg.IsFolderPicker = true;
             *
             * dlg.AddToMostRecentlyUsedList = false;
             * dlg.AllowNonFileSystemItems = false;
             * dlg.EnsurePathExists = true;
             * dlg.EnsureReadOnly = false;
             * dlg.EnsureValidNames = true;
             * dlg.Multiselect = false;
             * dlg.ShowPlacesList = true;
             *
             * if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
             * {
             *  var folder = dlg.FileName;
             *  // Do something with selected folder string
             *  locationTextBox.Text = dlg.FileName;
             *
             * }
             */
            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                FolderBrowserDialog fbroswer             = new System.Windows.Forms.FolderBrowserDialog();;
                System.Windows.Forms.DialogResult result = fbroswer.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    locationTextBox.Text = fbroswer.SelectedPath;
                }
            }
            // Process open file dialog box results
        }
        // Triggers from xaml right click context menu on file tree -> when user selects "open new project folder"
        private void Pfolder_open(object sender, RoutedEventArgs e)
        {
            swf.FolderBrowserDialog dlg    = new swf.FolderBrowserDialog();
            swf.DialogResult        result = dlg.ShowDialog();
            dlg.RootFolder = Environment.SpecialFolder.MyDocuments;

            if (result == swf.DialogResult.OK)             // Only try to add project folder if user hit ok and not cancel
            {
                var pfolderpath = dlg.SelectedPath;        // Store file path for folder user selected

                // Take given file path and get folder info to be added to file tree
                var pfolderinfo = new DirectoryInfo(pfolderpath);

                // Create file system object with the directory info
                var fileSystemObject = new FileSystemObjectInfo(pfolderinfo);

                // Changing cursor to indicate loading (Seen mostly when opening additional files)
                fileSystemObject.BeforeExplore += FileSystemObject_BeforeExplore;
                fileSystemObject.AfterExplore  += FileSystemObject_AfterExplore;

                // After loading, add file system to tree view
                treeView.Items.Add(fileSystemObject);
            }
        }
Example #10
0
        private bool SaveProjectAs(string saveName)
        {
            if (!App.MainViewModel.Valid)
            {
                MessageBoxResult result = MessageBox.Show("The project has some errors. Save anyway?", "Errors in project", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
                if (result == MessageBoxResult.Cancel)
                {
                    return(false);
                }
            }
            if (saveName == null)
            {
                projectBrowseDialog.SelectedPath = "";
                projectBrowseDialog.Description  = "Save project to directory";
                Win32Forms.DialogResult result = projectBrowseDialog.ShowDialog(win32Window);
                saveName = projectBrowseDialog.SelectedPath;
                if (saveName == "" || result == Win32Forms.DialogResult.Abort || result == Win32Forms.DialogResult.Cancel)
                {
                    return(false);
                }
            }
            RomData romData = App.MainViewModel.ToRomData();

            try
            {
                RomData.ExportToDirectory(romData, saveName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error saving project", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }
            Title            = "map2agb - " + saveName;
            lastSaveLocation = saveName;
            return(true);
        }
        private void btnBackup_Click(object sender, RoutedEventArgs e)
        {
            bool success = false;

            SetStateAsBusy();

            var dlg = new FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dlg.ShowDialog(this.GetIWin32Window());

            if (result == System.Windows.Forms.DialogResult.OK || result == System.Windows.Forms.DialogResult.Yes)
            {
                if (!string.IsNullOrEmpty(dlg.SelectedPath))
                {
                    try
                    {
                        App.DatabaseManager.BackUpDatabase(App.DatabaseConnection, dlg.SelectedPath);
                    }
                    catch
                    {
                        System.Windows.Forms.MessageBox.Show($"Problem with writing to directory { dlg.SelectedPath }, check you have write permissions to this directory", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            if (success)
            {
                System.Windows.Forms.MessageBox.Show($"{SelectedDatabaseName} successfully backed up");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show($"backup failed for {SelectedDatabaseName}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            SetStateAsFree();
        }
Example #12
0
 public void DoAfterEdit(object newValue, System.Windows.Forms.DialogResult result, string editType)
 {
     if (result != System.Windows.Forms.DialogResult.OK)
     {
         m_EditObject = null;
         return;
     }
     if (m_EditObject is System.Windows.Forms.ListViewItem)
     {
         System.Windows.Forms.ListViewItem item = m_EditObject as System.Windows.Forms.ListViewItem;
         item.Tag = newValue;
         listAddField.SmallImageList.Images.RemoveByKey(item.Name.Replace("Item", "Symbol"));
         listAddField.SmallImageList.Images.Add(item.Name.Replace("Item", "Symbol"),
                                                ModuleCommon.Symbol2Picture(newValue as ISymbol, ModuleCommon.ImageWidth, ModuleCommon.ImageHeight));
         item.ImageKey = item.Name.Replace("Item", "Symbol");
         listAddField.Refresh();
     }
     if (m_EditObject is DevComponents.DotNetBar.LabelX)
     {
         DevComponents.DotNetBar.LabelX label = m_EditObject as DevComponents.DotNetBar.LabelX;
         switch (label.Name)
         {
         case "labelPreviewBack":
             if (label.Image != null)
             {
                 label.Image.Dispose();
                 label.Image = null;
             }
             label.Tag   = newValue;
             label.Image = ModuleCommon.Symbol2Picture(newValue as ISymbol, ModuleCommon.ImageWidth, ModuleCommon.ImageHeight);
             RefreshSymbol();
             break;
         }
     }
     m_EditObject = null;
 }
        private void UploadOPCFile_Click(object sender, EventArgs e)
        {
            openOPCFile.Filter = "OPC file (*.csv)|*.csv|All files (*.*)|*.*";

            resultOPC = openOPCFile.ShowDialog();

            if (resultOPC == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    string CSVFileOnly = Path.GetFileName(openOPCFile.FileName);
                    OPCFileText.Text = CSVFileOnly;
                    validOPCFile     = CreateTagListFromIGS_OPC.checkOPCFile(openOPCFile.FileName);
                }
                catch (System.IO.FileNotFoundException fnfe)
                {
                    MessageBox.Show("File does not exist!\r\n\r\n" + fnfe.Message, "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("An Error Occured\r\n\r\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #14
0
 public System.Windows.Forms.DialogResult GuardarCambiosReducido()
 {
     try
     {
         if (this.Item != null)
         {
             ((CAJ005TransferenciasMViewSmall)MViewReducido).BringToFront();
             System.Windows.Forms.DialogResult _result = Infrastructure.WinForms.Controls.Dialogos.MostrarMensajePregunta(Title, Infrastructure.Aspect.Constants.Mensajes.SaveChangesPreguntaPresenter, Infrastructure.WinForms.Controls.Dialogos.LabelBoton.Si_No);
             if (_result == System.Windows.Forms.DialogResult.Yes)
             {
                 if (GuardarReducido(true))
                 {
                     return(System.Windows.Forms.DialogResult.Yes);
                 }
                 else
                 {
                     return(System.Windows.Forms.DialogResult.Cancel);
                 }
             }
             else
             {
                 return(_result);
             }
         }
         else
         {
             Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeInformacion(Title, "Ha ocurrido un error al cerrar el formulario.");
             return(System.Windows.Forms.DialogResult.Cancel);
         }
     }
     catch (Exception ex)
     {
         Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Title, Infrastructure.Aspect.Constants.Mensajes.SavePresenter, ex);
         return(System.Windows.Forms.DialogResult.Cancel);
     }
 }
Example #15
0
        public Dictionary <String, String> backupWallet()
        {
            Dictionary <String, String> strDict = new Dictionary <String, String>();
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "dat Files|*.dat";
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    String filename  = dialog.FileName;
                    String walletDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                                       "\\Anon\\wallet.dat";
                    File.Copy(walletDir, filename, true);
                    strDict["message"] = "Backup success";
                    strDict["result"]  = "success";
                }
                catch (Exception ex)
                {
                    strDict["message"] = ex.Message;
                    strDict["result"]  = "fail";
                }
            }
            else if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                strDict["message"] = "You've just clicked on Cancel button";
                strDict["result"]  = "fail";
            }
            else
            {
                strDict["message"] = "Please put your file location";
                strDict["result"]  = "fail";
            }
            return(strDict);
        }
Example #16
0
 private void btnBorrow_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.DialogResult dr = MessageBox.Show("Borrow?", "Borrow Book", MessageBoxButtons.YesNo);
     if (dr == System.Windows.Forms.DialogResult.Yes)
     {
         BookId = int.Parse(textBookId.Text);
         bool res = LibraryManager.AddIntoBorrowed(UserID, BookId, DateTime.Now, DateTime.Now.AddDays(2));
         if (res == true)
         {
             MessageBox.Show("Return Date :" + DateTime.Now.AddDays(2));
             this.Close();
         }
         else
         {
             MessageBox.Show("Insufficient copies. Try again later");
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Book not issued");
         this.Close();
     }
 }
Example #17
0
 public string show(string strPath, string strTitle, string strDefaultFile, int nQueMax)
 {
     if (null == fs)
     {
         fs = new frmSelect();
     }
     fs.strSelectedFileName = strDefaultFile;
     fs.Text      = strTitle;
     fs.nQueMax   = nQueMax;
     fs.strFilter = ".spr";
     fs.LoadFolder(strPath);
     System.Windows.Forms.DialogResult r = fs.ShowDialog();
     if (r == System.Windows.Forms.DialogResult.OK)
     {
         string srt = fs.strSelectedFileName;
         fs.Hide();
         return(fs.strSelectedFileName);
     }
     else
     {
         fs.Hide();
         return(null);
     }
 }
Example #18
0
 protected void save()
 {
     if (cboItem.SelectedValue.ToString() == "-1" || (txtQtyIssued.Text == string.Empty || decimal.Parse(txtQtyIssued.Text) <= 0))
     {
         MessageBox.Show("Item name or Qty Issued cannot be empty", "Inventory Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (decimal.Parse(txtQtyIssued.Text) > decimal.Parse(txtQty.Text))
     {
         MessageBox.Show("Quantity issued cannot be greater that available stock for this item", "Inventory Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         System.Windows.Forms.DialogResult dialogResult = MessageBox.Show("Are you sure you want to update stockout details for" + cbostaff.Text + "?", "Item StockOut", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
         if (dialogResult == System.Windows.Forms.DialogResult.Yes)
         {
             InventoryManager.save_item_stockout("update_item_stockout", lblstockoutid.Text, lblstockoutmainid.Text, cboItem.SelectedValue.ToString(), decimal.Parse(txtQtyIssued.Text), dtReceiveDate.Value, cbostaff.SelectedValue.ToString(), "Item StockOut", SystemConst._user_id, SystemConst._user_id, DateTime.Today);
             MessageBox.Show("Successfully Updated stock issued for this item", "Inventory Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             this.Visible = true;
         }
     }
 }
Example #19
0
        private void openGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!saved)
            {
                System.Windows.Forms.DialogResult dr = MessageBox.Show("Save this project?", "Project is not saved!", MessageBoxButtons.YesNoCancel);
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    saveGameToolStripMenuItem_Click(sender, e);
                }
                else if (dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "RemEWord files (*.rew)|*.rew";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FileName = ofd.FileName;
                OpenProject();
            }
        }
Example #20
0
        }// CheckFile

        void onBrowse(Object o, EventArgs e)
        {
            // Pop up a file dialog so the user can find an assembly
            OpenFileDialog fd = new OpenFileDialog();

            fd.Title         = CResourceStore.GetString("CGenApplications:FDTitle");
            fd.Filter        = CResourceStore.GetString("CGenApplications:FDMask");
            fd.FileOk       += new CancelEventHandler(CheckFile);
            fd.ValidateNames = false;

            System.Windows.Forms.DialogResult dr = fd.ShowDialog();
            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                String sAppFilename = fd.FileName;

                // If this is an executable or Dll, verify that it is managed
                int iLen = sAppFilename.Length;
                if (iLen > 6)
                {
                    // Check to see if they selected a config file
                    String sExtension = sAppFilename.Substring(fd.FileName.Length - 6).ToUpper(CultureInfo.InvariantCulture);

                    if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("CONFIG"))
                    {
                        // They've selected a config file. Let's see if there is an assembly around there as well.
                        String sAssemName = sAppFilename.Substring(0, fd.FileName.Length - 7);
                        if (File.Exists(sAssemName))
                        {
                            sAppFilename = sAssemName;
                        }
                    }
                }
                m_sFilename       = sAppFilename;
                this.DialogResult = DialogResult.OK;
            }
        }// onBrowse
Example #21
0
        private void TableGroup_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!blnSaveStatus)
            {
                System.Windows.Forms.DialogResult dlgResult = PCSMessageBox.Show(ErrorCode.MESSAGE_QUESTION_STORE_INTO_DATABASE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (dlgResult)
                {
                case DialogResult.Yes:
                    if (!SaveGroup())
                    {
                        e.Cancel = true;
                    }
                    break;

                case DialogResult.No:
                    e.Cancel = false;
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    break;
                }
            }
        }
Example #22
0
        private void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            WinForm.OpenFileDialog ofd = new WinForm.OpenFileDialog();
            ofd.Title    = "파일 오픈 예제창";
            ofd.FileName = "test";
            ofd.Filter   = "그림 파일 (*.jpg, *.gif, *.bmp *.png) | *.jpg; *.gif; *.bmp; *.png; | 모든 파일 (*.*) | *.*";

            WinForm.DialogResult dr = ofd.ShowDialog();

            //OK버튼 클릭시
            if (dr == WinForm.DialogResult.OK)
            {
                //File명과 확장자를 가지고 온다.
                string fileName = ofd.SafeFileName;
                //File경로와 File명을 모두 가지고 온다.
                string fileFullName = ofd.FileName;
                //File경로만 가지고 온다.
                string filePath = fileFullName.Replace(fileName, "");

                var img = new Bitmap(fileFullName);
                //Bitmap b = BitmapFromSource(img);
                //btest = img2;

                //b = Gaussian_Filtering(b, 11);

                //System.Drawing.Image i = (System.Drawing.Image)b;
                InputImage.Image    = img;
                InputImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

                //File경로 + 파일명 리턴
            }
            //취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
            else if (dr == WinForm.DialogResult.Cancel)
            {
            }
        }
Example #23
0
        private void EliminarItem()
        {
            if (dgvList.RowCount > 0)
            {
                string item = dgvList[dgvList.CurrentCell.ColumnIndex, dgvList.CurrentCell.RowIndex].Value.ToString();
                if (item != null)
                {
                    System.Windows.Forms.DialogResult resDel = MetroFramework.MetroMessageBox.Show(this.MdiParent, "¿Desea eliminar el item seleccionado?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (resDel == DialogResult.Yes)
                    {
                        App.InvMovimientoService.InvMovimiento obj = (App.InvMovimientoService.InvMovimiento)dgvList.CurrentRow.DataBoundItem;
                        bList.Remove(obj);
                        Totalizar();
                    }
                }
            }

            btnDel.Visible = false;
            if (bList.Count > 0)
            {
                btnDel.Visible = true;
            }
            Totalizar();
        }
        }// onTextChange

        //-------------------------------------------------
        // onChooseAssemClick
        //
        // This event fires when the user clicks the "Choose
        // Assembly" button. This will bring up a dialog with
        // a list of all the assemblies in the GAC, and allow
        // the user to select one of them.
        //-------------------------------------------------
        void onChooseAssemClick(Object o, EventArgs e)
        {
            CAssemblyDialog ad;

            // Choose which dialog to show
            if (m_radChooseShared.Checked)
            {
                ad = new CFusionDialog();
            }
            else
            {
                ad = new CDependAssembliesDialog(m_appDepends);
            }

            System.Windows.Forms.DialogResult dr = ad.ShowDialog();
            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                // Let's put the info we get into text boxes
                m_txtName.Text           = ad.Assem.Name;
                m_txtPublicKeyToken.Text = ad.Assem.PublicKeyToken;
                // Turn on the Finish button
                ((CWizard)CNodeManager.GetNode(m_iCookie)).TurnOnFinish(true);
            }
        }// onChooseAssemClick
Example #25
0
        public void Browse(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            string s = result.ToString();

            if (s == "OK")
            {
                string buttenName = ((System.Windows.Controls.Button)sender).Name;
                if (buttenName.Equals("browse1"))
                {
                    Path1 = dialog.SelectedPath;
                }
                if (buttenName.Equals("browse2"))
                {
                    Path2 = dialog.SelectedPath;
                }
                if (buttenName.Equals("browse4"))
                {
                    Path4 = dialog.SelectedPath;
                }
            }
        }
Example #26
0
        private void ExtractSlides_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            if (Library.SelectedItems.Count == 0)
            {
                return;
            }

            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            string temp = dialog.SelectedPath;

            foreach (SlmVignette slide in Library.SelectedItems)
            {
                string st = System.IO.Path.Combine(new string [] { temp, slide.Name + ".sld" });
                _slideLib._Slides [slide.Name].SaveAs(st);
            }
        }
Example #27
0
 private void TestFrom_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_isedited)
     {
         System.Windows.Forms.DialogResult dr = MessageBox.Show("Do you want to save changes?", "Edit Site", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         try
         {
             if (dr == System.Windows.Forms.DialogResult.Yes)
             {
                 LQTUserMessage msg = SaveOrUpdateObject();
                 ((LqtMainWindowForm)_mdiparent).ShowStatusBarInfo(msg.Message, true);
             }
             else if (dr == System.Windows.Forms.DialogResult.Cancel)
             {
                 e.Cancel = true;
             }
         }
         catch (Exception ex)
         {
             new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
             e.Cancel = true;
         }
     }
 }
Example #28
0
        private void bAcceptFind_Click(object sender, EventArgs e)
        {
            m_strFilterString = tFind.Text;
            FindEquipments(-1);
            MainGridView.ExpandAllGroups();

            if (MainGridView.RowCount == 0)
            {
                NoFindEquipmentMessageForm f = new NoFindEquipmentMessageForm();

                f.m_strMessage = "Оборудование по поиску \"" + m_strFilterString + "\" отсутствует в базе данных. Добавить оборудование?";

                if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    long id = -1;

                    PassportDataForm rf = new PassportDataForm(id);
                    rf.m_bShowContinueMsg = true;
                    System.Windows.Forms.DialogResult dr = rf.ShowDialog(this);
                    id = rf.m_id;
                    if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        RefreshGridPos(id);
                    }

                    if (rf.m_bContinueNext)
                    {
                        ShowVisualForm(id, false);
                    }
                }
                else
                {
                    tFind.Focus();
                }
            }
        }
Example #29
0
        private void AddFolder_Btn_Click(object sender, EventArgs e)
        {
            string path  = string.Empty;
            int    lines = 0;
            string old   = string.Empty;

            using (var folderBrowser = new System.Windows.Forms.FolderBrowserDialog())
            {
                System.Windows.Forms.DialogResult res = folderBrowser.ShowDialog();
                if (res == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowser.SelectedPath))
                {
                    if (Directory.GetFiles(folderBrowser.SelectedPath, "*.xlsm").Length > 0)
                    {
                        path = folderBrowser.SelectedPath;
                    }
                }
            }

            using (StreamReader sr = new StreamReader(@".\PathConfig.cfg"))
            {
                old   = sr.ReadToEnd();
                lines = old.Trim().Split('\n').Length;
                sr.Close();
            }

            using (StreamWriter sw = new StreamWriter(@".\PathConfig.cfg"))
            {
                sw.Write(old);
                if (path != string.Empty)
                {
                    sw.WriteLine($"Dir{lines} = \"{path}\" ");
                }
                sw.Close();
            }
            directories = ReadConfig();
        }
Example #30
0
        private void ResourceColorGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            // Grab the fields we'll want to push
            MSProject.PjField fieldId;
            Color             defaultColor;

            if (e.ColumnIndex == ColorColumn.Index)
            {
                fieldId      = Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceColorField, MSProject.PjFieldType.pjResource);
                defaultColor = Color.White;
            }
            else if (e.ColumnIndex == BorderColorColumn.Index)
            {
                fieldId      = Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceBorderColorField, MSProject.PjFieldType.pjResource);
                defaultColor = Color.Black;
            }
            else
            {
                return;
            }
            // Find the res
            MSProject.Resource res =
                Globals.ThisAddIn.Application.ActiveProject.Resources[this.ResourceColorGrid.Rows[e.RowIndex].Cells[NameColumn.Index].Value];
            this.colorDialog.Color = Globals.ThisAddIn.stringToColor(res.GetField(fieldId), defaultColor);
            // Set the value
            System.Windows.Forms.DialogResult result = this.colorDialog.ShowDialog();
            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            Color c = this.colorDialog.Color;

            this.ResourceColorGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor          = c;
            this.ResourceColorGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.SelectionBackColor = c;
            res.SetField(fieldId, String.Format("{0:X2} {1:X2} {2:X2}", c.R, c.G, c.B));
        }
Example #31
0
        private void button13_Click(object sender, RoutedEventArgs e)
        {
            string folderPath = "";

            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                dialog.SelectedPath = (@"C:\work\temp\results");
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(dialog.SelectedPath))
                {
                    //System.IO.Directory.CreateDirectory(@"C:\work\temp\images\simple\simple\simple3");

                    //StringBuilder builder = new StringBuilder();

                    //DirectoryInfo d = new DirectoryInfo(dialog.SelectedPath);
                    //FileInfo[] infos = d.GetFiles();

                    //foreach (FileInfo f in infos)
                    //{
                    //    builder.Append(@"C:\work\temp\images\simple\simple\simple3\").Append(GetUntilOrEmpty(f.Name)).Append(".jpg");
                    //    File.Move(f.FullName, builder.ToString());
                    //    builder.Clear();
                    //}

                    folderPath = dialog.SelectedPath;
                    MLApp.MLApp matlab       = new MLApp.MLApp();
                    object      matlabResult = null;

                    string[] fileEntries = Directory.GetFiles(@"..\..\MATLAB");

                    matlab.Execute(@"cd C:\Tracking\Images");

                    matlab.Feval("fileRename", 0, out matlabResult, folderPath, "simple", "_");
                }
            }
        }
Example #32
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();

            op.Title  = "Select a picture";
            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                        "Portable Network Graphic (*.png)|*.png";
            System.Windows.Forms.DialogResult result = op.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                Image imgPhoto = new Image
                {
                    Width  = 600,
                    Height = 300,
                    Source = new BitmapImage(new Uri(op.FileName)),
                };
                inkCanvas1.Children.Add(imgPhoto);
            }
            else
            {
                MessageBox.Show("Something wrong");
            }
        }
Example #33
0
        //所有Sheet合并成1个-horizontal
        void AllInOneSheet_horizontal()
        {
            bool firstRowIsHead = true;

            if (!checkBox_firstrowishead.Checked)
            {
                firstRowIsHead = false;
            }
            System.Windows.Forms.OpenFileDialog fileDialog = new System.Windows.Forms.OpenFileDialog();
            fileDialog.Multiselect = true;
            System.Windows.Forms.DialogResult result = fileDialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string   basestr        = string.Empty;
                string   targetfilename = string.Empty;
                string[] filenames      = fileDialog.FileNames;
                basestr        = filenames[0];
                targetfilename = basestr.Substring(0, basestr.LastIndexOf("\\") + 1) + "AllInOneSheet-horizontal.xlsx";
                string    targetsheet = "Sheet1";
                DataTable allDt       = new DataTable();
                for (int i = 0; i < filenames.Length; i++)
                {
                    ExcelEdit ee = new ExcelEdit();
                    ee.Open(filenames[i]);
                    StringCollection sc = ee.ExcelSheetNames(filenames[i]);
                    ee.Close();
                    for (int j = 0; j < sc.Count; j++)
                    {
                        DataTable dt = ExcelUtil.ExcelToDataTable(sc[j].Substring(0, sc[j].Length - 1), firstRowIsHead, filenames[i], false);
                        //合并datatable
                        allDt = DataTableHelper.UniteDataTable(allDt, dt, "");
                    }
                }
                ExcelUtil.DataTableToExcel(allDt, targetsheet, true, targetfilename, null);
            }
        }
Example #34
0
        private void tsbtnLogOut_Click(object sender, EventArgs e)
        {
            var result = new System.Windows.Forms.DialogResult();
            result = MessageBox.Show("Вы уверены, что желаете выйти из учетной записи?", "FMDb: Выход из учетной записи",
                          MessageBoxButtons.YesNo,
                          MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                appendText = DateTime.Now.ToString() + ": пользователь " + login + " вышел из учетной записи.\n";
                File.AppendAllText(path, appendText, Encoding.UTF8);
                adm = false;
                login = "";
                this.Hide();
                frmLogIn newLog = new frmLogIn();
                newLog.Show();

            }
        }
Example #35
0
        private bool powercycleFlow()
        {
            bool blnIsValid = false;
            bool isValid = false;
            RouterMessageBox MsgBox;
            string Title = Globals.ProductName;
            Dictionary<string, string[]> dictMsgs = new Dictionary<string, string[]>();
            DialogResult resWinsoc = new System.Windows.Forms.DialogResult();

            dictMsgs.Add("msg1", new string[] { "Verify the Physical Connection"
                            , "The ethernet cable from the modem should be connected to the Internet (Yellow color) port  on the router.  The Computer should be connected to any one of the other 4 LAN ports on the router." });

            dictMsgs.Add("msg2", new string[] { "Verify the Physical Connection"
                            , "Ensure that the Ethernet cable is firmly connected at both the ends" });

            dictMsgs.Add("msg3", new string[] { "Verify the Physical Connection", "Connect the computer to one of the other LAN ports on the router." });
            dictMsgs.Add("msg4", new string[] { "Disable and Enable the LAN Adapter", "Ethernet adapter is being disabled and enabled automatically during this time. Please wait..." });
            dictMsgs.Add("msg5", new string[] { "Power cycle the router", "Unplug only the power cable from the router and connect it back after 30 Seconds...Please click on the OK button after 30 seconds, when you connect the power cable back to the NETGEAR router..." });
            dictMsgs.Add("msg6", new string[] { "Performing Winsock Reset", "Our tool is performing Winsock reset at the movement.  Please wait..." });
            dictMsgs.Add("msg7", new string[] { "Reset the NETGEAR router", "Take a Pen or a Paper clip and push it into the reset button (Mostly the reset button will be in the rear side) of the NETGEAR router. Release the Pen or Paper clip from the reset button, if you have seen the power light blinking in amber for 3 to 4 times(while you perform the reset)." + Environment.NewLine + "Your approximate reset time might take 20 to 30 seconds, during this process. Please click on the OK button below, after you have performed a hard reset to the NETGEAR router..." });
            dictMsgs.Add("msg8", new string[] { "Contact Technical Support", "Contact Technical Support (888-NETGEAR) or (888-638-4327)" });
            MsgBox = RouterMessageBox.Instance;


            string notConnectedCaption = "Changed the Physical" + Environment.NewLine + " Connections now";

            if (MsgBox.Show(dictMsgs["msg5"][1], dictMsgs["msg5"][0], MessageBoxButtons.OK, "Ok") == DialogResult.OK)
            {
                RouterMessageBox.Instance.Show("Please wait while the router is powering on...This might take approximately 2 minutes...", "Power cycle your network", 120);
                //if (!isValid)
                if (!IsValidIP())
                {
                    resWinsoc = MsgBox.Show(dictMsgs["msg6"][1], dictMsgs["msg6"][0], MessageBoxButtons.YesNo, null, "Ok", "Skip");
                    //if (MsgBox.Show(dictMsgs["msg6"][1], dictMsgs["msg6"][0], MessageBoxButtons.OK) == DialogResult.OK)
                    if (resWinsoc == DialogResult.Yes || resWinsoc == DialogResult.No)
                    {
                        if (resWinsoc == DialogResult.Yes)
                        {
                            ExecuteCommandSync("netsh winsock reset");
                        }
                        //if (!isValid)
                        if (!IsValidIP())
                        {

                            if (MsgBox.Show(dictMsgs["msg7"][1], dictMsgs["msg7"][0], MessageBoxButtons.OK, "Ok") == DialogResult.OK)
                            {
                                RouterMessageBox.Instance.Show("Please wait while the NETGEAR router is powering on after the hard reset. This might take approximately 2 minutes...", "Router is rebooting after reset", 120);
                                //if (!isValid)
                                if (!IsValidIP())
                                {
                                    if (MsgBox.Show(dictMsgs["msg8"][1], dictMsgs["msg8"][0], MessageBoxButtons.OK) == DialogResult.OK)
                                    {
                                        // isValipIp = true;
                                        sbRouter.AppendLine("Contact Customer Support.");
                                    }
                                }
                                else
                                {
                                    blnIsValid = true;
                                }

                            }
                        }
                        else
                        {
                            blnIsValid = true;
                        }
                    }
                }
                else
                {
                    blnIsValid = true;
                }
            }
            return blnIsValid;
        }
Example #36
0
        private void tsbtnDel_Click(object sender, EventArgs e)
        {
            var result = new System.Windows.Forms.DialogResult();
            result = MessageBox.Show("Вы уверены, что желаете удалить эту запись?", "FMDb: Удаление ",
                          MessageBoxButtons.YesNo,
                          MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                if (dataGridView1.SelectedCells.Count == 6)
                {
                    SqlConnection conn = null;
                    String query = "DELETE Film WHERE [IDMovie]='{0}'";
                    try
                    {
                        conn = new SqlConnection(ConnectionString);
                        conn.Open();
                        using (var cmd = conn.CreateCommand())
                        {
                            cmd.CommandType = CommandType.Text;
                            cmd.CommandText = string.Format(query, dataGridView1.SelectedCells[0].Value.ToString());
                            cmd.ExecuteNonQuery();
                        }
                        appendText = DateTime.Now.ToString() + ": пользователь " + login + " удалил фильм " + dataGridView1.SelectedCells[1].Value.ToString() + ".\n";
                        File.AppendAllText(path, appendText, Encoding.UTF8);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Ошибка!");
                    }
                    finally
                    {
                        conn.Close();
                        this.filmTableAdapter.Fill(this.fMDbDataSet.Film);
                        string[] idfilm = new string[35];
                        SqlConnection sconn = new SqlConnection(ConnectionString);
                        using (sconn)
                        {
                            sconn.Open();
                            SqlCommand scommand = new SqlCommand();
                            scommand.Connection = sconn;
                            scommand.CommandText = @"SELECT [IDf] from [View] where [Log]= '" + login+"'";
                            SqlDataReader dr = scommand.ExecuteReader();
                            int i = 0;
                            while (dr.Read())
                            {
                                idfilm[i] = dr[0].ToString();
                                i++;
                            }
                            dr.Close();
                        } sconn.Close();
                        for (int i = 0; i < 35; i++)
                        {
                            if (idfilm != null)
                            {
                                if (idfilm[i] != null)
                                {
                                    int j = 0;
                                    while (dataGridView1.Rows[j].Cells[0].Value.ToString() != idfilm[i])
                                    { j++; }
                                    dataGridView1.Rows[j].Cells[5].Value = true;
                                }

                            }
                        }
                    }
                }

            }
        }
Example #37
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            #region ------------- Delete -------------
            if (e.ColumnIndex == 6)
            {
                string str_msg;
                int int_result = 0;
                DialogResult DLR_Message = new System.Windows.Forms.DialogResult();

                str_msg = "You are about to Delete Pallet Number ";
                str_msg = str_msg + dataGridView1.Rows[e.RowIndex].Cells["PalletDetails_Id"].Value.ToString();
                str_msg = str_msg + " and its contents " + Environment.NewLine;
                str_msg = str_msg + "Do you want to continue?";
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (DLR_Message == DialogResult.Yes)
                {
                    int_result = FruPak.PF.Data.AccessLayer.PF_Pallet_Details.Delete(Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells["PalletDetails_Id"].Value.ToString()));

                }
                if (int_result > 0)
                {
                    lbl_message.ForeColor = System.Drawing.Color.Blue;
                    lbl_message.Text = "Pallet Details" + dataGridView2.Rows[e.RowIndex].Cells["PalletDetails_Id"].Value.ToString() + " has been Deleted";
                }
                else
                {
                    lbl_message.ForeColor = System.Drawing.Color.Red;
                    lbl_message.Text = "Pallet Details" + dataGridView2.Rows[e.RowIndex].Cells["PalletDetails_Id"].Value.ToString() + " failed to be Deleted";
                }
                populate_datagridview2();


            }
            #endregion
            #region ------------- Edit -------------
            else if (e.ColumnIndex == 7)
            {
                int_DVG_Row_id = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString());
                cmb_Material.SelectedValue = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[3].Value.ToString());
                cmb_Batch1.SelectedItem = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[2].Value.ToString().Substring(8));
                nud_Quantity1.Value = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[5].Value.ToString());

                lbl_Location.Visible = false;
                cmb_Location.Visible = false;
                lbl_Pallet_Type.Visible = false;
                cmb_Pallet_Type.Visible = false;

                cmb_Batch2.Visible = false;
                nud_Quantity2.Visible = false;
                cmb_Batch3.Visible = false;
                nud_Quantity3.Visible = false;

                btn_Add.Text = "&Update Batch";
            }
            #endregion
        }
Example #38
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int int_result = 0;
            #region ------------- Print -------------
            if (e.ColumnIndex == 8)
            {

                Cursor = Cursors.WaitCursor;
                FruPak.PF.Common.Code.General.Get_Printer("A4");
                FruPak.PF.PrintLayer.Pallet_Card.Print(dataGridView1.Rows[e.RowIndex].Cells["Barcode"].Value.ToString(), true, int_Current_User_Id);
                FruPak.PF.Data.AccessLayer.PF_Pallet.Update_For_PCard(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString()), true, int_Current_User_Id);
                Cursor = Cursors.Default;
                #region ------------- print and cleanup -------------
                //Clean Up

                // Modified for alterable path setting via config file. We do not approve of hardcoded strings. 12-01-2015 BN
                //lst_filenames.AddRange(System.IO.Directory.GetFiles(@"\\FRUPAK-SBS\PublicDocs\FruPak\Server\Temp", "*" + dataGridView1.Rows[e.RowIndex].Cells["Barcode"].Value.ToString() + "*", System.IO.SearchOption.TopDirectoryOnly));

                string tempPath = Settings.Path_Printer_Temp;
                lst_filenames.AddRange(System.IO.Directory.GetFiles(tempPath, "*" + dataGridView1.Rows[e.RowIndex].Cells["Barcode"].Value.ToString() + "*", System.IO.SearchOption.TopDirectoryOnly));

                foreach (string filename in lst_filenames)
                {
                    File.Delete(filename);
                }
                #endregion
            }
            #endregion
            #region ------------- Delete -------------
            else if (e.ColumnIndex == 9)
            {
                string str_msg;
                DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
                str_msg = "You are about to Delete Pallet Number ";
                str_msg = str_msg + dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString();
                str_msg = str_msg + " and its contents " + Environment.NewLine;
                str_msg = str_msg + "Do you want to continue?";
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (DLR_Message == DialogResult.Yes)
                {
                    int_result = FruPak.PF.Data.AccessLayer.PF_Pallet_Details.Delete_Pallet(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString()));
                    int_result = FruPak.PF.Data.AccessLayer.PF_Pallet.Delete(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString()));

                }
                if (int_result > 0)
                {
                    lbl_message.ForeColor = System.Drawing.Color.Blue;
                    lbl_message.Text = "Pallet " + dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString() + " has been Deleted";
                }
                else
                {
                    lbl_message.ForeColor = System.Drawing.Color.Red;
                    lbl_message.Text = "Pallet " + dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString() + " failed to be Deleted";
                }
                populate_datagridview();
            }
            #endregion
            #region ------------- Edit -------------
            else if (e.ColumnIndex == 10)
            {
                int_DVG_Row_id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
                cmb_Pallet_Type.SelectedValue = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());
                cmb_Location.SelectedValue = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString());
                btn_Add.Text = "&Update";
            }
            #endregion
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
            int int_result = 0;

            string str_msg = "";
            //no date or time load
            if (dtp_start_date.Value.Date == dtp_finish_date.Value.Date && dtp_start_time.Value.ToLocalTime() == dtp_finish_time.Value.ToLocalTime())
            {
                str_msg = str_msg + "Invalid date and time. Please enter valid Start and Finsih dates and times." + Environment.NewLine;
            }
            // Finish date must be after start date
            else if (dtp_start_date.Value.Date > dtp_finish_date.Value.Date)
            {
                str_msg = str_msg + "Invalid Start and Finsh Dates. You can not finsh before you start. " + Environment.NewLine;
            }
            // start and finsh on same day, finish time must be after start time
            else if (dtp_start_date.Value.Date == dtp_finish_date.Value.Date)
            {
                if (((dtp_start_time.Value.Hour * 360) + (dtp_start_time.Value.Minute * 60) + dtp_start_time.Value.Second) > ((dtp_finish_time.Value.Hour * 360) + (dtp_finish_time.Value.Minute * 60) + dtp_finish_time.Value.Second))
                {
                    str_msg = str_msg + "Invalid Start and Finsh Times. You can not finsh before you start. " + Environment.NewLine;
                }
            }

            if (str_msg.Length > 0)
            {
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (DLR_Message != System.Windows.Forms.DialogResult.OK)
            {
                switch (btn_Add.Text)
                {
                    case "&Add":
                        int_result = FruPak.PF.Data.AccessLayer.PF_Process_Setup.Insert(FruPak.PF.Common.Code.General.int_max_user_id("PF_Process_Setup"), Convert.ToInt32(cmb_Staff.SelectedValue.ToString()), dtp_start_date.Value.ToString("yyyy/MM/dd"),
                                                                                    dtp_start_time.Value.Hour.ToString() + ":" + dtp_start_time.Value.Minute.ToString() + ":" + dtp_start_time.Value.Second.ToString(), dtp_finish_date.Value.ToString("yyyy/MM/dd"),
                                                                                    dtp_finish_time.Value.Hour.ToString() + ":" + dtp_finish_time.Value.Minute.ToString() + ":" + dtp_finish_time.Value.Second.ToString(), txt_comments.Text, int_Current_User_Id);
                        break;
                    case "&Update":
                        int_result = FruPak.PF.Data.AccessLayer.PF_Process_Setup.Update(int_dvg_Cell0, Convert.ToInt32(cmb_Staff.SelectedValue.ToString()), dtp_start_date.Value.ToString("yyyy/MM/dd"),
                                                                                    dtp_start_time.Value.Hour.ToString() + ":" + dtp_start_time.Value.Minute.ToString() + ":" + dtp_start_time.Value.Second.ToString(), dtp_finish_date.Value.ToString("yyyy/MM/dd"),
                                                                                    dtp_finish_time.Value.Hour.ToString() + ":" + dtp_finish_time.Value.Minute.ToString() + ":" + dtp_finish_time.Value.Second.ToString(), txt_comments.Text, int_Current_User_Id);

                        break;
                }
            }
            if (int_result > 0)
            {
                switch (btn_Add.Text)
                {
                    case "&Add":
                        lbl_message.Text = "Staff Time has been added";
                        break;
                    case "&Update":
                        lbl_message.Text = "Staff Time has been updated";
                        break;
                }

                lbl_message.ForeColor = System.Drawing.Color.Blue;
                populate_datagridview();
                Reset();
            }
            else
            {
                lbl_message.Text = "Staff Time failed to be added/update";
                lbl_message.ForeColor = System.Drawing.Color.Red;
            }
        }
Example #40
0
 private void BtnCancel_Click(object sender, System.EventArgs e)
 {
     TabsProperty.CancelChanges();
     Result = DialogResult.Cancel;
     this.Close();
 }
Example #41
0
        private void BtnOK_Click(object sender, System.EventArgs e)
        {
            if (TabsProperty.CanSaveChanges() == false)
            {
                Trace.WriteLine("Apply: Could not save changes", "UI");
                return;

            }

            TabsProperty.SaveChanges();
            Result = DialogResult.OK;
            this.Close();
        }
Example #42
0
 //добавление нового проекта
 private void button_AddPr_Click(object sender, EventArgs e)
 {
     if (button_Pr5.Visible != true)
     {
         var result = new System.Windows.Forms.DialogResult();
         result = MessageBox.Show("Добавить новый проект?", "Добавление проекта",
                       MessageBoxButtons.YesNo,
                       MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             if (button_Pr2.Visible == false)
             {
                 button_Pr2.Visible = true;
                 _prjTabNo = 2;
                 _countOfPrj = "2";
                 _prjARMCountTemp[_prjTabNo] = "1";
                 projectTab();
             }
             else if (button_Pr3.Visible == false)
             {
                 button_Pr3.Visible = true;
                 _prjTabNo = 3;
                 _countOfPrj = "3";
                 _prjARMCountTemp[_prjTabNo] = "1";
                 projectTab();
             }
             else if (button_Pr4.Visible == false)
             {
                 button_Pr4.Visible = true;
                 _prjTabNo = 4;
                 _countOfPrj = "4";
                 _prjARMCountTemp[_prjTabNo] = "1";
                 projectTab();
             }
             else if (button_Pr5.Visible == false)
             {
                 button_Pr5.Visible = true;
                 _prjTabNo = 5;
                 _countOfPrj = "5";
                 _prjARMCountTemp[_prjTabNo] = "1";
                 projectTab();
             }
         }
     }
 }
        private void btn_View_Click(object sender, EventArgs e)
        {
            string str_msg = "";
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();

            FruPak.PF.PrintLayer.Word.FilePath = FruPak.PF.Common.Code.General.Get_Single_System_Code("PF-TPPath");

            Cursor = Cursors.WaitCursor;
            str_msg = Create_PDF_Defaults("View", Convert.ToInt32(dataGridView1.CurrentRow.Cells["Invoice_Id"].Value.ToString()), dataGridView1.CurrentRow.Cells["Invoice_Date"].Value.ToString(), dataGridView1.CurrentRow.Cells["Order_Num"].Value.ToString());
            Cursor = Cursors.Default;

            FireHistoryMessage("View Button Clicked: " + str_msg);

            if (str_msg.Length > 0)
            {
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Invoice Search(View)", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (DLR_Message != DialogResult.OK)
            {
                foreach (string view_file in FruPak.PF.PrintLayer.General.view_list)
                {
                    FruPak.PF.Common.Code.General.Report_Viewer(FruPak.PF.PrintLayer.Word.FilePath + "\\" + view_file);
                }
            }
        }
Example #44
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
            string str_msg = "";
            int int_result = 0;

            //Print
            #region ------------- Print -------------
            if (e.ColumnIndex == 12)
            {
                string Data = "";
                Data = "S:" + dataGridView1.CurrentRow.Cells["Submission_Id"].Value.ToString() + ":" + Convert.ToBoolean(ckb_Print_all.Checked) ;

                string curent_printer = System.Printing.LocalPrintServer.GetDefaultPrintQueue().FullName.ToString();
                string str_req_Printer = FruPak.PF.Common.Code.General.Get_Single_System_Code("PR-Bincrd");
                foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
                {
                    try
                    {
                        if (printer.IndexOf(str_req_Printer) > 0)
                        {
                            FruPak.PF.PrintLayer.Word.Printer = printer;
                            myPrinters.SetDefaultPrinter(FruPak.PF.PrintLayer.Word.Printer);
                        }
                    }
                    catch
                    {
                        myPrinters.SetDefaultPrinter(curent_printer);
                    }
                }

                FruPak.PF.PrintLayer.Bin_Card.Print(Data, true);
                myPrinters.SetDefaultPrinter(curent_printer);
             }
            #endregion
            //Delete
            #region ------------- Delete -------------
            else if (e.ColumnIndex == 13)
            {
                str_msg = "You are about to delete Submission Number " + dataGridView1.Rows[e.RowIndex].Cells["Submission_Id"].Value.ToString() + Environment.NewLine;
                str_msg = str_msg + "Do you want to continue?";
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - GateHouse(Submission)", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (DLR_Message == DialogResult.Yes)
                {
                    int_result = FruPak.PF.Data.AccessLayer.CM_Bins.Delete_Submission(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Submission_Id"].Value.ToString()));
                    int_result = FruPak.PF.Data.AccessLayer.GH_Submission.Delete(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Submission_Id"].Value.ToString()));
                }
                if (int_result > 0)
                {
                    lbl_message.ForeColor = System.Drawing.Color.Blue;
                    lbl_message.Text = "Submission Number " + dataGridView1.Rows[e.RowIndex].Cells["Submission_Id"].Value.ToString() + " has been deleted";
                    populate_DataGridView1();
                }
                else
                {
                    lbl_message.ForeColor = System.Drawing.Color.Red;
                    lbl_message.Text = "Submission Number " + dataGridView1.Rows[e.RowIndex].Cells["Submission_Id"].Value.ToString() + " failed to delete";
                }
            }
            #endregion
            //Edit
            #region ------------- Edit -------------
            else if (e.ColumnIndex == 14)
            {
                    int_new_Sub_Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Submission_Id"].Value.ToString());
                    cmb_Trader.SelectedValue = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Trader_Id"].Value.ToString());

                    //get orchardist Id
                    DataSet ds = FruPak.PF.Data.AccessLayer.CM_Grower.Get_Orchardist(Convert.ToInt32(dataGridView1.CurrentRow.Cells["Grower_Id"].Value.ToString()));
                    DataRow dr;

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        dr = ds.Tables[0].Rows[i];
                        grower1.Orchardist_Id = Convert.ToInt32(dr["Orchardist_Id"].ToString());
                    }

                    ds.Dispose();

                    grower1.Grower_Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Grower_Id"].Value.ToString());


                    cmb_Block.SelectedValue = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Block_Id"].Value.ToString());

                    dtp_Sub_Date.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["Sub_Date"].Value.ToString());
                    dtp_Harvest_Date.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["Harvest_Date"].Value.ToString());
                    nud_Pick_Num.Value = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["Pick_Num"].Value.ToString());
                    txt_Comments.Text = dataGridView1.CurrentRow.Cells["Comments"].Value.ToString();
                    txt_Grower_Ref.Text = dataGridView1.CurrentRow.Cells["Grower_Reference"].Value.ToString();

                    btn_Add.Text = "&Update";
            }
            #endregion
        }
Example #45
0
 private void clearActivatedButton_Click(object sender, EventArgs e)
 {
     if (activatedGridView.RowCount == 0)
         return;
     var result = new System.Windows.Forms.DialogResult();
     result = MessageBox.Show("Do you really want to remove all activation information?", "Activation information remover!",
                     MessageBoxButtons.YesNo,
                     MessageBoxIcon.Question);
     if (result == DialogResult.Yes)
     {
         recordsManager.clearAllActivated();
         xmlManager.removeAllActivated();
     }
 }
Example #46
0
        /*
            private void MediaPlayer_ErrorEvent(object sender, System.EventArgs e)
            {

               // AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
            {
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;
                //AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_EndOfStream(object sender, AxWMPLib._WMPOCXEvents_EndOfStreamEvent e)
            {
                try
                {

                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;

                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
            {
                HeadSpeedCount = 0;
                ReverseTimer.Enabled = false;
                ForwardTimer.Enabled = false;
                //if(e.newState == e.oldState) return;

                switch(e.newState)
                {
                    case 0:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnReverse.ForeColor = Color.Black;
                        btnForward.ForeColor = Color.Black;
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;

                        break;
                    case 1:

                        btnPause.ForeColor = System.Drawing.Color.Red;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = true;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 2:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                    case 5:
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;
                        break;
                }
            }

            */
        private void tbActionBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            if(e.Button == tbActionBar.Buttons[0])
            {
                switch(e.Button.Text)
                {
                    case "Add User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode.Tag;
                                PassOysterData POD = new PassOysterData();
                                POD.CurrentSection = g_objSection;
                                POD.CurrentUser = LoginUser;
                                POD.OSystem = OSystem;

                                AddUsersDialog1 AUD = new AddUsersDialog1();
                                AUD.Tag = POD;
                                DialogResult DR = AUD.ShowDialog(this);
                                POD = (PassOysterData)AUD.Tag;
                                AUD.Dispose();
                                if(DR == DialogResult.Abort)
                                {
                                    MessageBox.Show("An error has occurred attempting to open AddUsersDialog!");
                                    return;
                                }
                                else if(DR == DialogResult.OK)
                                {

                                    if(POD.NumMessages != 0)
                                    {
                                        string Display_Errors = "";
                                        foreach(string err_msg in POD.sMessage)
                                        {
                                            if(err_msg != "")
                                                Display_Errors += "\n" + "System Error! Failed to Add User: "******"One or more Users failed to be Added to Group! These Users may have been deleted by another party...");
                                    }
                                    if(POD.IsSuccess == true)
                                    {
                                        LoginUser = OSystem.Refresh();
                                        BuildUserHierarchy();
                                    }
                                }
                            }
                        }
                        break;

                    case "Edit User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.User)
                            {
                                UserWizard UW = new UserWizard();
                                UW.Tag = XNode.Tag;
                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }

                        }
                        break;
                    case "Create New User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is string)
                            {
                                UserWizard UW = new UserWizard();

                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                        break;
                    case "View Recording":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Recording)
                            {
                                g_objRecording = (OysterClassLibrary.Recording)XNode.Tag;
                                ShowDisplay(ShowRecordingInfo);
                                CurrentPlayingRecording = g_objRecording;
                                btnPlay.Enabled = false;

                                //						MediaPlayer.Height = 512;
                                //						MediaPlayer.Width = 696;
                                //						MediaPlayer.Location  = new System.Drawing.Point(pnlRecordingInfo.Location.X + 28, pnlRecordingInfo.Location.Y + 53);

                                OysterClassLibrary.VideoStorageServer VSS =  OSystem.GetVideoStorageServerById(g_objRecording.VideoStorageServerID);
                                string sRecording = "";
                                if(VSS.ControlAddress != "Not Assigned")
                                {
                                    OysterClassLibrary.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;

                                    bool UsePort = Convert.ToBoolean(VST["UsePort"]);
                                    string StreamHeader = (string)VST["StreamHeader"];
                                    string VSS_Directory = VSS.StorageDirectory;//(string)VST["OysterSourceDirectory"];
                                    if(VSS_Directory != "")
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else if(UsePort == true)
                                        sRecording = StreamHeader + VSS.ControlAddress + ":" + VSS.ControlPort + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + g_objRecording.Description;
                                }
                                else
                                    sRecording = "d://" + g_objRecording.Description;
                                try
                                {
                                    WWWW.Open(sRecording);
                                    // MediaPlayer.URL = sRecording;
                                    //frmPlayer fP = new frmPlayer();
                                    //fP.sURL = sRecording;
                                    //fP.Show();
                                    gLastRecording = sRecording;
                                    //MediaPlayer.Ctlcontrols.play();
                                    //btnPlay_Click(btnPlay,new EventArgs());

                                }
                                catch(Exception Err)
                                {
                                    MessageBox.Show(Err.Message + ":" + Err.InnerException);
                                }

                                // btnPlay.Enabled = true;
                            }
                        }
                        break;
                    case "View Camera":
                        if(tvCameras.SelectedNode != null)
                        {
                            TreeNode XNode = tvCameras.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                            {
                                OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;
                                string sURL = "";
                                switch(SE.StreamingHeader.ToLower())
                                {
                                    case "vbricksys://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();

                                        break;
                                    case "vbrick://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();
                                        break;
                                    default:
                                        MessageBox.Show("System not able to read header: '" + SE.StreamingHeader + "' at this time");
                                        return;
                                        break;
                                }
                                //								CameraPlayer.URL = sURL;
                                //								CameraPlayer.Ctlcontrols.play();
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[2])
            {
                switch(e.Button.Text)
                {
                    case "Record Scene":
                        TreeNode RSNode = tvCameras.SelectedNode;

                        if(RSNode.Tag is OysterClassLibrary.Room)
                        {
                            OysterClassLibrary.Room RM = (OysterClassLibrary.Room)RSNode.Tag;

                            frmRecordScene RC = new frmRecordScene();
                            RC.ThisRoom = RM;

                            DialogResult DR = RC.ShowDialog(this);
                            if(DR == DialogResult.Abort)
                            {
                                //MessageBox.Show("Detected Abort");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                //MessageBox.Show("Detected OK");
                            }
                        }
                        break;
                    case "Control Camera":
                        TreeNode XNode = tvCameras.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                        {
                            OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;

                            frmCameraControl CC = new frmCameraControl();
                            CC.CodecAddress = SE.ControlAddress;
                            CC.CodecPort = SE.ControlPort;

                            CC.ShowDialog(this);
                        }

                        break;
                    case "Delete User(s)":
                        DialogResult DR2 = new DialogResult();

                        DR2 = MessageBox.Show(this,"You have the authority to permanently delete any User in the System! For each User that you delete all of that User's Recordings will also be permanently deleted!","Show Delete User(s) Screen?",MessageBoxButtons.YesNo);
                        if(DR2 == DialogResult.No)
                            return;
                        Status(g_objUser.Description + " is preparing to delete users....");
                        Form RU = new RemoveUsers();

                        g_OAU.AllUsers = OSystem.CurrentSystemUsers;
                        g_OAU.CurrentUser = LoginUser;
                        g_OAU.CurrentBody = null;
                        g_OAU.ThisCurrentSectionType = LoginUser.HighestAuthorityLevel;
                        g_OAU.TrueDelete = true;

                        RU.Tag = g_OAU;
                        RU.ShowDialog(this);

                        if(RU.DialogResult == DialogResult.OK)
                        {
                            AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU.Tag;
                            foreach(string sUser in UL.DeletedUsers)
                                Status("Permanently deleted User: "******" has aborted Delete User operation.");
                            RU.Dispose();
                        }
                        break;
                    case "Remove User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode2 = treeView1.SelectedNode;
                            if(XNode2.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode2.Tag;
                                DialogResult DR3 = new DialogResult();

                                OysterClassLibrary.SectionType UT = OSystem.GetSectionTypeById(g_objSection.CreatedBySectionType.NextSectionTypeID);

                                DR3 = MessageBox.Show(this,"You have the authority to remove any " + UT.Description  + " in this " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + ". For each " + UT.Description  + " that you delete all of that " + UT.Description  + "'s recordings will also be permanently deleted!","Show Delete " + UT.Description  + "(s) Screen?",MessageBoxButtons.YesNo);
                                if(DR3 == DialogResult.No)
                                    return;

                                Form RU2 = new RemoveUsers();

                                g_OAU.AllUsers = null;
                                g_OAU.CurrentUser = null;
                                g_OAU.CurrentBody = g_objSection;
                                g_OAU.ThisCurrentSectionType = g_objSection.CreatedBySectionType;
                                g_OAU.TrueDelete = false;
                                g_OAU.iLocalMBSAddress = LocalIpAddress;

                                RU2.Tag = g_OAU;

                                RU2.ShowDialog(this);

                                if(RU2.DialogResult == DialogResult.OK)
                                {
                                    AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU2.Tag;
                                    foreach(string sUser in UL.DeletedUsers)
                                        Status("Removed User: "******" has aborted Remove User operation.");
                                    RU2.Dispose();
                                }
                            }
                        }
                        break;
                    case "Reassign Recording":
                        AdministrativeSoftware.PassRecordingInfo PRI= new AdministrativeSoftware.PassRecordingInfo();

                        ListView lvMember = new ListView();

                        OysterClassLibrary.Section B = OSystem.GetSectionById(g_objRecording.CurrentSectionID);

                        PRI.objSectionType = CurrentSectionType;
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections;//F.GetMemberSections(LoginUser.ID,false);
                        if(PRI.objSectionType == null)
                            PRI.objSectionType = HighestSectionType;
                        F.Dispose();
                        //Check to See if B is in LoginUsers Hierarchy
                        if(!B.IsMember)
                        {
                            ListView lvCheckEm = new ListView();
                            if(B.IsDefault)
                            {
                                foreach(OysterClassLibrary.Section TSection in LoginUser.AllOwnedSections)
                                {
                                    if(!TSection.IsDefault)
                                    {
                                        bool AddToMe = true;
                                        foreach(ListViewItem LVIK in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                            if(lvMSection.ID == TSection.ID)
                                            {
                                                AddToMe = false;
                                                break;
                                            }
                                        }
                                        if(AddToMe)
                                        {
                                            ListViewItem LVAM = lvMember.Items.Add(TSection.Description);
                                            LVAM.Tag = TSection;
                                        }
                                    }
                                }
                            }

                            foreach(OysterClassLibrary.Section MySection in LoginUser.AllOwnedSections)
                            {
                                if((!MySection.IsDefault)&&(MySection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID))

                                {
                                    bool AddToMe = true;
                                    foreach(ListViewItem LVJK in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVJK.Tag;

                                        if(lvMSection.ID == MySection.ID)
                                        {
                                            AddToMe = false;
                                            break;
                                        }
                                    }
                                    if(AddToMe)
                                    {
                                        ListViewItem LVI = lvCheckEm.Items.Add(MySection.Description);
                                        LVI.Tag = MySection;
                                    }
                                }
                            }

                            if(lvCheckEm.Items.Count != 0)
                            {
                                foreach(ListViewItem TLVI in lvCheckEm.Items)
                                {
                                    OysterClassLibrary.Section S = (OysterClassLibrary.Section)TLVI.Tag;
                                    ListViewItem LII = lvMember.Items.Add(S.Description);
                                    LII.Tag = S;

                                    foreach(OysterClassLibrary.User U in S.AllUsersInHierarchy)
                                    {
                                        foreach(OysterClassLibrary.Section USection in U.AllOwnedSections)
                                        {
                                            if(S.IsSectionInMyHierarchy(USection.ID))
                                            {
                                                bool AddToMe = true;
                                                foreach(ListViewItem LVIK in lvMember.Items)
                                                {
                                                    OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                                    if(lvMSection.ID == USection.ID)
                                                    {
                                                        AddToMe = false;
                                                        break;
                                                    }
                                                }
                                                if(AddToMe)
                                                {
                                                    ListViewItem LVAM = lvMember.Items.Add(USection.Description);
                                                    LVAM.Tag = USection;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                        }

                        if(PRI.objSectionType.ID == OSystem.SectionTypeSysAdmin.ID)
                        {
                            foreach(OysterClassLibrary.Section SystemBody in LoginUser.AllOwnedSections)
                            {
                                if(SystemBody.IsDefault == false)
                                {
                                    if(SystemBody.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                    {
                                        bool AddIt = true;
                                        foreach(ListViewItem ALVI in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                            if(OS.ID == SystemBody.ID)
                                            {
                                                AddIt = false;
                                                break;
                                            }
                                        }
                                        if(AddIt)
                                        {
                                            ListViewItem LI = new ListViewItem();
                                            LI = lvMember.Items.Add(SystemBody.Description);
                                            LI.Tag = SystemBody;
                                        }
                                    }
                                    GatherAllBodys(lvMember,SystemBody.CurrentUsers);
                                }
                            }
                        }
                        else
                        {
                            if(!B.IsDefault)
                            {
                                if(B.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                {
                                    bool AddIt = true;
                                    foreach(ListViewItem BLVI in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section OS = (OysterClassLibrary.Section)BLVI.Tag;

                                        if(OS.ID == B.ID)
                                        {
                                            AddIt = false;
                                            break;
                                        }
                                    }
                                    if(AddIt)
                                    {
                                        ListViewItem LI = new ListViewItem();
                                        LI = lvMember.Items.Add(B.Description);
                                        LI.Tag = B;
                                    }
                                }
                                GatherAllBodys(lvMember,B.CurrentUsers);
                            }
                            foreach(OysterClassLibrary.Section M in MembersOf)
                            {
                                bool AddIt = true;
                                foreach(ListViewItem ALVI in lvMember.Items)
                                {
                                    OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                    if(OS.ID == M.ID)
                                    {
                                        AddIt = false;
                                        break;
                                    }
                                }
                                if(AddIt)
                                {
                                    ListViewItem LA = lvMember.Items.Add(M.Description);
                                    LA.Tag = M;
                                }
                            }
                        }
                        if(lvMember.Items.Count == 0)
                        {
                            MessageBox.Show("No Member Sections or Owned Sections detected for " + LoginUser.FirstName + " " + LoginUser.LastName +
                                " at this time.","No legal location to send recording...abort action.");
                            return;
                        }

                        PRI.CurrentUser = LoginUser;
                        PRI.Rec = g_objRecording;
                        PRI.LV = lvMember;
                        PRI.OSystem = OSystem;
                        //PRI.objSectionType = CurrentSectionType;

                        Form RA = new frmMoveRecording();

                        RA.Tag = PRI;

                        RA.ShowDialog(this);

                        if(RA.DialogResult == DialogResult.OK)
                        {
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                        }
                        else
                            RA.Dispose();
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[4])
            {
                string sEditButton = "Edit " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;

                if(e.Button.Text == sEditButton) //Edit Section
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.CurrentSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.PreviousSection = PSI.CurrentSection.PreviousSection;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = true;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Edit " + PSI.CurrentSection.Description + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Remove User")
                {
                    //User doesn't exist
                    System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                    bool bSuccess = false;
                    TreeNode X = null;
                    //int ErrorNumber = 0;
                    if(g_objUser == null)
                    {
                        X = treeView1.SelectedNode;
                        if(X == null)return;
                        g_objUser = (OysterClassLibrary.User)X.Tag;
                    }

                    if(g_objUser == null)return;

                    string UserName = g_objUser.FirstName + " " + g_objUser.MiddleName + ". " + g_objUser.LastName;
                    DR = System.Windows.Forms.MessageBox.Show("Removing " + UserName + " will delete any of " +
                        UserName + " recordings that are assigned to " + g_objUser.CurrentSection.Description + ".", "Do you wish to proceed with Remove User?", System.Windows.Forms.MessageBoxButtons.YesNo);
                    if(DR == DialogResult.Yes)
                    {
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        try
                        {
                            //OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                            try
                            {
                                F.RemoveUser(g_objUser.ID,g_objUser.CurrentSectionID);
                                F.Dispose();

                                g_objSection = g_objUser.CurrentSection;
                                bSuccess = true;
                            }
                            catch(Exception Err)
                            {
                                string peekError = Err.Message;
                                bSuccess = false;
                            }
                            //       bSuccess = objBody.DestroyUser(g_objUser,false,ref ErrorNumber);
                            if(bSuccess ==true)
                            {

                                Status("Successfully Removed " + g_objUser.Description + " from " + g_objSection.Description);

                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                                ShowDisplay(ShowGroupInfo);
                            }
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else if(e.Button.Text == "Rename Recording")
                {
                    UpdateRecording RR = new UpdateRecording();

                    RR.Tag = g_objRecording;
                    RR.ShowDialog(this);

                    if(RR.DialogResult == DialogResult.OK)
                    {
                        BuildUserHierarchy();
                        //ShowDisplay(ShowRecordingInfo);
                        Status("Rename Recording completed.");
                        RR.Dispose();
                    }
                    else
                        Status("Aborted Rename Recording operation.");
                    RR.Dispose();
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[6])
            {
                string sNewSection = "";
                string sDeleteSection = "";
                string sSType = "";
                //TreeNode YNode = treeView1.SelectedNode;
                if(treeView1.SelectedNode.Tag is OysterClassLibrary.User)
                {
                    sSType = g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                    sNewSection = "New " + sSType;
                }
                else if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section)
                {
                    if(g_objSection.ID == MainSystemSection.ID)
                    {
                        sSType = g_objSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;

                    }
                    else
                    {
                        sSType = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                    }
                    sDeleteSection = "Delete " + sSType;
                    sNewSection = "New " + sSType;

                }
                if(e.Button.Text == sNewSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }

                        }
                        else if(XNode.Tag is OysterClassLibrary.User)
                        {
                            OysterClassLibrary.User UU = (OysterClassLibrary.User)XNode.Tag;
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = UU.CurrentSection;
                            PSI.CurrentUser = UU;
                            PSI.OSystem = OSystem;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.PreviousSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == sDeleteSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                            bool bSuccess = false;

                            DR = System.Windows.Forms.MessageBox.Show("Destroying " + g_objSection.Description + " will permanently destroy ALL Recordings that have been assigned to this " + sSType,"Do you wish to proceed with Delete " + sSType + "?",System.Windows.Forms.MessageBoxButtons.YesNo);

                            if(DR == DialogResult.Yes)
                            {
                                Status(LoginUser.Description + " gave order to proceed with deletion...");
                                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                                OysterClassLibrary.User objUser = F.GetUser(g_objSection.OwnerID);
                                if(objUser == null)
                                    return;
                                try
                                {
                                    F.RemoveSection(g_objSection.ID);
                                    F.Dispose();
                                    bSuccess = true;
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                    F.Dispose();
                                    bSuccess = false;
                                }

                                if(bSuccess ==true)
                                {
                                    Status("Successfully deleted: " + g_objSection.Description);
                                    //cbSectionType.Items.Clear();
                                    //cbSectionType.Text = "";
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                    ShowDisplay(ShowGroupInfo);
                                }
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Delete Recording")
                {
                    DialogResult DR = new DialogResult();
                    if((btnPlay.Enabled == true)||(btnPause.Enabled == true)||(btnStop.Enabled == true))
                    {
                        try
                        {
                            //                            MediaPlayer.Ctlcontrols.stop();
                            if(gLastRecording != "")
                            {
                                try
                                {
                                    // MediaPlayer.URL = "";
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                }
                            }
                            btnPlay.Enabled = false;

                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                        }

                    }

                    DR = MessageBox.Show(this,"Do you wish to permanently delete tne recording: '" + g_objRecording.DisplayName + "'","Deleting Recording",MessageBoxButtons.YesNo);

                    if(DR == DialogResult.No)
                        return;
                    OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                    TreeNode X = treeView1.SelectedNode;
                    string test = X.Text;
                    X = X.Parent;
                    test = X.Text;
                    OysterClassLibrary.Section B = F.GetSection(g_objRecording.CurrentSectionID);

                    if(g_objRecording.CurrentUserID == g_objRecording.OwnerID)
                    {
                        int CurrentUser = 0;
                        if(g_objUser == null)
                        {
                            if(g_objRecording.CurrentUserID == 0)
                                CurrentUser = LoginUser.ID;
                            else
                                CurrentUser = g_objRecording.CurrentUserID;
                        }
                        else
                            CurrentUser = g_objUser.ID;
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,CurrentUser,B.ID);
                            LoginUser = OSystem.Refresh();
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message,"Error occurred during Delete Recording operation");
                        }
                        BuildUserHierarchy();
                        return;
                    }
                    else  // test == "Recordings" which means all we have to do is go up till we find the body it is attached to
                    {
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,g_objRecording.CurrentUserID,g_objRecording.CurrentSectionID);
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                            return;
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[8])
            {
                if(e.Button.Text == "View Notes")
                {
                    if(FN != null)
                    {
                        if(FN.IsDisposed != true)
                        {
                            FN.Dispose();
                        }
                    }
                    FN = new frmNotes();
                    FN.Owner = this;
                    LastSelectedRecording = g_objRecording;
                    FN.Show();
                }
            }
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
            string str_msg = "";
            int int_result = 0;

            //Remove
            if (e.ColumnIndex == 2)
            {
                if (e.RowIndex != -1)   // BN 21/01/2015
                {
                    str_msg = "You are about to Remove Pallet Number " + dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString() + Environment.NewLine;
                    str_msg = str_msg + "Do you want to continue?";
                    DLR_Message = MessageBox.Show(str_msg, "Process Factory - Disptach(Orders)", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (DLR_Message == DialogResult.Yes)
                    {
                        int_result = FruPak.PF.Data.AccessLayer.PF_Pallet.Update_remove_from_Order(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Pallet_Id"].Value.ToString()), int_Current_User_Id);

                    }

                    if (int_result > 0)
                    {
                        lbl_message.ForeColor = System.Drawing.Color.Blue;
                        lbl_message.Text = "Pallet has been removed from the Order";
                    }
                    else
                    {
                        lbl_message.ForeColor = System.Drawing.Color.Red;
                        lbl_message.Text = "Pallet failed to be removed from the Order";
                    }
                    populate_DataGridView1();
                    try
                    {
                        populate_DataGridView2(Convert.ToInt32(dataGridView1.Rows[0].Cells["Pallet_Id"].Value.ToString()));
                    }
                    catch (Exception ex)
                    {
                        logger.Log(LogLevel.Debug, ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Nothing to remove", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logger.Log(LogLevel.Info, LogCode("dataGridView1_CellClick: Nothing to remove"));
                }
            }
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
            string str_msg = "";
            int int_result = 0;
            //Delete
            #region ------------- Delete -------------
            if (e.ColumnIndex == 5)
            {
                str_msg = "You are about to delete Pre Stock Number for Material Number " + dataGridView1.Rows[e.RowIndex].Cells["Material_Num"].Value.ToString() + Environment.NewLine;
                str_msg = str_msg + "Do you want to continue?";
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Temp(Pre System Stock)", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (DLR_Message == DialogResult.Yes)
                {
                    int_result = FruPak.PF.Data.AccessLayer.PF_PreSystem_Pallet_Stock.Delete(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["PrePalletStock_ID"].Value.ToString()));
                }
                if (int_result > 0)
                {
                    lbl_message.ForeColor = System.Drawing.Color.Blue;
                    lbl_message.Text = "Pre System Stock has been deleted";
                    populate_DataGridView1();
                }
                else
                {
                    lbl_message.ForeColor = System.Drawing.Color.Red;
                    lbl_message.Text = "Pre System Stock  failed to delete";
                }
            }
            #endregion
            //Edit
            #region ------------- Edit -------------
            else if (e.ColumnIndex == 6)
            {
                int_new_Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["PrePalletStock_ID"].Value.ToString());
                materialNumber1.setMaterial(Convert.ToInt32(dataGridView1.CurrentRow.Cells["Material_Id"].Value.ToString()));
                nud_quantity.Value = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["Quantity"].Value.ToString());

                btn_Add.Text = "&Update";
            }
            #endregion
        }
Example #49
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (dgLogPassAdm.SelectedCells[0].ToString() != log)
     {
         var result = new System.Windows.Forms.DialogResult();
         result = MessageBox.Show("Вы уверены, что желаете удалить эту запись?", "FMDb: Удаление ",
                       MessageBoxButtons.YesNo,
                       MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             if (dgLogPassAdm.SelectedCells.Count == 3)
             {
                 SqlConnection conn = null;
                 String query = "DELETE Login WHERE [Login]='{0}'";
                 try
                 {
                     conn = new SqlConnection(ConnectionString);
                     conn.Open();
                     using (var cmd = conn.CreateCommand())
                     {
                         cmd.CommandType = CommandType.Text;
                         cmd.CommandText = string.Format(query, dgLogPassAdm.SelectedCells[0].Value.ToString());
                         cmd.ExecuteNonQuery();
                     }
                     appendText = DateTime.Now.ToString() + ": пользователь " + log + " удалил пользователя " + dgLogPassAdm.SelectedCells[0].Value.ToString() + " .\n";
                     File.AppendAllText(path, appendText, Encoding.UTF8);
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message, "Ошибка!");
                 }
                 finally
                 {
                     conn.Close();
                     this.loginTableAdapter.Fill(this.fMDbDataSet.Login);
                 }
             }
         }
     }
     else { MessageBox.Show("Вы не можете удалить свою учетную запись"); }
 }
Example #50
0
 private void button_DelPr_Click(object sender, EventArgs e)
 {
     if (button_Pr2.Visible == true)
     {
         var result = new System.Windows.Forms.DialogResult();
         result = MessageBox.Show("Удалить последний проект?", "Удаление проекта",
                       MessageBoxButtons.YesNo,
                       MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             if (button_Pr5.Visible == true)
             {
                 button_Pr5.Visible = false;
                 _prjTabNo = 4;
                 _countOfPrj = "4";
                 projectTab();
             }
             else if (button_Pr4.Visible == true)
             {
                 button_Pr4.Visible = false;
                 _prjTabNo = 3;
                 _countOfPrj = "3";
                 projectTab();
             }
             else if (button_Pr3.Visible == true)
             {
                 button_Pr3.Visible = false;
                 _prjTabNo = 2;
                 _countOfPrj = "2";
                 projectTab();
             }
             else if (button_Pr2.Visible == true)
             {
                 button_Pr2.Visible = false;
                 _prjTabNo = 1;
                 _countOfPrj = "1";
                 projectTab();
             }
         }
     }
 }
        private void ExportFromLibrary_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            Globals.Chem4WordV3.Telemetry.Write(module, "Action", "Triggered");

            try
            {
                string exportFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog();

                browser.Description            = "Select a folder to export your Library's structures as cml files";
                browser.UseDescriptionForTitle = true;
                browser.RootFolder             = Environment.SpecialFolder.Desktop;
                browser.ShowNewFolderButton    = false;
                browser.SelectedPath           = exportFolder;
                Forms.DialogResult dr = browser.ShowDialog();

                if (dr == Forms.DialogResult.OK)
                {
                    exportFolder = browser.SelectedPath;

                    if (Directory.Exists(exportFolder))
                    {
                        Forms.DialogResult doExport         = Forms.DialogResult.Yes;
                        string[]           existingCmlFiles = Directory.GetFiles(exportFolder, "*.cml");
                        if (existingCmlFiles.Length > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine($"This folder contains {existingCmlFiles.Length} cml files.");
                            sb.AppendLine("Do you wish to continue?");
                            doExport = UserInteractions.AskUserYesNo(sb.ToString(), Forms.MessageBoxDefaultButton.Button2);
                        }
                        if (doExport == Forms.DialogResult.Yes)
                        {
                            Database.Library lib = new Database.Library();

                            int exported = 0;
                            int progress = 0;

                            List <ChemistryDTO> dto = lib.GetAllChemistry(null);
                            int total = dto.Count;
                            if (total > 0)
                            {
                                ProgressBar.Maximum          = dto.Count;
                                ProgressBar.Minimum          = 0;
                                ProgressBarHolder.Visibility = Visibility.Visible;
                                SetButtonState(false);

                                var converter = new CMLConverter();

                                foreach (var obj in dto)
                                {
                                    progress++;
                                    ShowProgress(progress, $"Structure #{obj.Id} [{progress}/{total}]");

                                    var filename = Path.Combine(browser.SelectedPath, $"Chem4Word-{obj.Id:000000000}.cml");

                                    Model model = converter.Import(obj.Cml);

                                    var outcome = model.EnsureBondLength(Globals.Chem4WordV3.SystemOptions.BondLength, false);
                                    if (!string.IsNullOrEmpty(outcome))
                                    {
                                        Globals.Chem4WordV3.Telemetry.Write(module, "Information", outcome);
                                    }

                                    File.WriteAllText(filename, converter.Export(model));
                                    exported++;
                                }
                            }

                            ProgressBarHolder.Visibility = Visibility.Collapsed;
                            SetButtonState(true);

                            if (exported > 0)
                            {
                                UserInteractions.InformUser($"Exported {exported} structures to {browser.SelectedPath}");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ProgressBarHolder.Visibility = Visibility.Collapsed;
                SetButtonState(true);

                new ReportError(Globals.Chem4WordV3.Telemetry, TopLeft, module, ex).ShowDialog();
            }
        }
Example #52
0
		private bool _editTextChanged = false;																// 1.0.001

		public EditEventArgs(																				// 1.0.001
			System.Windows.Forms.DialogResult dialogResult,													// 1.0.001
			bool editAccepted, string editText, bool editTextChanged										// 1.0.001
		)																									// 1.0.001
		{																									// 1.0.001
			this._dialogResult = dialogResult;																// 1.0.001
			this._editAccepted = editAccepted;																// 1.0.001
			this._editText = editText;																		// 1.0.001
			this._editTextChanged = editTextChanged;														// 1.0.001
		}																									// 1.0.001
Example #53
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (comboBox3.Text == "")
            {
                MessageBox.Show("For request you must fill all fields!!!");
            }
            else
            {
                if (radioButton1.Checked)
                {
                    if (client_date_come.Value.Date > System.DateTime.Now.Date)
                    {
                        MessageBox.Show("Check the date and time!\n" +
                                        " The date you put is is too far from current time!\n" +
                                        " You've entered date: " + dateTimePicker1.Value.ToString("dd.MMM.yyyy"));
                    }
                    else
                    {
                        if (client_date_come.Value.Date != System.DateTime.Now.Date)
                        {
                            DialogResult dr = new System.Windows.Forms.DialogResult();
                            MessageBox.Show("Date is different from current date!\nAre you sure that you put this date?\n" +
                                "Your date is equal to " + client_date_come.Value.ToString("dd.MMM.yyyy") + "\nCurrent date is " + System.DateTime.Now.ToString("dd.MMM.yyyy") +
                                "\nPress 'Yes' if you put correct date\n" +
                                "Press 'No' if you want to put correct date", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                            if (dr == DialogResult.Yes)
                            {
                                clientCounter++;
                                SqlCommand open_table;
                                open_table = new SqlCommand("INSERT INTO new_client(client_num, table_id, time_come, time_out, customer_id, discount, total_cost, client_state)" +
                                                            " VALUES (@client_num, @table_id, @client_time, @client_out, @cust_id, '0', '0', 'opened'); ", connection);
                                open_table.Parameters.Add(new SqlParameter("@client_num", SqlDbType.Int));
                                open_table.Parameters["@client_num"].Value = clientCounter;

                                open_table.Parameters.Add(new SqlParameter("@table_id", SqlDbType.Int));
                                open_table.Parameters["@table_id"].Value = int.Parse(comboBox3.Text);

                                open_table.Parameters.Add(new SqlParameter("@client_time", SqlDbType.DateTime));
                                open_table.Parameters["@client_time"].Value = client_date_come.Value.ToString("dd/MMM/yyyy") + " " + dateTimePicker1.Value.ToString("HH:mm");//textBox1.Text.ToString() + ":" + textBox2.Text.ToString());

                                open_table.Parameters.Add(new SqlParameter("@client_out", SqlDbType.DateTime));
                                open_table.Parameters["@client_out"].Value = client_date_come.Value.ToString("dd/MMM/yyyy") + " " + dateTimePicker1.Value.ToString("HH:mm");//textBox3.Text.ToString() + ":" + textBox4.Text.ToString());

                                open_table.Parameters.Add(new SqlParameter("@cust_id", SqlDbType.VarChar));
                                open_table.Parameters["@cust_id"].Value = comboBox1.Text.ToString();

                                open_table.ExecuteNonQuery();

                                SqlCommand update_table_info;
                                update_table_info = new SqlCommand("UPDATE tables_info SET table_state='busy' WHERE table_id=@table_id", connection);
                                update_table_info.Parameters.Add(new SqlParameter("@table_id", SqlDbType.Int));
                                update_table_info.Parameters["@table_id"].Value = int.Parse(comboBox1.Text);

                                update_table_info.ExecuteNonQuery();
                                comboBox1.Items.Clear();
                                Close();
                            }
                        }
                    }
                }
                else if (radioButton2.Checked)
                {
                    if (System.DateTime.Parse(client_date_out.Value.ToString("dd.MMM.yyyy") + " " + dateTimePicker2.Value.ToString("HH:mm")) < System.DateTime.Now.Date)
                    {
                        MessageBox.Show("Check the date and time!\n" +
                                        " The date you put is is too far from current time!\n" +
                                        " You've entered date: " + dateTimePicker1.Value.ToString("dd.MMM.yyyy"));
                    }
                    else if (int.Parse(textBox5.Text) == 0 ||
                        client_date_out.Value.ToString("dd.MMM.yyyy") + " " + dateTimePicker2.Value.ToString("HH:mm") == System.DateTime.Now.ToString("dd.MMM.yyyy HH:mm"))
                    {
                        MessageBox.Show("ERROR!\nCheck all fields!!!\nPossible troubles:\n -You didn't change date!\n-Paid sum is equal to zero!");
                    }
                    else
                    {
                        clientCounter++;
                        SqlCommand deposit_table;
                        deposit_table = new SqlCommand("INSERT INTO new_client(client_num, table_id, time_come, time_out, customer_id, discount, total_cost, client_state)" +
                                                    " VALUES (@client_num, @table_id, @client_time, @client_out, @cust_id, '0', '0', 'opened'); ", connection);
                        deposit_table.Parameters.Add(new SqlParameter("@client_num", SqlDbType.Int));
                        deposit_table.Parameters["@client_num"].Value = clientCounter;

                        deposit_table.Parameters.Add(new SqlParameter("@table_id", SqlDbType.Int));
                        deposit_table.Parameters["@table_id"].Value = int.Parse(comboBox3.Text);

                        deposit_table.Parameters.Add(new SqlParameter("@client_time", SqlDbType.DateTime));
                        deposit_table.Parameters["@client_time"].Value = client_date_come.Value.ToString("dd/MMM/yyyy") + " " + dateTimePicker1.Value.ToString("HH:mm");//textBox1.Text.ToString() + ":" + textBox2.Text.ToString());

                        deposit_table.Parameters.Add(new SqlParameter("@client_out", SqlDbType.DateTime));
                        deposit_table.Parameters["@client_out"].Value = client_date_come.Value.ToString("dd/MMM/yyyy") + " " + dateTimePicker1.Value.ToString("HH:mm");//textBox3.Text.ToString() + ":" + textBox4.Text.ToString());

                        deposit_table.Parameters.Add(new SqlParameter("@cust_id", SqlDbType.VarChar));
                        deposit_table.Parameters["@cust_id"].Value = comboBox1.Text.ToString();

                        deposit_table.ExecuteNonQuery();

                        SqlCommand update_table_info;
                        update_table_info = new SqlCommand("UPDATE tables_info SET table_state='busy' WHERE table_id=@table_id", connection);
                        update_table_info.Parameters.Add(new SqlParameter("@table_id", SqlDbType.Int));
                        update_table_info.Parameters["@table_id"].Value = int.Parse(comboBox1.Text);

                        update_table_info.ExecuteNonQuery();
                        comboBox1.Items.Clear();
                        Close();
                    }
                }
            }
        }
        private void btn_view_Click(object sender, EventArgs e)
        {
            FireHistoryMessage("View Clicked ");

            string str_msg = "";
            DialogResult DLR_Message = new System.Windows.Forms.DialogResult();
            FruPak.PF.PrintLayer.Word.FilePath = FruPak.PF.Common.Code.General.Get_Single_System_Code("PF-TPPath");

            Cursor = Cursors.WaitCursor;
            str_msg = str_msg + Create_PDF_Defaults("View");
            Cursor = Cursors.Default;

            if (str_msg.Length > 0)
            {
                DLR_Message = MessageBox.Show(str_msg, "Process Factory - Invoice Search(View)", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (DLR_Message != DialogResult.OK)
            {
                foreach (string view_file in FruPak.PF.PrintLayer.General.view_list)
                {
                    FruPak.PF.Common.Code.General.Report_Viewer(FruPak.PF.PrintLayer.Word.FilePath + "\\" + view_file);
                }
            }
        }
Example #55
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            DialogResult DLR_message = new DialogResult();
            string str_msg = "";
            int int_result = 0;

            if (cmb_Trader.SelectedIndex == -1)
            {
                str_msg = str_msg + "Invalid Trader. Please select a valid Trader from the drop down list." + Environment.NewLine;
            }
            if (grower1.Grower_Id == 0)
            {
                str_msg = str_msg + "Invalid Grower. PLease select a valid Grower from the drop down list." + Environment.NewLine;
            }
            if (cmb_Block.SelectedIndex == -1)
            {
                str_msg = str_msg + "Invalid Block. Please select a valid Block from the drop down list." + Environment.NewLine;
            }
            if (txt_Grower_Ref.TextLength == 0)
            {
                str_msg = str_msg + "Invalid grower Reference. Please enter a valid Grower Reference." + Environment.NewLine;
            }
            if (nud_Pick_Num.Value == 0)
            {
                str_msg = str_msg + "Invalid Pick Num. PLease enter a valid Pick Num." + Environment.NewLine;
            }
            if (str_msg.Length > 0)
            {
                DLR_message = MessageBox.Show(str_msg, "Process Factory - GateHouse(Submission)", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //*******************************************************************************************
            switch (btn_Add.Text)
            {
                case "&Add":
                    int_new_Sub_Id = FruPak.PF.Common.Code.General.int_max_user_id("GH_Submission");
                    break;
            }


            bool bol_bins_Add = true;
            if (DLR_message != System.Windows.Forms.DialogResult.OK)
            {
                switch (btn_Add.Text)
                {
                    case "&Add":
                        int_result = FruPak.PF.Data.AccessLayer.GH_Submission.Insert(int_new_Sub_Id, Convert.ToInt32(cmb_Trader.SelectedValue.ToString()), grower1.Grower_Id,
                            Convert.ToInt32(cmb_Block.SelectedValue.ToString()), txt_Grower_Ref.Text, dtp_Sub_Date.Value.ToString("yyyy/MM/dd"), dtp_Harvest_Date.Value.ToString("yyyy/MM/dd"), Convert.ToInt32(nud_Pick_Num.Value.ToString()),
                            txt_Comments.Text, int_Current_User_Id);
                        bol_bins_Add = true;
                        break;
                    case "&Update":
                        int_result = FruPak.PF.Data.AccessLayer.GH_Submission.Update(int_new_Sub_Id, Convert.ToInt32(cmb_Trader.SelectedValue.ToString()), grower1.Grower_Id,
                            Convert.ToInt32(cmb_Block.SelectedValue.ToString()), txt_Grower_Ref.Text, dtp_Sub_Date.Value.ToString("yyyy/MM/dd"), dtp_Harvest_Date.Value.ToString("yyyy/MM/dd"), Convert.ToInt32(nud_Pick_Num.Value.ToString()),
                            txt_Comments.Text, int_Current_User_Id);
                        bol_bins_Add = false;
                        break;
                }
                if (int_result > 0)
                {
                    DialogResult dlr_frm = new System.Windows.Forms.DialogResult();


                    Form frm = new Submission_Bins(int_new_Sub_Id, Convert.ToInt32(cmb_Trader.SelectedValue.ToString()), int_Current_User_Id, bol_write_access, bol_bins_Add);
                    dlr_frm = frm.ShowDialog();

                    lbl_message.ForeColor = System.Drawing.Color.Blue;
                    if (Submission_Bins.Created_Bins > 0)
                    {
                        lbl_message.Text = "Submission has been Saved and " + Convert.ToString(Submission_Bins.Created_Bins) + " Bins have been added";
                    }
                    else
                    {
                        lbl_message.Text = "Submission has been saved and NO Bins have to created";
                    }
                    populate_DataGridView1();
                    Reset();
                }
                else
                {
                    lbl_message.ForeColor = System.Drawing.Color.Red;
                    lbl_message.Text = "Submission has NOT been saved";
                }
            }
        }
Example #56
0
		}																									// 1.0.003

		private void ShowIt(bool showDialog, System.Drawing.Point ptShow, int height, int width, string editText)	// 1.0.003
		{																									// 1.0.003
			this._dialogResult = System.Windows.Forms.DialogResult.None;									// 1.0.001
			this._editAccepted = false;																		// 1.0.001
			this._editText = "";																			// 1.0.001
			this._editTextChanged = false;																	// 1.0.001

			#region Create [this._frmEditBox]
			if( (this._frmEditBox == null)																	// 1.0.001
			|| this._frmEditBox.Disposing																	// 1.0.001
			|| this._frmEditBox.IsDisposed																	// 1.0.001
			|| !this._frmEditBox.Created																	// 1.0.001
			)																								// 1.0.001
			{																								// 1.0.001
				this._frmEditBox = new TDHEditBox.frmEditBox(												// 1.0.001
					new XmlParsersAndUi.TDHEditBox.EditComplete(this.EditComplete)					// 1.0.001
					);																						// 1.0.001
			}																								// 1.0.001
			#endregion 

			if (showDialog)																					// 1.0.003
			{																								// 1.0.003
				this._frmEditBox.ShowDialog(ptShow, height, width, editText);								// 1.0.003
			}																								// 1.0.003
			else																							// 1.0.003
			{																								// 1.0.003
				this._frmEditBox.Show(ptShow, height, width, editText);										// 1.0.001
			}																								// 1.0.003
		}																									// 1.0.003
Example #57
0
        private void print_Palletcard(int rowindex)
        {
            Cursor = Cursors.WaitCursor;
            FruPak.PF.Common.Code.General.Get_Printer("A4");

            switch (str_product_code)
            {
                case "WPC":
                case "FDA":
                    DialogResult DLR_Weights = new System.Windows.Forms.DialogResult();
                    Form frm_check_weight = new FruPak.PF.Utils.Scanning.Pallet_Weight(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), int_Current_User_Id, bol_write_access);
                    DLR_Weights = frm_check_weight.ShowDialog();
                    frm_check_weight.Dispose();

                    if (FruPak.PF.PrintLayer.Word.Test_for_Word() == true)
                    {
                        try
                        {
                            FruPak.PF.PrintLayer.Word.CloseWord();
                        }
                        catch (Exception ex)
                        {
                            logger.Log(LogLevel.Debug, ex.Message);
                        }
                        FruPak.PF.PrintLayer.WPC_Card.Print(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), true, int_Current_User_Id);
                    }
                    else
                    {
                        string Data = "";
                        Data = Data + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString();
                        Data = Data + ":True";

                        //FruPak.PF.PrintLayer.Word.Printer = "Brother HL-2040 series";
                        FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;  // 16/06/2015 Fixed - Jim worked out there was some hardcoded strings

                        // Phantom 18/12/2014
                        //FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;   // Reverted 06-03-2015

                        DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
                        DataRow dr_Get_Info;
                        for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
                        {
                            dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                            switch (dr_Get_Info["Code"].ToString())
                            {
                                case "PF-TPath":
                                    FruPak.PF.PrintLayer.Word.TemplatePath = dr_Get_Info["Value"].ToString();
                                    break;
                                case "PF-TWPC":
                                    FruPak.PF.PrintLayer.Word.TemplateName = dr_Get_Info["Value"].ToString();
                                    break;
                            }
                        }
                        ds_Get_Info.Dispose();
                        FruPak.PF.PrintLayer.Word.Server_Print(Data, int_Current_User_Id);
                    }
                    break;
                default:
                    if (FruPak.PF.PrintLayer.Word.Test_for_Word() == true)
                    {
                        try
                        {
                            FruPak.PF.PrintLayer.Word.CloseWord();
                        }
                        catch (Exception ex)
                        {
                            logger.Log(LogLevel.Debug, ex.Message);
                        }
                        FruPak.PF.PrintLayer.Pallet_Card.Print(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), true, int_Current_User_Id);
                    }
                    else
                    {
                        string Data = "";
                        Data = Data + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString();
                        Data = Data + ":True";

                        //FruPak.PF.PrintLayer.Word.Printer = "Brother HL-2040 series";

                        // Phantom 18/12/2014
                        FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;

                        DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
                        DataRow dr_Get_Info;
                        for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
                        {
                            dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                            switch (dr_Get_Info["Code"].ToString())
                            {
                                case "PF-TPath":
                                    FruPak.PF.PrintLayer.Word.TemplatePath = dr_Get_Info["Value"].ToString();
                                    break;
                                case "PF-TPallet":
                                    FruPak.PF.PrintLayer.Word.TemplateName = dr_Get_Info["Value"].ToString();
                                    break;
                            }
                        }
                        ds_Get_Info.Dispose();
                        FruPak.PF.PrintLayer.Word.Server_Print(Data, int_Current_User_Id);
                    }
                    break;
            }
            try
            {
                FruPak.PF.PrintLayer.Word.CloseWord();
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Debug, ex.Message);
            }
            string str_path = "";

            DataSet ds_Get_Info1 = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
            DataRow dr_Get_Info1;
            for (int i = 0; i < Convert.ToInt32(ds_Get_Info1.Tables[0].Rows.Count.ToString()); i++)
            {
                dr_Get_Info1 = ds_Get_Info1.Tables[0].Rows[i];
                switch (dr_Get_Info1["Code"].ToString())
                {
                    case "PF-TPPath":
                        str_path = dr_Get_Info1["Value"].ToString();
                        break;
                }
            }
            ds_Get_Info1.Dispose();

            Cursor = Cursors.Default;
            lst_filenames.AddRange(System.IO.Directory.GetFiles(str_path, "*" + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString() + "*", System.IO.SearchOption.TopDirectoryOnly));

            foreach (string filename in lst_filenames)
            {
                File.Delete(filename);
            }
        }
Example #58
0
        public void NewDatabase()
        {
            try
            {
                var name = databaseName;
                if (!String.IsNullOrWhiteSpace(name))
                {
                    String str;
                    string ConString = "Server=" + SelectedItem + ";Integrated security=SSPI ;Trusted_Connection=True;database=master";
                    bool   Status    = CheckDatabaseExists(ConString, databaseName);
                    if (Status == false)
                    {
                        SqlConnection myConn = new SqlConnection
                                                   ("Server=" + SelectedItem + ";Integrated security=SSPI ;Trusted_Connection=True;database=master");


                        str = "CREATE DATABASE " + name;

                        SqlCommand myCommand = new SqlCommand(str, myConn);
                        try
                        {
                            myConn.Open();
                            myCommand.ExecuteNonQuery();

                            bool status = RunScript();

                            if (status == true)
                            {
                                StringBuilder Con = new StringBuilder("metadata=res://*/SASEntitiesEDM.csdl|res://*/SASEntitiesEDM.ssdl|res://*/SASEntitiesEDM.msl;provider=System.Data.SqlClient;provider connection string=';data source=" + SelectedItem + ";Trusted_Connection=True;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework;");
                                //Con.Append("res://*/SASEntitiesEDM.csdl|res://*/SASEntitiesEDM.ssdl|res://*/SASEntitiesEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;server=SDN-450\\SQLEXPRESS;Trusted_Connection=True;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;");
                                Con.Append("initial catalog=");
                                Con.Append(databaseName);
                                Con.Append("';");
                                string finalconnectionstring = Con.ToString();


                                SASDAL.Properties.Settings.Default.SASEntitiesEDM = finalconnectionstring;
                                SASDAL.Properties.Settings.Default.Save();

                                var     view    = ServiceLocator.Current.GetInstance <LoginUserView>();
                                IRegion region1 = this.regionManager.Regions[RegionNames.MainRegion];
                                region1.Add(view);
                                if (region1 != null)
                                {
                                    region1.Activate(view);
                                }
                                eventAggregator.GetEvent <TabVisibilityEvent>().Publish(false);
                                eventAggregator.GetEvent <SubTabVisibilityEvent>().Publish(false);
                            }
                            else
                            {
                                str = "DROP DATABASE " + name;
                                SqlCommand myCommand1 = new SqlCommand(str, myConn);
                                // myConn.Open();
                                myCommand1.ExecuteNonQuery();

                                System.Windows.Forms.DialogResult result = MessageBox.Show("There is something wrong while creating database", "MyApp",

                                                                                           MessageBoxButtons.OK);

                                if (result == System.Windows.Forms.DialogResult.OK)
                                {
                                    var     view    = ServiceLocator.Current.GetInstance <OpenCompanyFileView>();
                                    IRegion region1 = this.regionManager.Regions[RegionNames.MainRegion];
                                    region1.Add(view);
                                    if (region1 != null)
                                    {
                                        region1.Activate(view);
                                    }
                                    eventAggregator.GetEvent <TabVisibilityEvent>().Publish(false);
                                    eventAggregator.GetEvent <SubTabVisibilityEvent>().Publish(false);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            return;
                        }
                        finally
                        {
                            if (myConn.State == ConnectionState.Open)
                            {
                                myConn.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Database is Already Exist\n" + "@ Simple Accounting Software Pte Ltd");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter Database Name\n" + "@ Simple Accounting Software Pte Ltd");
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Example #59
0
        public static int Email(string str_msg, bool copy_to_office)
        {
            int int_return = 0;
            System.Windows.Forms.DialogResult DLR_Message = new System.Windows.Forms.DialogResult();

            str_msg = str_msg + FruPak.PF.Common.Code.General.Check_Email();

            if (str_msg.Length > 0)
            {
                DLR_Message = System.Windows.Forms.MessageBox.Show(str_msg, "Process Factory - Accounting (Invoice - Email)", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            bol_copy_to_office = copy_to_office;

            DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System_Email.Get_Info_Like("PF%");
            DataRow dr_Get_Info;


            for (int i = 0; i < ds_Get_Info.Tables[0].Rows.Count; i++)
            {
                dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                switch (dr_Get_Info["Code"].ToString())
                {
                    case "PF-Addr":
                        FruPak.PF.Common.Code.Send_Email.Email_From_Address = dr_Get_Info["Value"].ToString();
                        break;
                    case "PF-UserID":
                        FruPak.PF.Common.Code.Send_Email.Network_UserId = dr_Get_Info["Value"].ToString();
                        break;
                    case "PF-InvSub":
                        if (FruPak.PF.Common.Code.Send_Email.Email_Subject == "")
                        {
                            FruPak.PF.Common.Code.Send_Email.Email_Subject = dr_Get_Info["Value"].ToString();
                        }
                        break;
                    case "PF-InvMsg":
                        if (FruPak.PF.Common.Code.Send_Email.Email_Message == "")
                        {
                            FruPak.PF.Common.Code.Send_Email.Email_Message = dr_Get_Info["Value"].ToString();
                        }
                        else
                        {
                            FruPak.PF.Common.Code.Send_Email.Email_Message = FruPak.PF.Common.Code.Send_Email.Email_Message + Environment.NewLine + FruPak.PF.Common.Code.Send_Email.Network_UserId;
                        }
                        break;
                }
            }
            ds_Get_Info.Dispose();

            Form frm = new FruPak.PF.Common.Code.Send_Email();
            DLR_Message = frm.ShowDialog();

            if (DLR_Message == System.Windows.Forms.DialogResult.OK)
            {
                FruPak.PF.Common.Code.SendEmail.From_Email_Address = FruPak.PF.Common.Code.Send_Email.Email_From_Address;
                FruPak.PF.Common.Code.SendEmail.Network_UserId = FruPak.PF.Common.Code.Send_Email.Network_UserId;
                FruPak.PF.Common.Code.SendEmail.Network_Password = FruPak.PF.Common.Code.Send_Email.Network_Password;

                FruPak.PF.Common.Code.SendEmail.Subject = FruPak.PF.Common.Code.Send_Email.Email_Subject;
                FruPak.PF.Common.Code.SendEmail.IsBodyHtml = false;
                FruPak.PF.Common.Code.SendEmail.message = FruPak.PF.Common.Code.Send_Email.Email_Message;
                FruPak.PF.Common.Code.SendEmail.Recipient = FruPak.PF.Data.Outlook.Contacts.Contact_Email;
                FruPak.PF.Common.Code.SendEmail.BCC_Email_Address = new List<string>();
                if (FruPak.PF.Common.Code.Send_Email.Email_sender_Copy == true)
                {
                    try
                    {
                        FruPak.PF.Common.Code.SendEmail.BCC_Email_Address.Add(FruPak.PF.Common.Code.Send_Email.Email_From_Address);
                    }
                    catch (Exception ex)
                    {
                        logger.Log(LogLevel.Debug, ex.Message);
                    }
                }

                str_msg = "";
                str_msg = FruPak.PF.Common.Code.SendEmail.send_mail();
                if (str_msg.Length > 0)
                {
                    DLR_Message = MessageBox.Show(str_msg, "Process Factory - Accounting (Invoice - Email)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    int_return = 0;
                }
            }
            else
            {
                int_return = 9;
            }

            return int_return;
        }