SetSelected() public méthode

public SetSelected ( int index, bool value ) : void
index int
value bool
Résultat void
Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Create an instance of the ListBox.
            ListBox listBox1 = new ListBox();
            // Set the size and location of the ListBox.
            listBox1.Size = new System.Drawing.Size(200, 100);
            listBox1.Location = new System.Drawing.Point(10, 10);
            // Add the ListBox to the form.
            this.Controls.Add(listBox1);
            // Set the ListBox to display items in multiple columns.
            listBox1.MultiColumn = true;
            // Set the selection mode to multiple and extended.
            listBox1.SelectionMode = SelectionMode.MultiExtended;

            // Shutdown the painting of the ListBox as items are added.
            listBox1.BeginUpdate();
            // Loop through and add 50 items to the ListBox.
            for (int x = 1; x <= 50; x++)
            {
                listBox1.Items.Add("Item " + x.ToString());
            }
            // Allow the ListBox to repaint and display the new items.
            listBox1.EndUpdate();

            // Select three items from the ListBox.
            listBox1.SetSelected(1, true);
            listBox1.SetSelected(3, true);
            listBox1.SetSelected(5, true);

            // Display the second selected item in the ListBox to the console.
            System.Diagnostics.Debug.WriteLine(listBox1.SelectedItems[1].ToString());
            // Display the index of the first selected item in the ListBox.
            System.Diagnostics.Debug.WriteLine(listBox1.SelectedIndices[0].ToString());
        }
Exemple #2
0
		private void SelectAll(ListBox listBox)
		{
			for (int i = 0; i < listBox.Items.Count; ++i)
			{
				listBox.SetSelected(i, true);
			}
		}
 public static void SetObjectTimeSlots(ListBox listBoxRoom, IEnumerable<TimeSlot> timeSlots)
 {
     listBoxRoom.ClearSelected();
     foreach (var timeSlot in timeSlots)
     {
         for (uint i = timeSlot.StartHour; i < timeSlot.EndHour; i++)
         {
             listBoxRoom.SetSelected((int)i - 7, true);
         }
     }
 }
Exemple #4
0
 public static void RemoveSelectedObjects(ListBox lst, ArrayList Arr = null)
 {
     if (lst == null) return;
     int MaxPos = 0;
     for (int k = 0; k < lst.Items.Count; k++)
     {
         if (lst.GetSelected(k))
         {
             MaxPos = k;
             lst.Items.RemoveAt(k);
             if (Arr != null)
                 Arr.RemoveAt(k);
             k--;
         }
     }
     if (lst.Items.Count > 0)
         if (MaxPos < lst.Items.Count)
             lst.SetSelected(MaxPos, true);
         else
             lst.SetSelected(lst.Items.Count - 1, true);
 }
