Example #1
0
        private void deleteFolder_Button_Click(object sender, EventArgs e)
        {
            if (_currentType == "Folder" && _SelectedQuickSet != null)
            {
                parameter_GridView.AllowUserToDeleteRows = true;

                STNFQuickSetData stnfSelected = _SelectedQuickSet as STNFQuickSetData;

                //var temp = _parameterList.Where(x => stnfSelected.FolderPaths.Contains(x.ParameterValue, Comparer.));
                //foreach()


                //int index = _parameterList.IndexOf(_parameterList.Select(x => x.ParameterValue).Where(x => x == "FolderPath").Intersect(stnfSelected.FolderPaths)).FirstOrDefault());
                int index = -1;
                index = parameter_GridView.CurrentCell.RowIndex;
                if (index > -1 && parameter_GridView.RowCount > 1)
                {
                    _parameterList.RemoveAt(index);
                    quickSetParameterDataBindingSource.ResetBindings(false);
                }
            }
            else
            {
                parameter_GridView.AllowUserToDeleteRows = false;
            }
        }
Example #2
0
 private void AddFolder_Button_Click(object sender, EventArgs e)
 {
     if (_currentType == "Folder")
     {
         parameter_GridView.AllowUserToAddRows = true;
         //_currentType = "Folder";
         STNFQuickSetData stnfSelected = _SelectedQuickSet as STNFQuickSetData;
         _parameterList.Add(new QuickSetParameterData("Network Path", $@"\\rdlfs.rdl.boi.rd.hpicorp.net\Public", $@"UNC Path-- \\rdlfs.hpicorp\..."));
         quickSetParameterDataBindingSource.ResetBindings(false);
     }
     else
     {
         parameter_GridView.AllowUserToAddRows = false;
     }
 }
Example #3
0
        private void PopulateQuickSetOptions(object sender, EventArgs e)
        {
            var row = quickSet_GridView.CurrentRow;

            if (row == null)
            {
                return;
            }
            var name = row.Cells[0].Value.ToString();
            var type = row.Cells[1].Value.ToString();

            _selectedRow      = _viewList.FirstOrDefault(x => x.QuickSetName == name && x.QuickSetType == type);
            _SelectedQuickSet = _quickSetList.QuickSetData.Key.Where(x => x.QName == name && x.QType == type).Select(x => x).FirstOrDefault();
            _parameterList.Clear();
            _currentType = _SelectedQuickSet.QType;
            //populate selected options
            switch (_currentType)
            {
            case "Email":
                EmailQuickSetData emailSelected = _SelectedQuickSet as EmailQuickSetData;
                SetFieldInfo();

                _parameterList.Add(new QuickSetParameterData("To", emailSelected.To, "Default From: ; User's Address"));
                _parameterList.Add(new QuickSetParameterData("Default From", emailSelected.DefaultFrom, "Blank ; User's Address"));
                _parameterList.Add(new QuickSetParameterData("From User", emailSelected.FromUser, "String"));

                break;

            case "Copy":
                _currentType = "Copy";
                CopyQuickSetData copySelected = _SelectedQuickSet as CopyQuickSetData;
                SetFieldInfo();

                _parameterList.Add(new QuickSetParameterData("Copies", copySelected.Copies, "Number"));

                break;

            case "Folder":
                _currentType = "Folder";
                STNFQuickSetData stnfSelected = _SelectedQuickSet as STNFQuickSetData;
                SetFieldInfo();
                foreach (var path in stnfSelected.FolderPaths)
                {
                    _parameterList.Add(new QuickSetParameterData("Network Path", path, $@"UNC Path-- \\rdlfs.hpicorp\..."));
                }
                AddFolder_Button.Visible    = true;
                deleteFolder_Button.Visible = true;

                break;

            case "SharePoint":
                _currentType = "SharePoint";
                STSharePointQuickSetData sharePointSelected = _SelectedQuickSet as STSharePointQuickSetData;
                SetFieldInfo();
                _parameterList.Add(new QuickSetParameterData("Folder Path", sharePointSelected.FolderPath, $@"UNC Path-- \\rdlfs.hpicorp\..."));

                break;

            case "USB":
                _currentType = "USB";
                STUSBQuickSetData usbSelected = _SelectedQuickSet as STUSBQuickSetData;
                SetFieldInfo();
                break;

            case "Fax":
                _currentType = "Fax";
                ScanFaxQuickSetData faxSelected = _SelectedQuickSet as ScanFaxQuickSetData;
                SetFieldInfo();
                _parameterList.Add(new QuickSetParameterData("Phone Number", faxSelected.Number, $@"Ex: ###-###-####"));
                break;

            case "FTP":
                _currentType = "FTP";
                FTPQuickSetData ftpSelected = _SelectedQuickSet as FTPQuickSetData;
                SetFieldInfo();
                _parameterList.Add(new QuickSetParameterData("FTP Server", ftpSelected.FTPServer, $@"FTP Server Path Ex: ftp.test.com"));
                _parameterList.Add(new QuickSetParameterData("Port", ftpSelected.PortNumber, $@"Port number"));
                _parameterList.Add(new QuickSetParameterData("Directory Path", ftpSelected.DirectoryPath, $@"//folder/folder"));
                _parameterList.Add(new QuickSetParameterData("User name", ftpSelected.UserName, $@"FTP username"));
                _parameterList.Add(new QuickSetParameterData("FTP Protocol", ftpSelected.FTPProtocol, $@"FTP/Secure FTP"));

                break;

            default:
                throw new Exception("Invalid Quickset");
            }
            if (_currentType != "Folder")
            {
                parameter_GridView.AllowUserToAddRows = false;
                AddFolder_Button.Visible    = false;
                deleteFolder_Button.Visible = false;
            }
            quickSetParameterDataBindingSource.ResetBindings(false);
        }
