private void DeleteItemFromListBox(RadListControl lst, RadListDataItem item)
 {
     if (lst.Items.Contains(item))
     {
         lst.Items.Remove(item);
     }
 }
Example #2
0
 private void MoveAllItems(RadListControl sourceListBox, RadListControl targetListBox)
 {
     for (int i = 0; i < sourceListBox.Items.Count;)
     {
         RadListDataItem item = sourceListBox.Items[i];
         sourceListBox.Items.Remove(item);
         targetListBox.Items.Add(item);
     }
 }
Example #3
0
 private void FillListControl(RadListControl lc, Collection <User> users)
 {
     lc.Items.Clear();
     foreach (User user in users)
     {
         lc.Items.Add(user.Name);
     }
     lc.DisplayMember = "User";
     lc.ValueMember   = "Username";
 }
Example #4
0
 private void CreateFileListView()
 {
     _fileRadListView                         = new RadListControl();
     _fileRadListView.Font                    = new Font("微软雅黑", 10.5f);
     _fileRadListView.ItemHeight              = 60;
     _fileRadListView.BackColor               = Color.FromArgb(250, 250, 250);
     _fileRadListView.Padding                 = new System.Windows.Forms.Padding(24, 38, 24, 6);
     _fileRadListView.Dock                    = System.Windows.Forms.DockStyle.Fill;
     _fileRadListView.VisualItemFormatting   += new VisualListItemFormattingEventHandler(_radListView_VisualItemFormatting);
     _fileRadListView.CreatingVisualListItem += new CreatingVisualListItemEventHandler(_radListView_CreatingVisualListItem);
     _fileRadListView.SelectedIndexChanged   += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(_radListView_SelectedIndexChanged);
 }
        private void cmdChangeToHeaderField_Click(object sender, EventArgs e)
        {
            RadListControl lstLinkedFields = new RadListControl();

            try
            {
                //LDW if (lstLinkedFields.ListIndex > -1)
                if (lstLinkedFields.SelectedItem.Index > -1)
                {
                    //change all the linked fields to link to this one instead
                    modGlobal.gv_sql = "update tbl_setup_cmsfieldmeasures ";
                    //LDW modGlobal.gv_sql = modGlobal.gv_sql + " set LinkToDDID =  " + lstLinkedFields.ItemData(lstLinkedFields.ListIndex);
                    modGlobal.gv_sql = string.Format("{0} set LinkToDDID =  {1}", modGlobal.gv_sql, Support.GetItemData(lstLinkedFields, lstLinkedFields.SelectedItem.Index));
                    modGlobal.gv_sql = modGlobal.gv_sql + " where LinkToDDID is not null ";
                    modGlobal.gv_sql = string.Format("{0} and ddid <> {1}", modGlobal.gv_sql, Support.GetItemData(lstLinkedFields, lstLinkedFields.SelectedItem.Index));
                    modGlobal.gv_sql = string.Format("{0} and MeasureCode  = '{1}' ", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["measurecode"]);
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);

                    //link the pervious header field to be a linked field
                    modGlobal.gv_sql = "update tbl_setup_cmsfieldmeasures ";
                    modGlobal.gv_sql = string.Format("{0} set LinkToDDID =  {1}", modGlobal.gv_sql, Support.GetItemData(lstLinkedFields, lstLinkedFields.SelectedItem.Index));
                    modGlobal.gv_sql = string.Format("{0} where fieldmeasureid = {1}", modGlobal.gv_sql, Support.GetItemData(lstFieldsInMeasure, lstFieldsInMeasure.SelectedIndex));
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);

                    //make this field the header field
                    modGlobal.gv_sql = "update tbl_setup_cmsfieldmeasures ";
                    modGlobal.gv_sql = modGlobal.gv_sql + " set LinkToDDID = null ";
                    modGlobal.gv_sql = string.Format("{0} where ddid = {1}", modGlobal.gv_sql, Support.GetItemData(lstLinkedFields, lstLinkedFields.SelectedItem.Index));
                    modGlobal.gv_sql = string.Format("{0} and MeasureCode  = '{1}' ", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["measurecode"]);
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);

                    RefreshLinkedFields();
                    RefreshFieldsToLink();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
Example #6
0
        private void MoveToTargetListBox(RadListControl sourceListBox, RadListControl targetListBox)
        {
            if (sourceListBox.Items.Count == 0)
            {
                return;
            }
            if (sourceListBox.SelectedItem == null)
            {
                return;
            }

            RadListDataItem item = sourceListBox.SelectedItem;

            sourceListBox.Items.Remove(item);
            targetListBox.Items.Add(item);
        }