Exemple #5
0
 //检查item是否重复,重复返回true
 public static bool CheckRepeatItem(ListBox lb, object item)
 {
     for (int i = 0; i < lb.Items.Count; i++)
     {
         if (lb.Items[i].ToString().ToLower() == item.ToString().ToLower())
         {
             lb.SetSelected(i, true);  //重复选定Item
             return true;
         }
     }
     return false;
 }
        private void PopulateProductList()
        {
            // This procedure populates the list box on the
            // form with a list of available products from the
            // Northwind database.

            SqlConnection cnSQL       = null;
            SqlCommand    cmSQL       = null;
            SqlDataReader drSQL       = null;
            String        strSQL      = null;
            ListItem      objListItem = null;

            try {
                // Build Select statement to query product names from the products
                // table.
                strSQL = "SELECT ProductName, ProductID FROM Products";

                cnSQL = new SqlConnection(ConnectionString);
                cnSQL.Open();

                cmSQL = new SqlCommand(strSQL, cnSQL);
                drSQL = cmSQL.ExecuteReader();

                lstProducts.Items.Clear();

                // } through the result set using the datareader class.
                // The datareader is used here because all that is needed
                // is a forward only cursor which is more efficient.
                while (drSQL.Read())
                {
                    objListItem = new ListItem(drSQL["ProductName"].ToString(),
                                               Int32.Parse(drSQL["ProductID"].ToString()));
                    lstProducts.Items.Add(objListItem);
                }

                if (lstProducts.Items.Count > 0)
                {
                    lstProducts.SetSelected(0, true);
                }

                // Close and Clean up objects
                drSQL.Close();
                cnSQL.Close();
                cmSQL.Dispose();
                cnSQL.Dispose();
            } catch (SqlException e) {
                MessageBox.Show(e.Message);
            } catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
Exemple #7
0
        internal void SelectAll(DbSchemaPanel dbSchemaPanel, CslaGeneratorUnit currentUnit)
        {
            /*
             *      currentUnit.Params.CreateReadOnlyObjectsCopySoftDelete
             */

            // select all columns in list, except for the exceptions
            for (int i = 0; i < lstColumns.Items.Count; i++)
            {
                var columnName       = ((SqlColumnInfo)lstColumns.Items[i]).ColumnName;
                var columnNativeType = ((SqlColumnInfo)lstColumns.Items[i]).NativeTypeName;

                // exception for soft delete column
                if (dbSchemaPanel.UseBoolSoftDelete &&
                    currentUnit.Params.SpBoolSoftDeleteColumn == columnName)
                {
                    continue;
                }

                // exception for auditing columns
                if (!currentUnit.Params.ReadOnlyObjectsCopyAuditing &&
                    IsAuditingColumn(currentUnit, columnName))
                {
                    continue;
                }

                // exception for NativeType timestamp
                if (!currentUnit.Params.ReadOnlyObjectsCopyTimestamp &&
                    columnNativeType == "timestamp")
                {
                    continue;
                }

                // none of the exceptions, so go ahead
                lstColumns.SetSelected(i, true);
            }
            RefreshColumns();
        }
 private void FormDailySummary_Load(object sender, System.EventArgs e)
 {
     _listProviders       = Providers.GetListReports();
     date1.SelectionStart = DateTime.Today;
     date2.SelectionStart = DateTime.Today;
     if (!Security.IsAuthorized(Permissions.ReportDailyAllProviders, true))
     {
         //They either have permission or have a provider at this point.  If they don't have permission they must have a provider.
         _listProviders       = _listProviders.FindAll(x => x.ProvNum == Security.CurUser.ProvNum);
         checkAllProv.Checked = false;
         checkAllProv.Enabled = false;
     }
     for (int i = 0; i < _listProviders.Count; i++)
     {
         listProv.Items.Add(_listProviders[i].GetLongDesc());
     }
     if (checkAllProv.Enabled == false && _listProviders.Count > 0)
     {
         listProv.SetSelected(0, true);
     }
     if (!PrefC.HasClinicsEnabled)
     {
         listClin.Visible     = false;
         labelClin.Visible    = false;
         checkAllClin.Visible = false;
     }
     else
     {
         _listClinics = Clinics.GetForUserod(Security.CurUser);
         if (!Security.CurUser.ClinicIsRestricted)
         {
             listClin.Items.Add(Lan.g(this, "Unassigned"));
             listClin.SetSelected(0, true);
         }
         for (int i = 0; i < _listClinics.Count; i++)
         {
             int curIndex = listClin.Items.Add(_listClinics[i].Abbr);
             if (Clinics.ClinicNum == 0)
             {
                 listClin.SetSelected(curIndex, true);
                 checkAllClin.Checked = true;
             }
             if (_listClinics[i].ClinicNum == Clinics.ClinicNum)
             {
                 listClin.SelectedIndices.Clear();
                 listClin.SetSelected(curIndex, true);
             }
         }
     }
 }
Exemple #9
0
        private void btnTypeDel_Click(object sender, System.EventArgs e)
        {
            frmMain.labStatus.Text = "";
            int nindex = lstType.SelectedIndex;

            if (nindex < 0)
            {
                frmMain.labStatus.Text = "Please select one item first!";
                return;
            }
            lstType.Items.RemoveAt(lstType.SelectedIndex);
            if (lstType.Items.Count > 0)
            {
                if (nindex < lstType.Items.Count)
                {
                    lstType.SetSelected(nindex, true);
                }
                else
                {
                    lstType.SetSelected(lstType.Items.Count - 1, true);
                }
            }
        }
        private void RefreshAccountList()
        {
            this.listBox1.Items.Clear();
            IEnumerator <IAccount> ide = Accounts.GetAccounts().GetEnumerator();

            while (ide.MoveNext())
            {
                string accname = ide.Current.Username;
                if (accname != null)
                {
                    listBox1.Items.Add(accname);
                }
            }

            if (listBox1.Items.Count > 0)
            {
                listBox1.SetSelected(0, true);
            }
            else
            {
                EmptyAccountInfo();
            }
        }
Exemple #11
0
        private void btnMoveUp_Click(object sender, System.EventArgs e)
        {
            ListBox.SelectedIndexCollection indices = lstPhotos.SelectedIndices;
            int[] newSelects = new int[indices.Count];

            // Move the selected items up
            for (int i = 0; i < indices.Count; i++)
            {
                int index = indices[i];
                _album.MoveBefore(index);
                newSelects[i] = index - 1;
            }

            _bAlbumChanged = true;
            UpdateList();

            // Reset the selections.
            lstPhotos.ClearSelected();
            foreach (int x in newSelects)
            {
                lstPhotos.SetSelected(x, true);
            }
        }
Exemple #12
0
        private void FillList()
        {
            listConditions.Items.Clear();
            foreach (string s in Enum.GetNames(typeof(AutoCondition)))
            {
                listConditions.Items.Add(Lan.g("enumAutoConditions", s));
            }
            List <AutoCodeCond> listAutoCodeConds = AutoCodeConds.GetWhere(x => x.AutoCodeItemNum == AutoCodeItemCur.AutoCodeItemNum);

            for (int i = 0; i < listAutoCodeConds.Count; i++)
            {
                listConditions.SetSelected((int)listAutoCodeConds[i].Cond, true);
            }
        }
Exemple #13
0
 private void FillList()
 {
     listConditions.Items.Clear();
     foreach (string s in Enum.GetNames(typeof(AutoCondition)))
     {
         listConditions.Items.Add(Lan.g("enumAutoConditions", s));
     }
     for (int i = 0; i < AutoCodeConds.List.Length; i++)
     {
         if (AutoCodeConds.List[i].AutoCodeItemNum == AutoCodeItemCur.AutoCodeItemNum)
         {
             listConditions.SetSelected((int)AutoCodeConds.List[i].Cond, true);
         }
     }
 }
Exemple #14
0
 /// <summary>
 ///     Reloads items in the <c>ListBox</c>. If items are not sorted,
 ///     selections are kept.
 /// </summary>
 /// <param name="listBox">
 ///     <c>ListBox</c> to localize.
 /// </param>
 /// <param name="resources">
 ///     <c>ResourceManager</c> object.
 /// </param>
 private void ReloadListBoxItems(System.Windows.Forms.ListBox listBox, System.Resources.ResourceManager resources)
 {
     if (listBox.Items.Count > 0)
     {
         int[] selectedItems = new int[listBox.SelectedIndices.Count];
         listBox.SelectedIndices.CopyTo(selectedItems, 0);
         ReloadItems(listBox.Name, listBox.Items, listBox.Items.Count, resources);
         if (!listBox.Sorted)
         {
             for (int i = 0; i < selectedItems.Length; i++)
             {
                 listBox.SetSelected(selectedItems[i], true);
             }
         }
     }
 }
        private void FormScheduleDayEdit_Load(object sender, System.EventArgs e)
        {
            listType.Items.Clear();
            for (int i = 0; i < DefC.Short[(int)DefCat.BlockoutTypes].Length; i++)
            {
                listType.Items.Add(DefC.Short[(int)DefCat.BlockoutTypes][i].ItemName);
                if (SchedCur.BlockoutType == DefC.Short[(int)DefCat.BlockoutTypes][i].DefNum)
                {
                    listType.SelectedIndex = i;
                }
            }
            if (listType.Items.Count == 0)
            {
                MsgBox.Show(this, "You must setup blockout types first in Setup-Definitions.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (listType.SelectedIndex == -1)
            {
                listType.SelectedIndex = 0;
            }
            listOp.Items.Clear();
            //listOp.Items.Add(Lan.g(this,"All Ops"));
            //listOp.SelectedIndex=0;
            for (int i = 0; i < OperatoryC.ListShort.Count; i++)
            {
                listOp.Items.Add(OperatoryC.ListShort[i].Abbrev);
                if (SchedCur.Ops.Contains(OperatoryC.ListShort[i].OperatoryNum))
                {
                    listOp.SetSelected(i, true);
                }
            }
            DateTime time;

            for (int i = 0; i < 24; i++)
            {
                time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i);
                comboStart.Items.Add(time.ToShortTimeString());
                comboStop.Items.Add(time.ToShortTimeString());
            }
            comboStart.Text = SchedCur.StartTime.ToShortTimeString();
            comboStop.Text  = SchedCur.StopTime.ToShortTimeString();
            textNote.Text   = SchedCur.Note;
            comboStart.Select();
        }
Exemple #16
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            string[] arrStr = { "One", "Two", "Three", "Foure", "Five", "Six", "Seven", "Eight", "Nine", "Ten" };
            foreach (string i in arrStr)
            {
                ListBox1.Items.Add(i);
            }
            ListBox1.SetSelected(5, true);

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Exemple #17
0
 //<Snippet1>
 private void FindMyString(string searchString)
 {
     // Ensure we have a proper string to search for.
     if (!string.IsNullOrEmpty(searchString))
     {
         // Find the item in the list and store the index to the item.
         int index = listBox1.FindString(searchString);
         // Determine if a valid index is returned. Select the item if it is valid.
         if (index != -1)
         {
             listBox1.SetSelected(index, true);
         }
         else
         {
             MessageBox.Show("The search string did not match any items in the ListBox");
         }
     }
 }
Exemple #18
0
        //<Snippet1>
        private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            // Get the currently selected item in the ListBox.
            string curItem = listBox1.SelectedItem.ToString();

            // Find the string in ListBox2.
            int index = listBox2.FindString(curItem);

            // If the item was not found in ListBox 2 display a message box, otherwise select it in ListBox2.
            if (index == -1)
            {
                MessageBox.Show("Item is not available in ListBox2");
            }
            else
            {
                listBox2.SetSelected(index, true);
            }
        }
        private void listLetters_DoubleClick(object sender, System.EventArgs e)
        {
            if (listLetters.SelectedIndex == -1)
            {
                return;
            }
            int                 selectedRow = listLetters.SelectedIndex;
            LetterMerge         letter      = ListForCat[listLetters.SelectedIndex];
            FormLetterMergeEdit FormL       = new FormLetterMergeEdit(letter);

            FormL.ShowDialog();
            FillLetters();
            if (listLetters.Items.Count > selectedRow)
            {
                listLetters.SetSelected(selectedRow, true);
            }
            changed = true;
        }
Exemple #20
0
 //<Snippet1>
 private void FindMySpecificString(string searchString)
 {
     // Ensure we have a proper string to search for.
     if (searchString != string.Empty)
     {
         // Find the item in the list and store the index to the item.
         int index = listBox1.FindStringExact(searchString);
         // Determine if a valid index is returned. Select the item if it is valid.
         if (index != ListBox.NoMatches)
         {
             listBox1.SetSelected(index, true);
         }
         else
         {
             MessageBox.Show("The search string did not find any items in the ListBox that exactly match the specified search string");
         }
     }
 }
Exemple #21
0
        private void Add_Value()
        {
            int    nSelected;
            string selectedFactor;
            int    nCurrentidx;
            bool   duplicateFound = false;

            string strValue = txtBoxValues.Text.Replace(" ", "_");

            if (lstBoxFactors.Items.Count == 1)
            {
                lstBoxFactors.SetSelected(0, true);
            }
            nSelected = lstBoxFactors.SelectedIndex;
            if (nSelected < 0)
            {
                MessageBox.Show("Select a factor first to define their values.", "No Selection", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (lstBoxValues.Items.Count == MAX_LEVELS)
            {
                MessageBox.Show("You have reached the maximum number of values allowed.", "Max Factor Count", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (strValue != "")
            {
                lstBoxValues.SelectedIndex = -1;
                selectedFactor             = lstBoxFactors.SelectedItem.ToString();
                fillFactorArray();
                nCurrentidx = Array.IndexOf(strarrFactors, selectedFactor);

                duplicateFound = foundDuplicates(strValue);

                if (!duplicateFound)
                {
                    txtBoxValues.Text = "";
                    lstBoxValues.Items.Add(strValue);
                    marrFactors[nCurrentidx].marrValues.Add(strValue);
                }
                else
                {
                    MessageBox.Show("You have already entered this value earlier!", "Duplicate Value", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemple #22
0
        public static int UI_LISTBOX_SELECT(System.Windows.Forms.ListBox Listbox, string sItem, bool bZeroBase = true)
        {
            int nIndex;

            nIndex = Listbox.FindStringExact(sItem);
            // Determine if a valid index is returned. Select the item if it is valid.

            if (nIndex < 0 && bZeroBase)
            {
                nIndex = -1;
            }

            if (nIndex >= 0)
            {
                if (Listbox.Items.Count > 0)
                {
                    Listbox.SetSelected(nIndex, true);
                }
            }
            return(nIndex);
        }
		private void FormRpReceivablesBreakdown_Load(object sender,EventArgs e) {
			_listProvs=Providers.GetListReports();
			radioWriteoffPay.Checked = true;
			listProv.Items.Add(Lan.g(this,"Practice"));
			for(int i = 0;i < _listProvs.Count;i++) {
				listProv.Items.Add(_listProvs[i].GetLongDesc());
			}
			listProv.SetSelected(0,true);
			//if(PrefC.GetBool(PrefName.EasyNoClinics")){
			listClinic.Visible = false;
			labClinic.Visible = false;
			/*}
			else{
					listClinic.Items.Add(Lan.g(this,"Unassigned"));
					listClinic.SetSelected(0,true);
					for(int i=0;i<Clinics.List.Length;i++) {
							listClinic.Items.Add(Clinics.List[i].Description);
							listClinic.SetSelected(i+1,true);
					}
			}*/
		}
Exemple #24
0
        public static void MoveItem(int direction, bool env, ListBox currentListBox, LoadedSettings loadedSettings)
        {
            // Checking selected item
            if (currentListBox.SelectedItem == null || currentListBox.SelectedIndex < 0)
                return; // No selected item - nothing to do

            // Calculate new index using move direction
            int newIndex = currentListBox.SelectedIndex + direction;

            // Checking bounds of the range
            if (newIndex < 0 || newIndex >= currentListBox.Items.Count)
                return; // Index out of range - nothing to do

            object selected = currentListBox.SelectedItem;

            // Removing removable element
            currentListBox.Items.Remove(selected);
            // Insert it in new position
            currentListBox.Items.Insert(newIndex, selected);
            // Restore selection
            currentListBox.SetSelected(newIndex, true);
            // Save changes
            SetCurrentOrderFromListBoxAndSave(env, currentListBox, loadedSettings);
        }
        private void FillForm()
        {
            //this is not refined enough to be called more than once on the form because it will not
            //remember the toolbars that were selected.
            ToolButItems.RefreshCache();
            ProgramProperties.RefreshCache();
            textProgName.Text      = ProgramCur.ProgName;
            textProgDesc.Text      = ProgramCur.ProgDesc;
            checkEnabled.Checked   = ProgramCur.Enabled;
            textPath.Text          = ProgramCur.Path;
            textCommandLine.Text   = ProgramCur.CommandLine;
            textPluginDllName.Text = ProgramCur.PluginDllName;
            textNote.Text          = ProgramCur.Note;
            pictureBox.Image       = PIn.Bitmap(ProgramCur.ButtonImage);
            List <ToolButItem> itemsForProgram = ToolButItems.GetForProgram(ProgramCur.ProgramNum);

            listToolBars.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++)
            {
                listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]);
            }
            for (int i = 0; i < itemsForProgram.Count; i++)
            {
                listToolBars.SetSelected((int)itemsForProgram[i].ToolBar, true);
            }
            if (!AllowToolbarChanges)             //As we add more static bridges, we will need to enhance this to show/hide controls as needed.
            {
                listToolBars.ClearSelected();
                listToolBars.Enabled = false;
            }
            if (itemsForProgram.Count > 0)          //the text on all buttons will be the same for now
            {
                textButtonText.Text = itemsForProgram[0].ButtonText;
            }
            FillGrid();
        }
        private void FormRpProdGoal_Load(object sender, System.EventArgs e)
        {
            _listProviders         = Providers.GetListReports();
            _listFilteredProviders = new List <Provider>();
            textToday.Text         = DateTime.Today.ToShortDateString();
            textDateFrom.Text      = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).ToShortDateString();
            textDateTo.Text        = new DateTime(DateTime.Today.Year, DateTime.Today.Month
                                                  , DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month)).ToShortDateString();
            if (!Security.IsAuthorized(Permissions.ReportProdIncAllProviders, true))
            {
                //They either have permission or have a provider at this point.  If they don't have permission they must have a provider.
                _listProviders = _listProviders.FindAll(x => x.ProvNum == Security.CurUser.ProvNum);
                Provider prov = _listProviders.FirstOrDefault();
                if (prov != null)
                {
                    _listProviders.AddRange(Providers.GetWhere(x => x.FName == prov.FName && x.LName == prov.LName && x.ProvNum != prov.ProvNum));
                }
                checkAllProv.Checked = false;
                checkAllProv.Enabled = false;
            }
            //Fill the short list of providers, ignoring those marked "hidden on reports"
            for (int i = 0; i < _listProviders.Count; i++)
            {
                if (_listProviders[i].IsHiddenReport)
                {
                    continue;
                }
                listProv.Items.Add(_listProviders[i].GetLongDesc());
                _listFilteredProviders.Add(_listProviders[i].Copy());
            }
            //If the user is not allowed to run the report for all providers, default the selection to the first in the list box.
            if (checkAllProv.Enabled == false && listProv.Items.Count > 0)
            {
                listProv.SetSelected(0, true);
            }
            //If the user cannot run this report for any other provider, every single provider available in the list will be the provider logged in.
            if (!Security.IsAuthorized(Permissions.ReportProdIncAllProviders, true))
            {
                for (int i = 0; i < listProv.Items.Count; i++)
                {
                    listProv.SetSelected(i, true);
                }
            }
            if (!PrefC.HasClinicsEnabled)
            {
                listClin.Visible             = false;
                labelClin.Visible            = false;
                checkAllClin.Visible         = false;
                checkClinicBreakdown.Visible = false;
            }
            else
            {
                checkClinicBreakdown.Checked = PrefC.GetBool(PrefName.ReportPandIhasClinicBreakdown);
                _listClinics = Clinics.GetForUserod(Security.CurUser);
                if (!Security.CurUser.ClinicIsRestricted)
                {
                    listClin.Items.Add(Lan.g(this, "Unassigned"));
                    listClin.SetSelected(0, true);
                }
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    int curIndex = listClin.Items.Add(_listClinics[i].Abbr);
                    if (Clinics.ClinicNum == 0)
                    {
                        listClin.SetSelected(curIndex, true);
                        checkAllClin.Checked = true;
                    }
                    if (_listClinics[i].ClinicNum == Clinics.ClinicNum)
                    {
                        listClin.SelectedIndices.Clear();
                        listClin.SetSelected(curIndex, true);
                    }
                }
            }
            switch (PrefC.GetInt(PrefName.ReportsPPOwriteoffDefaultToProcDate))
            {
            case 0: radioWriteoffPay.Checked = true; break;

            case 1: radioWriteoffProc.Checked = true; break;

            case 2: radioWriteoffClaim.Checked = true; break;

            default:
                radioWriteoffClaim.Checked = true; break;
            }
            Text += PrefC.ReportingServer.DisplayStr == "" ? "" : " - " + Lan.g(this, "Reporting Server:") + " " + PrefC.ReportingServer.DisplayStr;
        }
        public static void moveSelectedField(ListBox listBoxSelected, bool bUp)
        {
            if (listBoxSelected == null)
            return;

             int nFirstSelndex = -1;
             int nSelCount = 0;
             if (bUp) //move up
             {
            nFirstSelndex = listBoxSelected.SelectedIndices[0];
            nSelCount = listBoxSelected.SelectedIndices.Count;
            string str = listBoxSelected.Items[nFirstSelndex - 1].ToString();
            listBoxSelected.Items.RemoveAt(nFirstSelndex - 1);
            listBoxSelected.Items.Insert(nFirstSelndex + nSelCount - 1, str);

            nFirstSelndex = nFirstSelndex - 1;
             }
             else //move down
             {
            nFirstSelndex = listBoxSelected.SelectedIndices[0];
            nSelCount = listBoxSelected.SelectedIndices.Count;
            int nLastSelIndex = nFirstSelndex + nSelCount - 1;

            string str = listBoxSelected.Items[nLastSelIndex + 1].ToString();
            listBoxSelected.Items.RemoveAt(nLastSelIndex + 1);
            listBoxSelected.Items.Insert(nFirstSelndex, str);

            nFirstSelndex = nFirstSelndex + 1;
             }

             listBoxSelected.SelectedItems.Clear();
             for (int ii = 0; ii < nSelCount; ++ii)
             {
            listBoxSelected.SetSelected(nFirstSelndex + ii, true);
             }
        }
 internal void UpdateLbSheets(ref ListBox lbWSheets)
 {
     lbWSheets.Items.Clear();
     xlWSheets = xlWBook.Sheets;
     foreach (Excel.Worksheet wsht in xlWSheets)
     {
         lbWSheets.Items.Add(wsht.Name);
     }
     int qry = 0;
     try
     {
         qry = lbWSheets.Items.Cast<string>().Select((item, i) => new { Ite = item, index = i }).FirstOrDefault(it => Regex.IsMatch(it.Ite, ".*inventory.*", RegexOptions.IgnoreCase)).index;
     }
     catch (Exception) { }
     lbWSheets.SetSelected(qry, true);
     xlWsheet = xlWSheets[qry + 1];
 }
 private void visaPersoner2( ListBox lst, PlataDM.Grupp grupp, PlataDM.GruppPersonTyp typ, Hashtable valda )
 {
     foreach( PlataDM.Person person in grupp.PersonerVal(typ) )
     {
         int nIndex = lst.Items.Add( new clsPHelper( grupp, person, typ ) );
         if ( valda!=null && valda.ContainsKey(person) )
             lst.SetSelected( nIndex, true );
     }
 }
Exemple #30
0
 public void SetSelectedListBoxIdx(ListBox anything, int idx, bool state)
 {
     anything.BeginInvoke((MethodInvoker)delegate
     {
         try
         {
             anything.SetSelected(idx, state);
         }
         catch
         {
         }
     });
 }
Exemple #31
0
 private void ListDescricao_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     ListCodigo.SetSelected(ListDescricao.SelectedIndex, true);
     ListValor.SetSelected(ListDescricao.SelectedIndex, true);
 }
Exemple #32
0
 private void FillPatSelect()
 {
     listPatSelect.Items.Clear();
     listPatSelect.Items.Add("PatNum");
     listPatSelect.Items.Add("LName");
     listPatSelect.Items.Add("FName");
     listPatSelect.Items.Add("MiddleI");
     listPatSelect.Items.Add("Preferred");
     listPatSelect.Items.Add("Salutation");
     listPatSelect.Items.Add("Address");
     listPatSelect.Items.Add("Address2");
     listPatSelect.Items.Add("City");
     listPatSelect.Items.Add("State");
     listPatSelect.Items.Add("Zip");
     listPatSelect.Items.Add("HmPhone");
     listPatSelect.Items.Add("WkPhone");
     listPatSelect.Items.Add("WirelessPhone");
     listPatSelect.Items.Add("Birthdate");
     listPatSelect.Items.Add("Email");
     listPatSelect.Items.Add("SSN");
     listPatSelect.Items.Add("Gender");
     listPatSelect.Items.Add("PatStatus");
     listPatSelect.Items.Add("Position");
     listPatSelect.Items.Add("CreditType");
     listPatSelect.Items.Add("BillingType");
     listPatSelect.Items.Add("ChartNumber");
     listPatSelect.Items.Add("PriProv");
     listPatSelect.Items.Add("SecProv");
     listPatSelect.Items.Add("FeeSched");
     listPatSelect.Items.Add("ApptModNote");
     listPatSelect.Items.Add("AddrNote");
     listPatSelect.Items.Add("EstBalance");
     listPatSelect.Items.Add("FamFinUrgNote");
     listPatSelect.Items.Add("Guarantor");
     listPatSelect.Items.Add("ImageFolder");
     listPatSelect.Items.Add("MedUrgNote");
     listPatSelect.Items.Add("NextAptNum");
     //listPatSelect.Items.Add("PriPlanNum");//Primary Carrier?
     //listPatSelect.Items.Add("PriRelationship");// ?
     //listPatSelect.Items.Add("SecPlanNum");//Secondary Carrier?
     //listPatSelect.Items.Add("SecRelationship");// ?
     //listPatSelect.Items.Add("RecallInterval"));
     //listPatSelect.Items.Add("RecallStatus");
     listPatSelect.Items.Add("SchoolName");
     listPatSelect.Items.Add("StudentStatus");
     listPatSelect.Items.Add("MedicaidID");
     listPatSelect.Items.Add("Bal_0_30");
     listPatSelect.Items.Add("Bal_31_60");
     listPatSelect.Items.Add("Bal_61_90");
     listPatSelect.Items.Add("BalOver90");
     listPatSelect.Items.Add("InsEst");
     listPatSelect.Items.Add("PrimaryTeeth");
     listPatSelect.Items.Add("BalTotal");
     listPatSelect.Items.Add("EmployerNum");
     //EmploymentNote
     listPatSelect.Items.Add("Race");
     listPatSelect.Items.Add("County");
     listPatSelect.Items.Add("GradeSchool");
     listPatSelect.Items.Add("GradeLevel");
     listPatSelect.Items.Add("Urgency");
     listPatSelect.Items.Add("DateFirstVisit");
     //listPatSelect.Items.Add("PriPending");
     //listPatSelect.Items.Add("SecPending");
     for (int i = 0; i < LetterMergeCur.Fields.Count; i++)
     {
         for (int j = 0; j < listPatSelect.Items.Count; j++)
         {
             if (listPatSelect.Items[j].ToString() == (string)LetterMergeCur.Fields[i])
             {
                 listPatSelect.SetSelected(j, true);
             }
         }
     }
 }
        /// <summary>
        /// Add the selected items from the specified source <c>ListBox</c> control to the specified destination <c>ListBox</c> control.
        /// </summary>
        /// <param name="listSource">The source <c>ListBox</c> control.</param>
        /// <param name="listDestination">the destination <c>ListBox</c> control.</param>
        protected override void Add(ref ListBox listSource, ref ListBox listDestination)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            int count = listSource.SelectedItems.Count;
            int currentIndex = listSource.SelectedIndex;

            // Skip, if no items have been selected.
            if (count == 0)
            {
                return;
            }

            if ((m_ListItemCount + count) > Parameter.SizeTestList)
            {
                MessageBox.Show(Resources.MBTSelfTestsMaxExceeded, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Cursor = Cursors.WaitCursor;

            // ---------------------------------------------------------------------------------------
            // For each selected item: (a) add this to the destination list and update the added flag.
            // ---------------------------------------------------------------------------------------
            int selfTestIdentifier;
            for (int index = 0; index < count; ++index)
            {
                // Add the item to the destination list.
                listDestination.Items.Add(listSource.SelectedItems[index]);

                // Keep track of the number of tests that have been added to the test list.
                m_ListItemCount++;

                selfTestIdentifier = ((TestItem_t)listSource.SelectedItems[index]).SelfTestIdentifier;

                // Keep track of which watch variables have been removed.
                m_TestItems[selfTestIdentifier].Added = true;

                AddSupplementalFields(selfTestIdentifier);
            }

            UpdateCount();

            // Highlight the next item for processing if the list is not empty.
            if (listSource.Items.Count > 0)
            {
                // Bounds checking.
                if (currentIndex < listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex;
                }
                else if (currentIndex == listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex - 1;
                }
            }

            // Scroll to the end of the list.
            listDestination.SetSelected(listDestination.Items.Count - 1, true);
            listDestination.ClearSelected();

            m_ButtonApply.Enabled = true;
            OnDataUpdate(this, new EventArgs());
            Cursor = Cursors.Default;
        }
Exemple #34
0
		private void AddListBoxTest(Control c)
		{
			listBox1 = new ListBox();
			listBox1.Bounds = new Rectangle(10, 10, 200, 100);
			listBox2 = new ListBox();
			listBox2.Bounds = new Rectangle(10, 150, 200, 100);
			c.Controls.Add(listBox1);
			c.Controls.Add(listBox2);
			listBox1.MultiColumn = true;
			listBox1.SelectionMode = SelectionMode.MultiExtended;
			listBox1.ScrollAlwaysVisible = true;
			listBox1.BeginUpdate();
			for (int x = 1; x <= 50; x++)
			{
				listBox1.Items.Add("Item " + x.ToString());
			}
			listBox1.EndUpdate();
			listBox1.SetSelected(1, true);
			listBox1.SetSelected(3, true);
			listBox1.SetSelected(5, true);

			//Console.WriteLine(listBox1.SelectedItems[1].ToString());
			//Console.WriteLine(listBox1.SelectedIndices[0].ToString());

			listBox2.Items.Add("Item 1");
			listBox2.Items.Add("Item 2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
			listBox2.Enabled = false;

		}
 public void SelectMultiple(ListBox lb)
 {
     List<int> lst = SaveListBoxItems(lb);
     for (int a = 0; a < lstID.Count; a++)
     {
         for (int b = 0; b < lst.Count; b++)
         {
             if (lstID[a] == lst[b])
             {
                 lb.SetSelected(b, true);
             }
         }
     }
 }
        private void Move(ListBox listbox, int direction)
        {
            if (listbox.SelectedItem == null || listbox.SelectedIndex < 0)
                return;

            int newIndex = listbox.SelectedIndex - direction;

            if (newIndex < 0 || newIndex >= listbox.Items.Count)
                return;

            object selectedItem = listbox.SelectedItem;

            skip = true;
            listbox.Items.Remove(selectedItem);
            listbox.Items.Insert(newIndex, selectedItem);
            listbox.SetSelected(newIndex, true);
        }
Exemple #37
0
 private void FillPatSelect()
 {
     listPatSelect.Items.Clear();
     listPatSelect.Items.Add("PatNum");
     listPatSelect.Items.Add("LName");
     listPatSelect.Items.Add("FName");
     listPatSelect.Items.Add("MiddleI");
     listPatSelect.Items.Add("Preferred");
     listPatSelect.Items.Add("Title");
     listPatSelect.Items.Add("Salutation");
     listPatSelect.Items.Add("Address");
     listPatSelect.Items.Add("Address2");
     listPatSelect.Items.Add("City");
     listPatSelect.Items.Add("State");
     listPatSelect.Items.Add("Zip");
     listPatSelect.Items.Add("HmPhone");
     listPatSelect.Items.Add("WkPhone");
     listPatSelect.Items.Add("WirelessPhone");
     listPatSelect.Items.Add("Birthdate");
     listPatSelect.Items.Add("Email");
     listPatSelect.Items.Add("SSN");
     listPatSelect.Items.Add("Gender");
     listPatSelect.Items.Add("PatStatus");
     listPatSelect.Items.Add("Position");
     listPatSelect.Items.Add("CreditType");
     listPatSelect.Items.Add("BillingType");
     listPatSelect.Items.Add("ChartNumber");
     listPatSelect.Items.Add("PriProv");
     listPatSelect.Items.Add("SecProv");
     listPatSelect.Items.Add("FeeSched");
     listPatSelect.Items.Add("ApptModNote");
     listPatSelect.Items.Add("AddrNote");
     listPatSelect.Items.Add("EstBalance");
     listPatSelect.Items.Add("FamFinUrgNote");
     listPatSelect.Items.Add("Guarantor");
     listPatSelect.Items.Add("ImageFolder");
     listPatSelect.Items.Add("MedUrgNote");
     listPatSelect.Items.Add("NextAptNum");
     listPatSelect.Items.Add("SchoolName");
     listPatSelect.Items.Add("StudentStatus");
     listPatSelect.Items.Add("MedicaidID");
     listPatSelect.Items.Add("Bal_0_30");
     listPatSelect.Items.Add("Bal_31_60");
     listPatSelect.Items.Add("Bal_61_90");
     listPatSelect.Items.Add("BalOver90");
     listPatSelect.Items.Add("InsEst");
     listPatSelect.Items.Add("BalTotal");
     listPatSelect.Items.Add("EmployerNum");
     listPatSelect.Items.Add("Race");             //Race is depricated in the patient table, we get it from the PatientRace table entries converted into a PatientRaceOld enum value.
     listPatSelect.Items.Add("County");
     listPatSelect.Items.Add("GradeSchool");
     listPatSelect.Items.Add("GradeLevel");
     listPatSelect.Items.Add("Urgency");
     listPatSelect.Items.Add("DateFirstVisit");
     for (int i = 0; i < LetterMergeCur.Fields.Count; i++)
     {
         for (int j = 0; j < listPatSelect.Items.Count; j++)
         {
             if (listPatSelect.Items[j].ToString() == (string)LetterMergeCur.Fields[i])
             {
                 listPatSelect.SetSelected(j, true);
             }
         }
     }
 }
Exemple #38
0
        private void chklstFlowVersion_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.V8 &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.V8))
            {
                if (lstboxV8Aggregation.InvokeRequired)
                {
                    this.Invoke(new EventHandler(chklstFlowVersion_SelectedIndexChanged),
                                new object[] { sender, e });
                    return;
                }
                lstboxV8Aggregation.Visible = true;
                if (lstboxV8Aggregation.SelectedIndices.Count == 0)
                {
                    lstboxV8Aggregation.SetSelected(0, true);
                }
                v8aggregation = lstboxV8Aggregation.SelectedIndex + 1;
            }
            else
            {
                lstboxV8Aggregation.Visible = false;
            }

            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.V9 &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.V9))
            {
                if (v9Templates == null)
                {
                    v9Templates = new ArrayList();
                }
                V9TemplateList form = new V9TemplateList();
                form.StartPosition = FormStartPosition.CenterParent;
                form.V9Templates   = v9Templates;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    chklstFlowVersion.SetItemChecked((int)FlowVersionList.V9, false);
                }
            }
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.IPFIX &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.IPFIX))
            {
                if (ipfixTemplates == null)
                {
                    ipfixTemplates = new ArrayList();
                }
                FormIpfixTemplateList form = new FormIpfixTemplateList();
                form.StartPosition  = FormStartPosition.CenterParent;
                form.IpfixTemplates = ipfixTemplates;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    chklstFlowVersion.SetItemChecked((int)FlowVersionList.IPFIX, false);
                }
            }
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.SFLOW)
            {
                if (checkedListBoxSFlowVersion.InvokeRequired)
                {
                    this.Invoke(new EventHandler(chklstFlowVersion_SelectedIndexChanged),
                                new object[] { sender, e });
                    return;
                }
                bool hasOneCounterChecked = false;
                for (int i = 0; i < sFlowVersions.Length; ++i)
                {
                    if (sFlowVersions[i] == true)
                    {
                        hasOneCounterChecked = true;
                        break;
                    }
                }
                if (!hasOneCounterChecked)
                {
                    checkedListBoxSFlowVersion.SetItemChecked(0, true);
                }
                checkedListBoxSFlowVersion.Visible = true;
            }
            else
            {
                checkedListBoxSFlowVersion.Visible = false;
            }
        }
 internal InventoryWorkBookClass(ref ListBox lbWBooks, ref ListBox lbWSheets)
     : this()
 {
     xlWBooks = xlApp.Workbooks;
     if (xlWBooks.Count != 0)
     {
         foreach (Excel.Workbook wBook in xlWBooks)
         {
             lbWBooks.Items.Add(wBook.Name);
         }
         var qry = lbWBooks.Items.Cast<string>().FirstOrDefault(it => Regex.IsMatch(it, ".*inventory.*", RegexOptions.IgnoreCase));
         if (qry != null)
         {
             lbWBooks.SetSelected(lbWBooks.Items.IndexOf(qry), true);
             xlWBook = xlWBooks[lbWBooks.Items.IndexOf(qry) + 1];
         }
         else
         {
             xlWBook = xlWBooks[1];
             lbWBooks.SetSelected(0, true);
         }
         UpdateLbSheets(ref lbWSheets);
     }
     else
     {
         MessageBox.Show("There are no Excel Workbooks open.\rPlease open the Tax-Aide Inventory Workbook", "IDC Merge");
         xlApp = null;
         Environment.Exit(1);
     }
 }
        private void MoveItem(int direction, ListBox target)
        {
            // Remove alphabetizing.
            if (target.Sorted) { target.Sorted = false; }

            // Checking selected item
            if (target.SelectedItem == null || target.SelectedIndex < 0)
                return; // No selected item - nothing to do

            // Calculate new index using move direction
            int newIndex = target.SelectedIndex + direction;

            // Checking bounds of the range
            if (newIndex < 0 || newIndex >= target.Items.Count)
                return; // Index out of range - nothing to do

            object selected = target.SelectedItem;

            // Removing removable element
            target.Items.Remove(selected);
            // Insert it in new position
            target.Items.Insert(newIndex, selected);
            // Restore selection
            target.SetSelected(newIndex, true);
        }