Example #4
0
        private void add_Button_Click(object sender, EventArgs e)
        {
            bool   success      = false;
            string errorMessage = "Please verify your parameters match the criteria";

            //string message = "";
            //List<QuickSetParameterData> param;
            //1. Parse out individual Parameters
            //2. Create Scan settings data
            //3. Create individual quickset data
            //4. ???
            //5. Profit

            if (!string.IsNullOrWhiteSpace(name_TextBox.Text))
            {
                var scanSettingsData = new ScanSettings(originalSize_ComboBox.SelectedValue.ToString(), originalSides_ComboBox.SelectedValue.ToString(), contentOrientation_ComboBox.SelectedValue.ToString(), imagePreview_ComboBox.SelectedValue.ToString());
                var fileSettingsData = new FileSettings
                {
                    FileType = new DataPair <string>
                    {
                        Key   = fileType_ComboBox.SelectedValue.ToString(),
                        Value = true
                    },
                    Resolution = new DataPair <string>()
                    {
                        Key   = resolution_ComboBox.SelectedValue.ToString(),
                        Value = true
                    }
                };
                List <QuickSetParameterData> param = (List <QuickSetParameterData>)quickSetParameterDataBindingSource.List;


                //Validate Fields here
                //Add validation for

                AQuickSet addQuickSet;
                switch (quickSetType_ComboBox.SelectedValue.ToString())
                {
                case "Email":
                    _currentType = "Email";

                    if (EmailQuickSetData.Validate(param))
                    {
                        string to          = param[0].ParameterValue;
                        string defaultFrom = param[1].ParameterValue;
                        string fromUser    = param[2].ParameterValue;

                        addQuickSet = new EmailQuickSetData(fromUser, defaultFrom, to, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }

                    break;

                case "Copy":
                    _currentType = "Copy";

                    if (CopyQuickSetData.Validate(param))
                    {
                        string copies = param[0].ParameterValue;

                        addQuickSet = new CopyQuickSetData(copies, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }
                    break;

                case "Folder":
                    _currentType = "Folder";
                    if (STNFQuickSetData.Validate(param))
                    {
                        List <string> folderPaths = param.Select(x => x.ParameterValue).ToList();

                        //string folderPath = param[0].ParameterValue;

                        addQuickSet = new STNFQuickSetData(folderPaths, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }
                    break;

                case "SharePoint":
                    _currentType = "SharePoint";
                    if (STSharePointQuickSetData.Validate(param))
                    {
                        string path = param[0].ParameterValue;

                        addQuickSet = new STSharePointQuickSetData(path, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }

                    break;

                case "USB":
                    _currentType = "USB";
                    if (STUSBQuickSetData.Validate(param))
                    {
                        addQuickSet = new STUSBQuickSetData(name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }
                    break;

                case "Fax":
                    _currentType = "Fax";
                    if (ScanFaxQuickSetData.Validate(param))
                    {
                        string number = param[0].ParameterValue;

                        addQuickSet = new ScanFaxQuickSetData(number, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }
                    break;

                case "FTP":
                    _currentType = "FTP";
                    if (FTPQuickSetData.Validate(param))
                    {
                        List <string> ftpPaths = param.Select(x => x.ParameterValue).ToList();

                        addQuickSet = new FTPQuickSetData(ftpPaths, name_TextBox.Text, _currentType, scanSettingsData, fileSettingsData);
                        _quickSetList.QuickSetData.Key.Add(addQuickSet);
                        _viewList.Add(new QuickSetTableData(addQuickSet.QName, addQuickSet.QType));
                        success = true;
                    }
                    break;

                default:
                    throw new Exception("Quick Set Type is unhandled, failed to create.");
                }
            }
            else
            {
                success      = false;
                errorMessage = "A quick set name is required.";
            }

            if (!success)
            {
                MessageBox.Show(errorMessage, "Parameter Format", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            quickSetTableDataBindingSource.ResetBindings(false);
            if (_viewList.Count > 0)
            {
                save_changes.Enabled = true;
            }
        }