Example #7
0
        private void FillList(RadTokenizedTextItemCollection items)
        {
            RadListControl control = this.radAutoCompleteBox1.Items != items ?
                                     this.radListControlRecipients : this.radListControlCarbonCopy;

            control.Items.Clear();

            foreach (RadTokenizedTextItem item in items)
            {
                string text = item.Text;

                if (item.Value != null)
                {
                    text = string.Format("{0} <{1}>", text, item.Value);
                }

                control.Items.Add(new RadListDataItem(text));
            }
        }
        private void AddLocationToListBox(RadListControl lst, int?LocId, string locName, int?locTypeId, int?index)
        {
            string value = LocId.ToStr() + "," + locTypeId.ToStr();

            RadListDataItem item = null;

            if (index == null || index == -1)
            {
                item = new RadListDataItem();
                lst.Items.Add(item);
            }
            else
            {
                item = lst.SelectedItem;
            }


            item.Text  = locName;
            item.Value = value;
        }
        public void RefreshLinkedFields()
        {
            RadListControl lstLinkedFields = new RadListControl();


            try
            {
                //retrieve the list of table fields
                modGlobal.gv_sql = "Select df.fieldname, cms.ddid from tbl_setup_datadef as df ";
                modGlobal.gv_sql = modGlobal.gv_sql + " inner join tbl_Setup_CMSFieldMeasures as cms ";
                modGlobal.gv_sql = modGlobal.gv_sql + " on df.ddid = cms.ddid ";
                modGlobal.gv_sql = string.Format("{0} where cms.linktoddid = {1}", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["DDID"]);
                modGlobal.gv_sql = string.Format("{0} and cms.measurecode = '{1}'", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["measurecode"]);
                modGlobal.gv_sql = modGlobal.gv_sql + " order by df.FieldName ";

                rdcTempTable = "tbl_setup_datadef";
                rdcTemp      = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, rdcTempTable, rdcTemp);
                rdcTemp.AcceptChanges();

                lstLinkedFields.Items.Clear();
                //LDW while (!rdcTemp.Resultset.EOF)
                foreach (DataRow myRow5 in rdcTemp.Tables[rdcTempTable].Rows)
                {
                    lstLinkedFields.Items.Add(new ListBoxItem(myRow5.Field <string>("FieldName"), myRow5.Field <int>("DDID")).ToString());
                    //LDW rdcTemp.Resultset.MoveNext();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
Example #10
0
        private void MoveDown(RadListControl listBox)
        {
            if (listBox.Items.Count < 2)
            {
                return;
            }
            if (listBox.SelectedItem == null)
            {
                return;
            }
            if (listBox.SelectedIndex == listBox.Items.Count - 1)
            {
                return;
            }
            RadListDataItem item  = listBox.SelectedItem;
            int             index = listBox.SelectedIndex;

            listBox.Items.Remove(item);
            listBox.Items.Insert(index + 1, item);
            listBox.SelectedItem = item;
        }
        private void InitializeDragOperation(object sender, MouseEventArgs e)
        {
            sourceListBox = (RadListControl)sender;

            sourceComponentElementTree = sourceListBox.ElementTree;

            if (sourceComponentElementTree.RootElement.ElementTree != null && this.AllowDragDrop)
            {
                RadElement elementAtPoint = sourceComponentElementTree.GetElementAtPoint(e.Location);

                if (elementAtPoint is RadListVisualItem)
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        sourceComponentElementTree.RootElement.ElementTree.Control.Capture = true;

                        BeginDrag(e);
                    }
                }
            }
        }
        private void MoveToTargetListBox(RadListControl sourceListBox, RadListControl targetListBox)
        {
            if (sourceListBox.Items.Count == 0)
            {
                return;
            }

            if (sourceListBox.SelectedItems == null)
            {
                return;
            }

            foreach (RadListDataItem selItem in sourceListBox.SelectedItems)
            {
                _selectedItems.Add(selItem);
            }

            var sourceDataSource = sourceListBox.DataSource as IList<Funcion>;
            var targetDataSource = targetListBox.DataSource as IList<Funcion>;

            if (sourceDataSource == null || targetDataSource == null)
            {
                return;
            }

            foreach (Funcion funcion in _selectedItems.Select(x => x.DataBoundItem))
            {
                sourceDataSource.Remove(funcion);
                targetDataSource.Add(funcion);
            }

            _selectedItems.Clear();

            sourceListBox.ListElement.ClearSelected();
            targetListBox.ListElement.ClearSelected();

            sourceListBox.Rebind();
            targetListBox.Rebind();
        }