Exemple #41
0
        private void RunProviderPayroll()
        {
            ReportComplex report = new ReportComplex(true, true);

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < listProv.Items.Count; i++)
                {
                    listProv.SetSelected(i, true);
                }
            }
            if (checkAllClin.Checked)
            {
                for (int i = 0; i < listClin.Items.Count; i++)
                {
                    listClin.SetSelected(i, true);
                }
            }
            dateFrom = dtPickerFrom.Value;
            dateTo   = dtPickerTo.Value;
            List <Provider> listProvs = new List <Provider>();

            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                listProvs.Add(_listProviders[listProv.SelectedIndices[i]]);
            }
            List <Clinic> listClinics = new List <Clinic>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinics.Add(_listClinics[listClin.SelectedIndices[i]]);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            Clinic unassigned = new Clinic();
                            unassigned.ClinicNum = 0;
                            unassigned.Abbr      = Lan.g(this, "Unassigned");
                            listClinics.Add(unassigned);
                        }
                        else
                        {
                            listClinics.Add(_listClinics[listClin.SelectedIndices[i] - 1]);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DataSet ds = RpProdInc.GetProviderPayrollDataForClinics(dateFrom, dateTo, listProvs, listClinics
                                                                    , checkAllProv.Checked, checkAllClin.Checked, radioDetailedReport.Checked);

            report.ReportName = "Provider Payroll P&I";
            report.AddTitle("Title", Lan.g(this, "Provider Payroll Production and Income"));
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString());
            if (checkAllProv.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                string str = "";
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        str += ", ";
                    }
                    str += _listProviders[listProv.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Providers", str);
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            //setup query
            QueryObject query;
            DataTable   dt = ds.Tables["Total"].Copy();

            query = report.AddQuery(dt, "", "", SplitByKind.None, 1, true);
            // add columns to report
            Font font = new Font("Tahoma", 8, FontStyle.Regular);

            query.AddColumn("Date", 70, FieldValueType.String, font);
            if (radioDetailedReport.Checked)
            {
                query.AddColumn("Patient", 160, FieldValueType.String, font);
            }
            else
            {
                query.AddColumn("Day", 70, FieldValueType.String, font);
            }
            query.AddColumn("UCR Production", 90, FieldValueType.Number, font);
            query.AddColumn("Est Writeoff", 80, FieldValueType.Number, font);
            query.AddColumn("Prod Adj", 80, FieldValueType.Number, font);
            query.AddColumn("Change in Writeoff", 100, FieldValueType.Number, font);
            query.AddColumn("Net Prod(NPR)", 80, FieldValueType.Number, font);
            query.AddColumn("Pat Inc Alloc", 80, FieldValueType.Number, font);
            query.AddColumn("Pat Inc Unalloc", 80, FieldValueType.Number, font);
            query.AddColumn("Ins Income", 80, FieldValueType.Number, font);
            query.AddColumn("Ins Not Final", 80, FieldValueType.Number, font);
            query.AddColumn("Net Income", 80, FieldValueType.Number, font);
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())             //Does not actually submit queries because we use datatables in the central management tool.
            {
                return;
            }
            // display the report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;//Allow running multiple reports.
        }
Exemple #42
0
        private void FormDunningEdit_Load(object sender, System.EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                labelClinic.Visible   = true;
                comboClinics.Visible  = true;
                butPickClinic.Visible = true;
                _listClinics          = Clinics.GetForUserod(Security.CurUser);
                if (!Security.CurUser.ClinicIsRestricted || DunningCur.ClinicNum == 0 /*???*/)
                {
                    _listClinics.Insert(0, new Clinic()
                    {
                        ClinicNum = 0, Abbr = "Unassigned", Description = "Unassigned"
                    });
                }
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    comboClinics.Items.Add(new ODBoxItem <Clinic>(_listClinics[i].Abbr, _listClinics[i]));
                    if (_listClinics[i].ClinicNum == DunningCur.ClinicNum)
                    {
                        comboClinics.SelectedIndex = comboClinics.Items.Count - 1;
                    }
                }
                if (comboClinics.SelectedIndex == -1)
                {
                    comboClinics.SelectedIndex = 0;                   //select 'Unassigned' by default
                }
            }
            listBillType.Items.Add(Lan.g(this, "all"));
            listBillType.SetSelected(0, true);
            _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true);
            for (int i = 0; i < _listBillingTypeDefs.Count; i++)
            {
                listBillType.Items.Add(_listBillingTypeDefs[i].ItemName);
                if (DunningCur.BillingType == _listBillingTypeDefs[i].DefNum)
                {
                    listBillType.SetSelected(i + 1, true);
                }
            }
            switch (DunningCur.AgeAccount)
            {
            case 0:
                radioAny.Checked = true;
                break;

            case 30:
                radio30.Checked = true;
                break;

            case 60:
                radio60.Checked = true;
                break;

            case 90:
                radio90.Checked = true;
                break;
            }
            switch (DunningCur.InsIsPending)
            {
            case YN.Unknown:
                radioU.Checked = true;
                break;

            case YN.Yes:
                radioY.Checked = true;
                break;

            case YN.No:
                radioN.Checked = true;
                break;
            }
            textDaysInAdvance.Text = DunningCur.DaysInAdvance.ToString();
            textDunMessage.Text    = DunningCur.DunMessage;
            textMessageBold.Text   = DunningCur.MessageBold;
            textEmailBody.Text     = DunningCur.EmailBody;
            textEmailSubject.Text  = DunningCur.EmailSubject;
        }
		void InitializeComponents()
		{
			cmbForeColor = (ComboBox)ControlDictionary["cmbForeColor"];
			lstElements = (ListBox)ControlDictionary["lstElements"];
			cbBold = (CheckBox)ControlDictionary["cbBold"];
			cbItalic = (CheckBox)ControlDictionary["cbItalic"];
			cbUnderline = (CheckBox)ControlDictionary["cbUnderline"];
			lblOffsetPreview = (Label)ControlDictionary["lblOffsetPreview"];
			lblDataPreview = (Label)ControlDictionary["lblDataPreview"];
			btnSelectFont = (Button)ControlDictionary["btnSelectFont"];
			
			nUDBytesPerLine = (NumericUpDown)ControlDictionary["nUDBytesPerLine"];
			dUDViewModes = (DomainUpDown)ControlDictionary["dUDViewModes"];
			cbFitToWidth = (CheckBox)ControlDictionary["cbFitToWidth"];
			
			txtExtensions = (TextBox)ControlDictionary["txtExtensions"];
			
			fdSelectFont = new FontDialog();
			
			// Initialize FontDialog
			fdSelectFont.FontMustExist = true;
			fdSelectFont.FixedPitchOnly = true;
			fdSelectFont.ShowEffects = false;
			fdSelectFont.ShowColor = false;
			
			cmbForeColor.Items.Add(StringParser.Parse("${res:Global.FontStyle.CustomColor}"));
			
			foreach (Color c in Colors) {
				cmbForeColor.Items.Add(c.Name);
			}
			
			lstElements.Items.Add(StringParser.Parse("${res:AddIns.HexEditor.Display.Elements.Offset}"));
			lstElements.Items.Add(StringParser.Parse("${res:AddIns.HexEditor.Display.Elements.Data}"));

			lstElements.SetSelected(0, true);
			
			foreach (string s in HexEditor.Util.ViewMode.GetNames(typeof(HexEditor.Util.ViewMode)))
			{
				dUDViewModes.Items.Add(s);
			}
			
			btnSelectFont.Click += new EventHandler(this.btnSelectFontClick);
			cmbForeColor.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbForeColorDrawItem);
			cmbForeColor.SelectedValueChanged += new EventHandler(this.cmbForeColorSelectedValueChanged);
			
			cmbForeColor.DropDown += cmbForeColorDropDown;
			
			cbBold.CheckedChanged += new EventHandler(this.cbBoldCheckedChanged);
			cbItalic.CheckedChanged += new EventHandler(this.cbItalicCheckedChanged);
			cbUnderline.CheckedChanged += new EventHandler(this.cbUnderlineCheckedChanged);
			
			lstElements.SelectedValueChanged += new EventHandler(this.lstElementsSelectedValueChanged);
		}
        private void RunNetProductionDetail()
        {
            ReportComplex report = new ReportComplex(true, true);

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < listProv.Items.Count; i++)
                {
                    listProv.SetSelected(i, true);
                }
            }
            if (checkAllClin.Checked)
            {
                for (int i = 0; i < listClin.Items.Count; i++)
                {
                    listClin.SetSelected(i, true);
                }
            }
            dateFrom = dtPickerFrom.Value;
            dateTo   = dtPickerTo.Value;
            if (radioTransactionalToday.Checked)
            {
                dateFrom = DateTime.Today;
                dateTo   = DateTime.Today;
            }
            List <Provider> listProvs = new List <Provider>();

            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                listProvs.Add(_listProviders[listProv.SelectedIndices[i]]);
            }
            List <Clinic> listClinics = new List <Clinic>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinics.Add(_listClinics[listClin.SelectedIndices[i]]);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            Clinic unassigned = new Clinic();
                            unassigned.ClinicNum = 0;
                            unassigned.Abbr      = Lan.g(this, "Unassigned");
                            listClinics.Add(unassigned);
                        }
                        else
                        {
                            listClinics.Add(_listClinics[listClin.SelectedIndices[i] - 1]);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            string reportName = "Provider Payroll Transactional Detailed";

            if (radioTransactionalToday.Checked)
            {
                reportName += " Today";
            }
            report.ReportName = reportName;
            report.AddTitle("Title", Lan.g(this, "Provider Payroll Transactional Report"));
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle));
            if (radioTransactionalToday.Checked)
            {
                report.AddSubTitle("Date", DateTime.Today.ToShortDateString());
            }
            else
            {
                report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString());
            }
            if (checkAllProv.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                string str = "";
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        str += ", ";
                    }
                    str += _listProviders[listProv.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Providers", str);
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            //setup query
            QueryObject query;
            DataTable   dt = RpProdInc.GetNetProductionDetailDataSet(dateFrom, dateTo, listProvs, listClinics
                                                                     , checkAllProv.Checked, checkAllClin.Checked, PrefC.GetBool(PrefName.NetProdDetailUseSnapshotToday));

            query = report.AddQuery(dt, "", "", SplitByKind.None, 1, true);
            // add columns to report
            Font font = new Font("Tahoma", 8, FontStyle.Regular);

            query.AddColumn("Type", 80, FieldValueType.String, font);
            query.AddColumn("Date", 70, FieldValueType.Date, font);
            query.AddColumn("Clinic", 70, FieldValueType.String, font);
            query.AddColumn("PatNum", 70, FieldValueType.String, font);
            query.AddColumn("Patient", 70, FieldValueType.String, font);
            query.AddColumn("ProcCode", 90, FieldValueType.String, font);
            query.AddColumn("Provider", 80, FieldValueType.String, font);
            query.AddColumn("UCR", 80, FieldValueType.Number, font);
            query.AddColumn("OrigEstWO", 100, FieldValueType.Number, font);
            query.AddColumn("EstVsActualWO", 80, FieldValueType.Number, font);
            query.AddColumn("Adjustment", 80, FieldValueType.Number, font);
            query.AddColumn("NPR", 80, FieldValueType.Number, font);
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())             //Does not actually submit queries because we use datatables in the central management tool.
            {
                return;
            }
            // display the report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;//Allow running multiple reports.
        }
        private void FormBillingOptions_Load(object sender, System.EventArgs e)
        {
            if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
            {
                if (MessageBox.Show(Lan.g(this, "Update aging first?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FormAging FormA = new FormAging();
                    FormA.ShowDialog();
                }
            }
            for (int i = 0; i < DefB.Short[(int)DefCat.BillingTypes].Length; i++)
            {
                listBillType.Items.Add(DefB.Short[(int)DefCat.BillingTypes][i].ItemName);
            }
            textLastStatement.Text      = DateTime.Today.AddMonths(-1).ToShortDateString();
            checkIncludeChanged.Checked = PrefB.GetBool("BillingIncludeChanged");
            string[] selectedBillTypes = ((Pref)PrefB.HList["BillingSelectBillingTypes"]).ValueString.Split(',');
            for (int i = 0; i < selectedBillTypes.Length; i++)
            {
                try{
                    int order = DefB.GetOrder(DefCat.BillingTypes, Convert.ToInt32(selectedBillTypes[i]));
                    if (order != -1)
                    {
                        listBillType.SetSelected(order, true);
                    }
                }
                catch {}
            }
            if (listBillType.SelectedIndices.Count == 0)
            {
                listBillType.SelectedIndex = 0;
            }
            switch (((Pref)PrefB.HList["BillingAgeOfAccount"]).ValueString)
            {
            default:
                radioAny.Checked = true;
                break;

            case "30":
                radio30.Checked = true;
                break;

            case "60":
                radio60.Checked = true;
                break;

            case "90":
                radio90.Checked = true;
                break;
            }
            if (((Pref)PrefB.HList["BillingExcludeBadAddresses"]).ValueString == "1")
            {
                checkBadAddress.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeInactive"]).ValueString == "1")
            {
                checkExcludeInactive.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeNegative"]).ValueString == "1")
            {
                checkExcludeNegative.Checked = true;
            }
            textExcludeLessThan.Text = ((Pref)PrefB.HList["BillingExcludeLessThan"]).ValueString;
            //blank is allowed
            FillDunning();
        }
 private void SelectAllTagsInList(string tags, ListBox listBox)
 {
     string[] tagList = tags.Split(new char[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
     foreach (string tag in tagList)
     {
         for (int i = 0; i < listBox.Items.Count; i++)
         {
             if (tag.Equals(listBox.Items[i].ToString(), StringComparison.CurrentCultureIgnoreCase))
             {
                 listBox.SetSelected(i, true);
                 break;
             }
         }
     }
 }
Exemple #47
0
 private void btnFilterAll(object sender, EventArgs e, ListBox lb, TextBox tb1, TextBox tb2, BindingList<string> lstDel, BindingList<string> lstAdd)
 {
     for (int index = 0; index < lb.Items.Count; index++)
     {
         lb.SetSelected(index, true);
     }
     btnFilter(sender, e, lb, tb1, tb2, lstDel, lstAdd);
 }
        public override void ControlsInit(Form gameWindow)
        {
            alignPanel = new Panel();
            alignPanel.AutoSize = true;
            alignPanel.BackColor = Color.Transparent;

            backgroundImage = new Panel();
            backgroundImage.Size = gameWindow.Size;
            backgroundImage.BackgroundImage = Resources.otherScreen;

            listBoxLevels = new ListBox();
            listBoxLevels.Size = new System.Drawing.Size(200, 200);
            listBoxLevels.Location = new System.Drawing.Point(0, 0);
            listBoxLevels.SelectedIndexChanged += highscoresController.level_Select;

            listBoxHighscores = new ListBox();
            listBoxHighscores.Size = new System.Drawing.Size(400, 210);
            listBoxHighscores.Location = new System.Drawing.Point(210, 0);
            listBoxHighscores.Font = new Font("Arial", 12);

            XMLParser.LoadAllLevels();
            foreach (XMLParser xml in XMLParser.Levels)
            {
                this.levels.Add(xml); //Ingeladen gegevens opslaan in lokale List voor hergebruik
                listBoxLevels.Items.Add(xml);
            }
            listBoxLevels.SetSelected(0, true);

            goBack = new PictureBox();
            goBack.Size = new System.Drawing.Size(200, 44);
            goBack.Text = "Go Back";
            goBack.BackgroundImage = Resources.goBack;
            goBack.Click += new EventHandler(highscoresController.goBack_Click);

            gameWindow.Controls.Add(backgroundImage);
            backgroundImage.Controls.Add(alignPanel);
            alignPanel.Controls.Add(goBack);
            alignPanel.Controls.Add(listBoxLevels);
            alignPanel.Controls.Add(listBoxHighscores);

            alignPanel.Location = new Point(
                (gameWindow.Width / 2 - alignPanel.Size.Width / 2),
                (gameWindow.Height / 2 - alignPanel.Size.Height / 2));

            goBack.Location = new System.Drawing.Point((alignPanel.Width / 2 - goBack.Size.Width / 2), listBoxLevels.Size.Height + 10);
        }
        public override void ControlsInit(Form gameWindow)
        {
            alignPanel = new Panel();
            alignPanel.AutoSize = true;
            alignPanel.BackColor = Color.Transparent;

            backgroundImage = new Panel();
            backgroundImage.Location = new System.Drawing.Point(0, 0);
            backgroundImage.Size = new System.Drawing.Size(gameWindow.Width, gameWindow.Height);
            backgroundImage.BackgroundImage = Resources.otherScreen;

            gamePanel = new Panel();
            gamePanel.Location = new System.Drawing.Point(210, 0);
            gamePanel.Size = new System.Drawing.Size(845, 475);
            gamePanel.BackColor = Color.White;
            gamePanel.BorderStyle = BorderStyle.FixedSingle;
            gamePanel.Paint += editorSelectController.OnPreviewPaint;

            listBoxLevels = new ListBox();
            listBoxLevels.Size = new System.Drawing.Size(200, 475);
            listBoxLevels.Location = new System.Drawing.Point(0, 0);

            // Lees levels uit XML file
            XMLParser.LoadAllLevels();
            foreach (XMLParser xml in XMLParser.Levels)
            {
                if(xml != null)
                    listBoxLevels.Items.Add(xml);
            }

            listBoxLevels.SelectedIndexChanged += editorSelectController.level_Select;
            listBoxLevels.SetSelected(0, true);

            goBack = new PictureBox();
            goBack.Size = new System.Drawing.Size(200, 44);
            goBack.Location = new System.Drawing.Point(0, 480);
            goBack.Text = "Go Back";
            goBack.Image = Resources.goBack;
            goBack.Click += editorSelectController.goBack_Click;

            editLevel = new PictureBox();
            editLevel.Size = new System.Drawing.Size(200, 44);
            editLevel.Location = new System.Drawing.Point(210, 480);
            editLevel.Text = "Edit Level";
            editLevel.Image = Resources.editLevel;
            editLevel.Click += editorSelectController.editLevel_Click;

            newLevel = new PictureBox();
            newLevel.Size = new System.Drawing.Size(200, 44);
            newLevel.Location = new System.Drawing.Point(420, 480);
            newLevel.Text = "New Level";
            newLevel.Image = Resources.newLevel;
            newLevel.Click += editorSelectController.newLevel_Click;

            gameWindow.Controls.Add(backgroundImage);
            backgroundImage.Controls.Add(alignPanel);
            alignPanel.Controls.Add(goBack);
            alignPanel.Controls.Add(editLevel);
            alignPanel.Controls.Add(newLevel);
            alignPanel.Controls.Add(listBoxLevels);
            alignPanel.Controls.Add(gamePanel);

            alignPanel.Location = new Point(
                (gameWindow.Width / 2 - alignPanel.Size.Width / 2),
                (gameWindow.Height / 2 - alignPanel.Size.Height / 2));
        }
 public static void SelectAll(ListBox p0)
 {
     for (int i = 0; i < p0.Items.Count; i++){
         p0.SetSelected(i, true);
     }
 }
 private void ClearSelectionOnListBox(ListBox color)
 {
     foreach (int item in color.SelectedIndices)
     {
         color.SetSelected(item,false);
     }
 }
 private void ChangeSelection(ListBox listBox, bool selected)
 {
     for (int i = 0; i < listBox.Items.Count; i++)
     {
         listBox.SetSelected(i, selected);
     }
 }
Exemple #53
0
 public void getPlaces(ListBox placesListBox, Label messageLabel, string keyword)
 {
     try
     {
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(m_url + "?intext=" + keyword);
         req.KeepAlive = false;
         WebResponse res = req.GetResponse();
         Stream responseStream = res.GetResponseStream();
         StreamReader reader = new StreamReader (responseStream);
         citiesList.Clear();
         list.Clear();
         string line;
         while((line=reader.ReadLine()) != null)
         {
             //LibSys.StatusBar.Trace(line);
             City city=parseCityString(line);
             if(city != null)
             {
                 citiesList.Add(city);
                 list.Add(city.toTableString());
                 //LibSys.StatusBar.Trace(city.toTableString());
                 placesListBox.Items.Add(city.toTableString());
             }
         }
         responseStream.Close();
         if(list.Count > 0)
         {
             placesListBox.SetSelected(0, true);
             messageLabel.Text = "select city from the list below and click this button -------->";
         }
         else
         {
             messageLabel.Text = "no cities or US zipcode matched keyword '" + Project.findKeyword + "'";
         }
     }
     catch (Exception e)
     {
         messageLabel.Text = "" + e.Message;
         //LibSys.StatusBar.Error("ZipcodeServer() - " + e);
     }
 }
Exemple #54
0
 private void MoveListBoxItem(ListBox list, int direction)
 {
     if (list.SelectedItem == null || list.SelectedIndex < 0) return;
     int index = list.SelectedIndex + direction;
     if (index < 0 || index >= list.Items.Count) return;
     object selected = list.SelectedItem;
     list.Items.Remove(selected);
     list.Items.Insert(index, selected);
     list.SetSelected(index, true);
 }
        /// <summary>
        /// Scans each of the communication ports listed in the registry to determine if it is connected to target hardware and generates a list
        /// of the target configuration information and the communication settings for each target that is located. 
        /// </summary>
        /// <param name="targetConfigurationList">The list containing the target configuration information for any targets connected to the PTU.</param>
        /// <param name="communicationSettingList">The communication settings associated with each target that was found.</param>
        /// <param name="listBoxTargetsFound">The <c>ListBox</c> control on which the target names are to be displayed.</param>
        /// <param name="statusInformation">The control on which the status information is to be displayed.</param>
        /// <returns>A flag to indicate whether one or more targets were found; true, if  targets were found, otherwise, false.</returns>
        public bool GetTargets(ListBox listBoxTargetsFound, Control statusInformation,  out List<TargetConfiguration_t> targetConfigurationList,
                               out List<CommunicationSetting_t> communicationSettingList)
        {
            // Instantiate to output parameters.
            communicationSettingList = new List<CommunicationSetting_t>();
            targetConfigurationList = new List<TargetConfiguration_t>();

            CommunicationApplication communicationInterface;

            // Flag to indicate whether target hardware was found; true, if one or more targets were found, otherwise, false.
            bool targetFound = false;

			if (Parameter.CommunicationType == Parameter.CommunicationTypeEnum.Both || Parameter.CommunicationType == Parameter.CommunicationTypeEnum.RS232)
			{

				// -----------------------------------------------------------------
				// Scan each serial communication (COM) port listed in the Registry.
				// -----------------------------------------------------------------

				// Get the list of available serial COM ports from the registry.
				RegistryKey root = Registry.LocalMachine;
				CommunicationSetting_t communicationSetting = new CommunicationSetting_t();

				// Set the protocol to serial communication.
				communicationSetting.Protocol = Protocol.RS232;

				// Initialize the serial communication parameters.
				communicationSetting.SerialCommunicationParameters.SetToDefault();

				TargetConfiguration_t targetConfiguration;
				using (RegistryKey serialCommunication = root.OpenSubKey(RegistryKeySerialCommunication))
				{
					// Scan each port in the Registry.
					foreach (string valueName in serialCommunication.GetValueNames())
					{
						// Filter out those '\HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM' keys that are not to be included in the search.
						switch (valueName)
						{
							// Skip those registry keys defined here.
							case SerialCommRegistryKeyWinachsf0:
								continue;
							default:
								// Process the key.
								break;
						}

						string value = serialCommunication.GetValue(valueName).ToString();

						communicationSetting.Port.Name = value;
						communicationSetting.Port.FullSpecification = value.PadRight(ComDeviceTotalCharacters) + " - " + valueName;
						communicationSetting.Port.Type = (communicationSetting.Port.FullSpecification.Contains(VirtualComPort)) ? PortType.VCP : PortType.COM;

						// Determine the port identifier, this is a 16 bit Unicode string representation of the serial port number e.g. for physical and virtual
                        // COM ports this takes the form: 1, 2, 3 ... etc.
						switch (communicationSetting.Port.Type)
						{
							case PortType.COM:
							case PortType.VCP:
								communicationSetting.PortIdentifier = communicationSetting.Port.Name.Remove(0, communicationSetting.Port.Type.ToString().Length);
								break;
							default:
								throw new ArgumentException("FormSelectTargetLogic.LocateTargetHardware()", "communicationSetting.Port.Type");
						}

						statusInformation.Text = Resources.TextSearchingForTargetOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
						statusInformation.Update();

						// Instantiate the appropriate type of communication interface.
						communicationInterface = new CommunicationApplication();
						try
						{
							if (communicationInterface.ScanPort(communicationSetting, out targetConfiguration) == true)
							{
								targetConfigurationList.Add(targetConfiguration);
                                listBoxTargetsFound.Items.Add(targetConfiguration.SubSystemName + " - (COM" + communicationSetting.PortIdentifier + ")" );
								listBoxTargetsFound.Update();
								statusInformation.Text = Resources.TextTargetFoundOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
                                statusInformation.Update();
								communicationSettingList.Add(communicationSetting);
								targetFound = true;
							}
						}
						catch (Exception)
						{
							statusInformation.Text = Resources.TextNoTargetFoundOn + CommonConstants.Space + communicationSetting.Port.FullSpecification;
							statusInformation.Update();
							continue;
						}
					}
				}
			}

            statusInformation.Text = string.Empty;
            statusInformation.Update();

			if (Parameter.CommunicationType == Parameter.CommunicationTypeEnum.Both || Parameter.CommunicationType == Parameter.CommunicationTypeEnum.TCPIP)
			{

				// -----------------------------------------------------------------
				// Scan each URI listed in the Data Dictionary.
				// -----------------------------------------------------------------

				CommunicationSetting_t communicationSetting = new CommunicationSetting_t();

				// Set the protocol to IP communication.
				communicationSetting.Protocol = Protocol.TCPIP;

				TargetConfiguration_t targetConfiguration;

                // Initialize the ProgressBar control.
                m_ProgressBarScan.Enabled = true;
                m_ProgressBarScan.Visible = true;
                m_LegendScanProgress.Visible = true;
                m_ProgressBarScan.Maximum = Parameter.URIList.Count;
                m_ProgressBarScan.Value = 0;
                m_BtnOK.Enabled = false;
                m_CancelSelected = false;

				// Scan each port in the Registry.
				foreach (string uRI in Parameter.URIList)
				{
                    // Ensure that the form remains responsive during the asynchronous operation.
                    Application.DoEvents();

                    // Check whether the Cancel button has been selected.
                    if (m_CancelSelected == true)
				{
                        // Yes - Terminate the scan.
                        break;
                    }

                    // Update the progress bar.
                    m_ProgressBarScan.Value++;

					communicationSetting.PortIdentifier = uRI;

                    statusInformation.Text = Resources.TextSearchingForTargetOn + CommonConstants.Space + Resources.TextURI + CommonConstants.Colon +
                                             communicationSetting.PortIdentifier;
                    statusInformation.Update();

					// Instantiate the appropriate type of communication interface.
					communicationInterface = new CommunicationApplication();
					try
					{
						if (communicationInterface.ScanPort(communicationSetting, out targetConfiguration) == true)
						{
							targetConfigurationList.Add(targetConfiguration);
							listBoxTargetsFound.Items.Add(targetConfiguration.SubSystemName + CommonConstants.BindingMessage +
                                                          Resources.TextURI + CommonConstants.Colon + communicationSetting.PortIdentifier);
							listBoxTargetsFound.Update();
                            statusInformation.Text = Resources.TextTargetFoundOn + CommonConstants.Space + Resources.TextURI + CommonConstants.Colon +
                                                     communicationSetting.PortIdentifier;
                            statusInformation.Update();
							communicationSettingList.Add(communicationSetting);
							targetFound = true;
						}
					}
					catch (Exception)
					{
						continue;
					}
				}

                m_BtnOK.Enabled = true;
                m_ProgressBarScan.Enabled = false;
                m_ProgressBarScan.Visible = false;
                m_LegendScanProgress.Visible = false;
			}

            if (targetFound == true)
            {
                statusInformation.Text = targetConfigurationList.Count.ToString() + CommonConstants.Space + Resources.TextTargetsFound;
                statusInformation.Update();

                // Highlight the first logic controller that was found.
                listBoxTargetsFound.SetSelected(0, true);
            }
            else
            {
                statusInformation.Text = Resources.TextNoTargetsFound;
                statusInformation.Update();
            }

            return targetFound;
        }
Exemple #56
0
 private void FormDepositEdit_Load(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         if (!Security.IsAuthorized(Permissions.DepositSlips, DateTime.Today))
         {
             //we will check the date again when saving
             DialogResult = DialogResult.Cancel;
             return;
         }
     }
     else
     {
         //We enforce security here based on date displayed, not date entered
         if (!Security.IsAuthorized(Permissions.DepositSlips, DepositCur.DateDeposit))
         {
             butOK.Enabled     = false;
             butDelete.Enabled = false;
         }
     }
     if (IsNew)
     {
         textDateStart.Text = PIn.PDate(PrefB.GetString("DateDepositsStarted")).ToShortDateString();
         if (PrefB.GetBool("EasyNoClinics"))
         {
             comboClinic.Visible = false;
             labelClinic.Visible = false;
         }
         comboClinic.Items.Clear();
         comboClinic.Items.Add(Lan.g(this, "all"));
         comboClinic.SelectedIndex = 0;
         for (int i = 0; i < Clinics.List.Length; i++)
         {
             comboClinic.Items.Add(Clinics.List[i].Description);
         }
         for (int i = 0; i < DefB.Short[(int)DefCat.PaymentTypes].Length; i++)
         {
             listPayType.Items.Add(DefB.Short[(int)DefCat.PaymentTypes][i].ItemName);
             listPayType.SetSelected(i, true);
         }
         textDepositAccount.Visible = false;              //this is never visible for new. It's a description if already attached.
         if (Accounts.DepositsLinked())
         {
             DepositAccounts = Accounts.GetDepositAccounts();
             for (int i = 0; i < DepositAccounts.Length; i++)
             {
                 comboDepositAccount.Items.Add(Accounts.GetDescript(DepositAccounts[i]));
             }
             comboDepositAccount.SelectedIndex = 0;
         }
         else
         {
             labelDepositAccount.Visible = false;
             comboDepositAccount.Visible = false;
         }
     }
     else
     {
         groupSelect.Visible   = false;
         gridIns.SelectionMode = GridSelectionMode.None;
         gridPat.SelectionMode = GridSelectionMode.None;
         //we never again let user change the deposit linking again from here.
         //They need to detach it from within the transaction
         //Might be enhanced later to allow, but that's very complex.
         Transaction trans = Transactions.GetAttachedToDeposit(DepositCur.DepositNum);
         if (trans == null)
         {
             labelDepositAccount.Visible = false;
             comboDepositAccount.Visible = false;
             textDepositAccount.Visible  = false;
         }
         else
         {
             comboDepositAccount.Enabled = false;
             labelDepositAccount.Text    = Lan.g(this, "Deposited into Account");
             ArrayList jeAL = JournalEntries.GetForTrans(trans.TransactionNum);
             for (int i = 0; i < jeAL.Count; i++)
             {
                 if (Accounts.GetAccount(((JournalEntry)jeAL[i]).AccountNum).AcctType == AccountType.Asset)
                 {
                     comboDepositAccount.Items.Add(Accounts.GetDescript(((JournalEntry)jeAL[i]).AccountNum));
                     comboDepositAccount.SelectedIndex = 0;
                     textDepositAccount.Text           = ((JournalEntry)jeAL[i]).DateDisplayed.ToShortDateString()
                                                         + " " + ((JournalEntry)jeAL[i]).DebitAmt.ToString("c");
                     break;
                 }
             }
         }
     }
     textDate.Text            = DepositCur.DateDeposit.ToShortDateString();
     textAmount.Text          = DepositCur.Amount.ToString("F");
     textBankAccountInfo.Text = DepositCur.BankAccountInfo;
     FillGrids();
     if (IsNew)
     {
         gridPat.SetSelected(true);
         gridIns.SetSelected(true);
     }
     ComputeAmt();
 }
Exemple #57
0
 private void ReloadListBoxItems(ListBox listBox)
 {
     if (listBox.Items.Count > 0)
     {
         int num;
         object[] destination = new object[listBox.Items.Count];
         listBox.Items.CopyTo(destination, 0);
         int[] numArray = new int[listBox.SelectedIndices.Count];
         listBox.SelectedIndices.CopyTo(numArray, 0);
         listBox.Items.Clear();
         for (num = 0; num < destination.Length; num++)
         {
             listBox.Items.Add(destination[num]);
         }
         for (num = 0; num < numArray.Length; num++)
         {
             listBox.SetSelected(numArray[num], true);
         }
     }
 }
Exemple #58
0
        private void autoSearch(ListBox l, string s)
        {
            for (int x = 0; x <= l.Items.Count - 1; x++)
            {

                int firstCharacter = l.Items[x].ToString().IndexOf(s);
                if (firstCharacter != -1 && s != "")
                {
                    l.SetSelected(x, true);
                    l.TopIndex = x; //firstCharacter;
                    break;

                }
                else
                    l.SetSelected(0, false);
            }
        }
        public static void addRemoveFields(ListBox listBoxToRemove, ListBox listBoxToAdd)
        {
            if (listBoxToRemove == null || listBoxToAdd == null)
            return;

             if (listBoxToRemove.SelectedItems.Count < 1)
             {
            return;
             }
             else
             {
            List<string> selTexts = new List<string>();
            listBoxToAdd.ClearSelected();
            foreach (object obj in listBoxToRemove.SelectedItems)
            {
               int nIndex = listBoxToAdd.Items.Add(obj);
               listBoxToAdd.SetSelected(nIndex, true);
               selTexts.Add(obj.ToString());
            }

            foreach (string selText in selTexts)
            {
               listBoxToRemove.Items.Remove(selText);
            }

            listBoxToRemove.ClearSelected();
             }
        }