Example #13
0
        private void MoveToTargetListBox(RadListControl sourceListBox, RadListControl targetListBox)
        {
            if (sourceListBox.Items.Count == 0)
            {
                return;
            }

            if (sourceListBox.SelectedItems == null)
            {
                return;
            }

            foreach (RadListDataItem selItem in sourceListBox.SelectedItems)
            {
                _selectedItems.Add(selItem);
            }

            var sourceDataSource = sourceListBox.DataSource as IList <Funcion>;
            var targetDataSource = targetListBox.DataSource as IList <Funcion>;

            if (sourceDataSource == null || targetDataSource == null)
            {
                return;
            }

            foreach (Funcion funcion in _selectedItems.Select(x => x.DataBoundItem))
            {
                sourceDataSource.Remove(funcion);
                targetDataSource.Add(funcion);
            }

            _selectedItems.Clear();

            sourceListBox.ListElement.ClearSelected();
            targetListBox.ListElement.ClearSelected();

            sourceListBox.Rebind();
            targetListBox.Rebind();
        }
        public void RefreshFieldsToLink()
        {
            RadListControl lstFieldsToLink = new RadListControl();


            try
            {
                //retrieve the list of table fields only if they are already a part of the cmsfieldmeasures
                modGlobal.gv_sql = " Select * from tbl_setup_DataDef";
                modGlobal.gv_sql = modGlobal.gv_sql + " where ";
                modGlobal.gv_sql = string.Format("{0} ddid <> {1}", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["DDID"]);
                modGlobal.gv_sql = modGlobal.gv_sql + " and BaseTableID in";
                modGlobal.gv_sql = modGlobal.gv_sql + " (select basetableid from tbl_setup_tableDef where BaseTable = 'PATIENT' )";
                modGlobal.gv_sql = modGlobal.gv_sql + " and ddid in ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (select ddid from tbl_setup_cmsFieldMeasures";
                modGlobal.gv_sql = string.Format("{0}     where measurecode = '{1}' ", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["measurecode"]);
                modGlobal.gv_sql = modGlobal.gv_sql + "     and linktoddid is null) ";
                modGlobal.gv_sql = modGlobal.gv_sql + " and ddid  not in ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (select linktoddid from tbl_setup_cmsFieldMeasures";
                modGlobal.gv_sql = string.Format("{0}     where measurecode = '{1}'", modGlobal.gv_sql, rdcFieldList.Tables[rdcFieldListTable].Rows[0]["measurecode"]);
                modGlobal.gv_sql = modGlobal.gv_sql + "     and linktoddid is not null)";
                modGlobal.gv_sql = modGlobal.gv_sql + " order by FieldName ";
                //gv_sql = "Select * from tbl_setup_DataDef "
                //    gv_sql = gv_sql & " where BaseTableID in "
                //    gv_sql = gv_sql & " (select basetableid from tbl_setup_tableDef where BaseTable = 'PATIENT' )"
                //    gv_sql = gv_sql & " and ddid in "
                //    gv_sql = gv_sql & " (select ddid from tbl_setup_cmsFieldMeasures "
                //    gv_sql = gv_sql & " where measurecode = '" & rdcFieldList.Resultset!measurecode & "'"
                //    gv_sql = gv_sql & " and linktoddid is null "
                //    gv_sql = gv_sql & " and ddid not in "
                //    gv_sql = gv_sql & "     (select linktoddid from tbl_setup_cmsFieldMeasures "
                //    gv_sql = gv_sql & "         where linktoddid is not null and measurecode = '" & rdcFieldList.Resultset!measurecode & "')"
                //    gv_sql = gv_sql & " )"
                //    gv_sql = gv_sql & " and ddid <> " & rdcFieldList.Resultset!ddid
                //gv_sql = gv_sql & " order by FieldName "

                //LDW rdcTemp = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName4 = "tbl_setup_DataDef";
                rdcTemp = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName4, rdcTemp);
                rdcTemp.AcceptChanges();

                lstFieldsToLink.Items.Clear();
                //LDW while (!rdcTemp.Resultset.EOF)
                foreach (DataRow myRow4 in rdcTemp.Tables[rdcTempTable].Rows)
                {
                    lstFieldsToLink.Items.Add(new ListBoxItem(myRow4.Field <string>("FieldName"), myRow4.Field <int>("DDID")).ToString());
                    //LDW rdcTemp.Resultset.MoveNext();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
        private void Control_MouseMove(object sender, MouseEventArgs e)
        {
            if (!this.dragging)
            {
                this.InitializeDragOperation(sender, e);
            }

            if (e.Button == MouseButtons.Left)
            {
                this.targetListBox = GetTreeViewUnderMouse(Control.MousePosition);

                if (this.draggedItem is RadListDataItem)
                {
                    if (this.targetListBox == null)
                    {
                        this.control.FindForm().Cursor = Cursors.No;
                    }
                    else
                    {
                        this.control.FindForm().Cursor = Cursors.Arrow;
                    }
                }
                else
                {
                    this.control.FindForm().Cursor = Cursors.Arrow;
                }

                if (!this.AllowDragDrop)
                {
                    return;
                }

                if (e.Button != MouseButtons.Left)
                {
                    if (this.outlineForm != null)
                    {
                        this.outlineForm.Hide();
                    }
                }

                if (this.draggedItem == null)
                {
                    if (this.outlineForm != null)
                    {
                        this.outlineForm.Hide();
                    }

                    return;
                }

                RadElement elementAtPoint = this.sourceListBox.ElementTree.GetElementAtPoint(new Point(e.X, e.Y));

                this.IsRealDrag(e.Location);

                if (elementAtPoint != null)
                {
                    if (elementAtPoint.Visibility != ElementVisibility.Visible)
                    {
                        return;
                    }
                }

                this.SetOutLineForm(e);
                this.DrawFeedBack(e);
            }
        }
Example #16
0
 public static void SelectListItem(RadListControl lst, string[] values)
 {
     try
     {
         foreach (RadListDataItem item in lst.Items)
         {
             if (values.Contains(item.Value.ToString()))
             {
                 item.Selected = true;
             }
         }
     }
     catch (Exception x)
     {
         FileLogger.LogError(x);
     }
 }