Example #1
0
 //
 private void ShowDataStoreProperties()
 {
     if (this.PropertiesItemClick != null)
     {
         TreeListMultiSelection selection = this.treeView.Selection;
         if (selection == null || selection.Count == 0)
         {
             return;
         }
         TreeListNode treeListNode = selection[0];
         if (treeListNode.Tag == null)
         {
             return;
         }
         if (treeListNode.Tag is ProjectSetting.ProjectSection)
         {
             // send a message to all external subscribers...
             this.PropertiesItemClick(treeListNode.Tag, EventArgs.Empty);
         }
         if (treeListNode.Tag is ProjectSetting.DataStoreElement)
         {
             // send a message to all external subscribers...
             this.PropertiesItemClick(treeListNode.Tag, EventArgs.Empty);
         }
     }
 }
Example #2
0
        private string GetSelectedTag()
        {
            string result = null;

            try
            {
                TreeListMultiSelection selection = treeList1.Selection;
                if (selection[0].Level != 3)
                {
                    return(result);
                }
                TreeListNode treeListNode        = selection[0];
                TreeListNode parentNode          = treeListNode.ParentNode;
                string       text                = parentNode.ParentNode["Name"].ToString();
                string       text2               = parentNode["Name"].ToString();
                string       text3               = treeListNode["Name"].ToString();
                object       focusedRowCellValue = gvTags.GetFocusedRowCellValue(colTagName);
                if (focusedRowCellValue == null)
                {
                    return(result);
                }
                string text4 = focusedRowCellValue.ToString();
                result = $"{text}.{text2}.{text3}.{text4}";
                return(result);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(result);
            }
        }
Example #3
0
        private void gridControl_DragDrop(object sender, DragEventArgs e)
        {
            TreeListMultiSelection selectionItem = e.Data.GetData(typeof(TreeListMultiSelection)) as TreeListMultiSelection;

            bool changed = false;

            foreach (Library.LibraryNode item in selectionItem)
            {
                MemoryLibraryItem tmpItem = item.Tag as MemoryLibraryItem;
                LiveMessageItem   libItem = new LiveMessageItem();
                libItem.Name   = tmpItem.Name;
                libItem.Target = tmpItem;
                libItem.Id     = tmpItem.Id;
                if (CategoryControl.CheckSameMemoryLibraryItem(libItem, DataSource))
                {
                    DataSource.Add(libItem);
                    RefreshDataSource();
                    changed = true;
                }
            }

            if (changed)
            {
                CategoryItemChanged();
            }
        }
Example #4
0
        public void WriteTagValue(string NumValue)
        {
            try
            {
                TreeListMultiSelection SelectebNodes = TreeList1.Selection;

                if (SelectebNodes[0].Level == 2)
                {
                    TreeListNode dbNode = SelectebNodes[0];  // Node:DataBlock
                    TreeListNode dvNode = dbNode.ParentNode; // Node:Device
                    TreeListNode chNode = dvNode.ParentNode; // Node:Channel


                    string channelName   = chNode["Name"].ToString();
                    string DeviceName    = dvNode["Name"].ToString();;
                    string DataBlockName = dbNode["Name"].ToString();;

                    object obj = gridView1.GetFocusedRowCellValue(colTagName);

                    if (obj != null)
                    {
                        string tgName = obj.ToString();
                        lblSelectedTag.Caption = $"{SelectedTag}{channelName}.{DeviceName}.{DataBlockName}.{tgName}";
                        client.WriteTag(lblSelectedTag.Caption, NumValue);
                        Thread.Sleep(50);
                    }
                }
            }
            catch (Exception ex)
            {
                EventscadaException?.Invoke(this.GetType().Name, ex.Message);
            }
        }
Example #5
0
        public void DataChangedDataBlock(List <DataBlock> db)
        {
            try
            {
                TreeListMultiSelection SelectebNodes = TreeList1.Selection;
                DataBlock dbCurrent = null; //Node: DataBlock
                Device    dvCurrent = null; //Node: Device
                Channel   chCurrent = null; //Node: Channel

                TreeListNode dbNode = null;
                TreeListNode dvNode = null;
                TreeListNode chNode = null;
                switch (SelectebNodes[0].Level)
                {
                case 0:

                    break;

                case 1:

                    break;

                case 2:
                    dbNode = SelectebNodes[0];    // Node:DataBlock
                    dvNode = dbNode.ParentNode;   // Node:Device
                    chNode = dvNode.ParentNode;   // Node:Channel

                    string channelName   = chNode["Name"].ToString();
                    string DeviceName    = dvNode["Name"].ToString();
                    string DataBlockName = dbNode["Name"].ToString();
                    var    tagDataBlock  = new List <Tag>();
                    chCurrent = objChannelManager.GetByChannelName(channelName);
                    dvCurrent = objDeviceManager.GetByDeviceName(chCurrent, DeviceName);
                    dbCurrent = objDataBlockManager.GetByDataBlockName(dvCurrent, DataBlockName);
                    if (db != null)
                    {
                        foreach (var item in db)
                        {
                            if (dbCurrent.DataBlockId == item.DataBlockId && dbCurrent.DeviceId == item.DeviceId && dbCurrent.ChannelId == item.ChannelId)
                            {
                                tagDataBlock = item.Tags;
                                break;
                            }
                        }
                    }


                    bS7Tags = new BindingList <Tag>(tagDataBlock);
                    RealTimeSource1.DataSource = bS7Tags;
                    gridView1.Invalidate();
                    break;
                }
            }
            catch (Exception ex)
            {
                EventscadaException?.Invoke(this.GetType().Name, ex.Message);
            }
        }
Example #6
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListMultiSelection tm = treeList1.Selection;

            if (tm.Count == 0)
            {
                return;
            }
            // TreeListNode tln = treeList1.FocusedNode;
            //if (tln == null)
            //    return;


            DataRow dr = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);

            if (dr == null)
            {
                return;
            }

            int id1 = (int)dr["ID"];

            fl2 = id1;
            hs.Clear();
            li.Clear();
            foreach (TreeListNode tln in tm)
            {
                PSP_P_Types pt1 = new PSP_P_Types();
                if (id1 == 999999 || id1 == 888888)
                {
                    IsJingJi = true;
                    PSP_Types pt = Services.BaseService.GetOneByKey <PSP_Types>((int)tln["ID"]);
                    if (!hs.ContainsValue(pt))
                    {
                        hs.Add(Guid.NewGuid().ToString(), pt);
                    }
                    //UpdateData(pt, pt1);
                    //li.Add(pt1);
                    ////////Get(pt, li, hs);
                }
                else
                {
                    pt1 = Services.BaseService.GetOneByKey <PSP_P_Types>((int)tln["ID"]);
                    if (!hs.ContainsValue(pt1))
                    {
                        hs.Add(Guid.NewGuid().ToString(), pt1);
                    }
                    //li.Add(pt1);
                    ////////////Get1(pt1, li, hs);
                }
            }

            if (hs.Count > 0)
            {
                this.DialogResult = DialogResult.OK;
            }
        }
Example #7
0
        private void barButtonItemCopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListMultiSelection multiSelection = this.FTAttrTreeList.Selection;
            TreeListNode           node           = multiSelection[0];
            string strTemp = node.GetDisplayText("FieldValue").ToString();

            if (strTemp != "" && strTemp != null)
            {
                Clipboard.SetText(strTemp);
            }
        }
Example #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            TreeListMultiSelection ListSelect = treeList1.Selection;

            if (ListSelect != null)
            {
                TreeListNode item = ListSelect[0];
                treeList1.DeleteNode(item);
                List <TreeListNode> a = new List <TreeListNode>();
                //treeList1.AppendNode(new object[] { "Suyama, Michael", "Obere Str. 55", "030-0074263" }, item);
            }
        }
        public System.Data.DataRow GET_SELECTED_DATASTORE()
        {
            TreeListMultiSelection selection = this.treeView.Selection;

            if (selection == null || selection.Count == 0)
            {
                return(null);
            }
            TreeListNode treeListNode = selection[0];

            System.Data.DataRow row = treeListNode.Tag as System.Data.DataRow;
            return(row);
        }
Example #10
0
        private void FTAttrTreeList_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            TreeListMultiSelection multiSelection = this.FTAttrTreeList.Selection;

            if (multiSelection.Count > 0)
            {
                System.Drawing.Point pPoint = this.FTAttrTreeList.PointToScreen(e.Location);
                this.popupMenu1.ShowPopup(pPoint);
            }
        }
Example #11
0
        private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeListHitInfo hitInfo = treeList1.CalcHitInfo(e.Location);

            if (hitInfo.HitInfoType != HitInfoType.Button)
            {
                TreeListMultiSelection selectedNodes = treeList1.Selection;
                if (!selectedNodes[0].HasChildren)
                {
                    if (GetSelectedNode(treeList1).Length > 3)
                    {
                        FRM_SMT_EMD_UNDER under = new FRM_SMT_EMD_UNDER();
                        under.ShowDialog();
                    }
                    else
                    {
                        ComVar.Var.callForm = GetSelectedNode(treeList1);
                    }
                }
            }
        }
        private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeListHitInfo hitInfo = treeList1.CalcHitInfo(e.Location);

            if (hitInfo.HitInfoType != HitInfoType.Button)
            {
                TreeListMultiSelection selectedNodes = treeList1.Selection;
                if (!selectedNodes[0].HasChildren)
                {
                    if (GetSelectedNode(treeList1).Equals("9999")) //PFC
                    {
                        CreateAndOpenFolder(_FacCode);
                    }
                    else
                    {
                        ComVar.Var._IsBack    = true;
                        ComVar.Var._strValue1 = _FacCode;
                        ComVar.Var.callForm   = GetSelectedNode(treeList1);
                    }
                }
            }
        }
Example #13
0
        private void mWriteTagValue_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                TreeListMultiSelection SelectebNodes = TreeList1.Selection;

                if (SelectebNodes[0].Level == 2)
                {
                    TreeListNode dbNode = SelectebNodes[0];  // Node:DataBlock
                    TreeListNode dvNode = dbNode.ParentNode; // Node:Device
                    TreeListNode chNode = dvNode.ParentNode; // Node:Channel


                    string channelName   = chNode["Name"].ToString();
                    string DeviceName    = dvNode["Name"].ToString();;
                    string DataBlockName = dbNode["Name"].ToString();;

                    object obj = gridView1.GetFocusedRowCellValue(colTagName);

                    if (obj != null)
                    {
                        string tgName = obj.ToString();
                        lblSelectedTag.Caption = $"{SelectedTag}{channelName}.{DeviceName}.{DataBlockName}.{tgName}";

                        WriteTagForm objWriteTagForm = new WriteTagForm(lblSelectedTag.Caption, client)
                        {
                            StartPosition = FormStartPosition.CenterParent, ShowInTaskbar = false
                        };

                        objWriteTagForm.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                txtHistory.Text += string.Format("+ ERROR: {0}" + Environment.NewLine, ex.Message);
            }
        }
Example #14
0
        private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeListHitInfo hitInfo = treeList1.CalcHitInfo(e.Location);

            if (hitInfo.HitInfoType != HitInfoType.Button)
            {
                TreeListMultiSelection selectedNodes = treeList1.Selection;
                if (!selectedNodes[0].HasChildren)
                {
                    if (GetSelectedNode(treeList1).Length > 3)
                    {
                        //   FRM_SMT_EMD_UNDER under = new FRM_SMT_EMD_UNDER();
                        //  under.ShowDialog();
                    }
                    else
                    {
                        //MessageBox.Show(GetSelectedNode(treeList1) + " " + _FacCode);
                        MessageBox.Show(this, "Under Contruction!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                //ComVar.Var.callForm = GetSelectedNode(treeList1);
            }
        }
Example #15
0
        //添加
        private void ButAdd_Click(object sender, EventArgs e)
        {
            TreeListMultiSelection ListSelect = treeList1.Selection;
            string name = this.treeList1.FocusedNode[2].ToString();

            name = this.treeList1.FocusedNode.GetDisplayText(2).ToString();
            name = treeList1.FocusedNode.GetValue(2).ToString();
            int count = treeList1.Columns.Count;

            if (ListSelect != null)
            {
                TreeListNode item  = ListSelect[0];
                string       name1 = item.GetDisplayText("ParentFieldName");
                //for (int i = 0; i < count; i++)
                //{
                //    name = this.treeList1.FocusedNode[i].ToString();
                //    MessageBox.Show(name);
                //}

                //获取列名称
                //TreeListColumn column = treeList1.FocusedColumn;
                //if (column.FieldName == "自动计算")
                //{
                //    if (item.GetValue(1).ToString() == "土")
                //    {
                //        // 继续事件
                //        //e.Cancel = false;
                //    }
                //}
                TreeListNode ParentNode = treeList1.AppendNode(new object[] { "Suyama, Michael", "Obere Str. 55", "030-0074263" }, item);
                ParentNode.SetValue(treeList1.Columns[0], "显示的值"); //添加第一节点显示的值
                ParentNode.SetValue(treeList1.Columns[1], "显示的值"); //添加第一节点显示的值
                ParentNode.SetValue(treeList1.Columns[2], "显示的值"); //添加第一节点显示的值
                ParentNode.SetValue(treeList1.Columns[3], "显示的值"); //添加第一节点显示的值
            }
        }
Example #16
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListMultiSelection tm = treeList1.Selection;

            if (tm.Count == 0)
            {
                return;
            }

            DataRow dr = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);

            if (dr == null)
            {
                return;
            }
            int id1 = (int)dr["ID"];

            hs.Clear();
            li.Clear();
            if (Flag == "1")//旧版分区县供电实绩
            {
                if (id1 != 4)
                {
                    foreach (TreeListNode tln in tm)
                    {
                        Ps_History pt1 = new Ps_History();
                        Ps_History pt  = Services.BaseService.GetOneByKey <Ps_History>((string)tln["ID"]);
                        if (tln["Title"].ToString() == "常规用电量" || tln["Title"].ToString() == "常规负荷")
                        {
                            pt.Title = pt.Title + "-" + tln.ParentNode["Title"];
                        }
                        else
                        if (!tln["Title"].ToString().Contains("电量") && !tln["Title"].ToString().Contains("负荷"))
                        {
                            if (id1 == 2)
                            {
                                pt.Title = pt.Title + "电量";
                            }
                            else if (id1 == 3)
                            {
                                pt.Title = pt.Title + "负荷";
                            }
                        }
                        if (!hs.ContainsValue(pt))
                        {
                            hs.Add(Guid.NewGuid().ToString(), pt);
                        }
                    }
                }
                else
                {
                    foreach (TreeListNode tln in tm)
                    {
                        PSP_Types pt = Services.BaseService.GetOneByKey <PSP_Types>((int)tln["ID"]);

                        if (!hs.ContainsValue(pt))
                        {
                            hs.Add(Guid.NewGuid().ToString(), pt);
                        }
                    }
                }
            }
            else//新版分区县供电实绩
            {
                foreach (TreeListNode tln in tm)
                {
                    Ps_History pt1 = new Ps_History();
                    Ps_History pt  = Services.BaseService.GetOneByKey <Ps_History>((string)tln["ID"]);
                    if (tln["Title"].ToString() == "常规用电量" || tln["Title"].ToString() == "常规负荷")
                    {
                        pt.Title = pt.Title + "-" + tln.ParentNode["Title"];
                    }
                    else
                    if (!tln["Title"].ToString().Contains("电量") && !tln["Title"].ToString().Contains("负荷"))
                    {
                        if (id1 == 2)
                        {
                            pt.Title = pt.Title + "电量";
                        }
                        else if (id1 == 3)
                        {
                            pt.Title = pt.Title + "负荷";
                        }
                    }
                    if (!hs.ContainsValue(pt))
                    {
                        hs.Add(Guid.NewGuid().ToString(), pt);
                    }
                }
            }



            if (hs.Count > 0)
            {
                this.DialogResult = DialogResult.OK;
            }
        }
Example #17
0
        private void btnCmd_Click(object pSender, EventArgs pEventArgs)
        {
            TreeListMultiSelection selectedNodes = treeList1.Selection;
            SimpleButton           pCmd          = pSender as SimpleButton;
            int Acitve_Row = 0;



            string sCls = pCmd.Name.Substring(6, 2);

            switch (sCls)
            {
            case "10":

                treeList1.MoveFirst();
                break;


            case "20":

                treeList1.MovePrev();
                break;



            case "30":

                _pPART_CODE = selectedNodes[0].GetValue(treeList1.Columns[0]).ToString();
                _pPOPProductBOMEntity.PART_CODE = _pPART_CODE;
                _pPART_NAME = selectedNodes[0].GetValue(treeList1.Columns[1]).ToString();
                _pPOPProductBOMEntity.PART_NAME = _pPART_NAME;

                try
                {
                    CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor);

                    _dtList = new POPProductBOMCommonBusiness().POPProductBOM_Image_Info(_pPOPProductBOMEntity);

                    if (_pPOPProductBOMEntity.CRUD == "")
                    {
                        _dtList.Rows.Clear();
                    }

                    if ((_dtList != null && _dtList.Rows.Count > 0) || (_dtList != null && _pPOPProductBOMEntity.CRUD == ""))
                    {
                        string Image_nm2 = _dtList.Rows[0]["file2"].ToString();
                        Image_nm = _dtList.Rows[0]["file1"].ToString();
                        string document_type = _dtList.Rows[0]["Document_type"].ToString();

                        if (Image_nm.Contains(".pdf"))
                        {
                            if (Image_nm.IndexOf("*NoSave*") > -1 || Image_nm.Trim().Length < 4)
                            {
                                //CoFAS_DevExpressManager.ShowInformationMessage("저장하지 않아서 볼 수 없습니다.");
                                CoFAS_DevExpressManager.ShowInformationMessage(_pMSG_NOT_DISPLAY_NOT_SAVE);
                            }
                            else
                            {
                                MemoryStream STR         = null;
                                string       strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "FILE_DATA", document_type);

                                var stream = CoFAS_FTPManager.FTPImage(strFTP_PATH, Image_nm2, _pFTP_ID, _pFTP_PW);

                                MemoryStream _ms = new MemoryStream();

                                byte[] buffer = new byte[16 * 1024];
                                int    read;
                                while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    _ms.Write(buffer, 0, read);
                                }

                                frmPdfView_bumah.CORP_CDDE     = _pCORP_CODE;
                                frmPdfView_bumah.USER_CODE     = _pUSER_CODE;
                                frmPdfView_bumah.LANGUAGE_TYPE = _pLANGUAGE_TYPE;
                                frmPdfView_bumah.FONT_TYPE     = _pFONT_SETTING;
                                frmPdfView_bumah.MS            = _ms;



                                frmPdfView_bumah xfrmImageView = new frmPdfView_bumah();     //유저컨트롤러 설정 부분

                                xfrmImageView.ShowDialog();

                                xfrmImageView.Dispose();
                            }
                        }
                        else
                        {
                            if (Image_nm2.IndexOf(" * NoSave*") > -1 || Image_nm2.Trim().Length < 4)
                            {
                                //CoFAS_DevExpressManager.ShowInformationMessage("저장하지 않아서 볼 수 없습니다.");
                                CoFAS_DevExpressManager.ShowInformationMessage(_pMSG_NOT_DISPLAY_NOT_SAVE);
                            }
                            else
                            {
                                string strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "FILE_DATA", document_type);



                                frmImageView_buma.CORP_CDDE     = _pCORP_CODE;
                                frmImageView_buma.USER_CODE     = _pUSER_CODE;
                                frmImageView_buma.LANGUAGE_TYPE = _pLANGUAGE_TYPE;
                                frmImageView_buma.FONT_TYPE     = _pFONT_SETTING;
                                frmImageView_buma.IMAGE_DATA    = Image.FromStream(CoFAS_FTPManager.FTPImage(strFTP_PATH, Image_nm2, _pFTP_ID, _pFTP_PW));

                                frmImageView_buma xfrmImageView = new POP.frmImageView_buma(Image_nm2, _pPART_NAME);     //유저컨트롤러 설정 부분

                                xfrmImageView.ShowDialog();

                                xfrmImageView.Dispose();
                            }
                        }
                    }
                }
                catch (ExceptionManager pExceptionManager)
                {
                    CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
                }

                break;

            case "40":

                treeList1.MoveNext();

                break;

            case "50":

                treeList1.MoveLast();
                break;

            default: break;
            }
        }
Example #18
0
 /// <summary>
 /// Get the currently selected TreeListNode(s) as a list
 /// </summary>
 /// <param name="treeList">The TreeListMultiSelection representing the currently selected nodes</param>
 /// <returns>The same TreeListNode as an IList</returns>
 public static IList <TreeListNode> ToList(this TreeListMultiSelection treeList)
 {
     return((from object item in treeList select item as TreeListNode).ToList());
 }
Example #19
0
        private void treeList1_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            TreeListMultiSelection selection = treeList1.Selection;

            try
            {
                if (selection.Count != 0)
                {
                    Channel   channel   = null;
                    Device    device    = null;
                    DataBlock dataBlock = null;
                    selection[0].ImageIndex = selection[0].Level;
                    switch (selection[0].Level)
                    {
                    case 1:
                    {
                        short num = short.Parse(selection[0]["ChannelId"].ToString());
                        channel = objChannelManager.GetByChannelId(num);
                        break;
                    }

                    case 2:
                    {
                        TreeListNode treeListNode2 = selection[0];
                        short        num           = short.Parse(treeListNode2.ParentNode["ChannelId"].ToString());
                        short        deviceId      = short.Parse(treeListNode2["DeviceId"].ToString());
                        channel = objChannelManager.GetByChannelId(num);
                        device  = objDeviceManager.GetByDeviceId(channel, deviceId);
                        break;
                    }

                    case 3:
                    {
                        TreeListNode treeListNode = selection[0];
                        TreeListNode parentNode   = treeListNode.ParentNode;
                        short        num          = short.Parse(parentNode.ParentNode["ChannelId"].ToString());
                        short        deviceId     = short.Parse(parentNode["DeviceId"].ToString());
                        short        dataBlockId  = short.Parse(treeListNode["DataBlockId"].ToString());
                        channel   = objChannelManager.GetByChannelId(num);
                        device    = objDeviceManager.GetByDeviceId(channel, deviceId);
                        dataBlock = objDataBlockManager.GetByDataBlockId(device, dataBlockId);
                        if (dataBlock.MemoryType == "Datablock")
                        {
                            gvTags.ViewCaption = $"Memory Type: {dataBlock.MemoryType} | DataBlock Name: {dataBlock.DataBlockName} | DataBlock Name: DB{dataBlock.StartAddress}".ToUpper();
                        }
                        else
                        {
                            gvTags.ViewCaption = $"Memory Type: {dataBlock.MemoryType}".ToUpper();
                        }
                        bsSource.DataSource = dataBlock.Tags;
                        colTagName.BestFit();
                        break;
                    }
                    }
                    if (channel == null)
                    {
                        propertyGridChannel.Visible = false;
                    }
                    else
                    {
                        propertyGridChannel.SelectedObject = channel;
                        propertyGridChannel.Visible        = true;
                    }
                    if (device != null)
                    {
                        propertyGridDevice.SelectedObject = device;
                        propertyGridDevice.Visible        = true;
                    }
                    else
                    {
                        propertyGridDevice.Visible = false;
                    }
                    if (dataBlock != null)
                    {
                        propertyGridDataBlock.SelectedObject = dataBlock;
                        propertyGridDataBlock.Visible        = true;
                        if (dataBlock.Tags != null)
                        {
                            lblTagCount.Caption = $"Total: {dataBlock.Tags.Count} tags";
                        }
                    }
                    else
                    {
                        propertyGridDataBlock.Visible = false;
                        lblTagCount.Caption           = $"Total: {0} tags";
                        lblSelectedTagName.Caption    = string.Format("Selected tag: {0}", "None");
                    }
                }
            }

            catch (Exception ex2)
            {
                XtraMessageBox.Show(this, ex2.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Example #20
0
        private void materialFlatButton1_Click(object sender, EventArgs e)
        {
            TreeListMultiSelection selectedNodes = tlstData.Selection;

            MessageBox.Show(selectedNodes[0].GetValue(tlstData.Columns[0]).ToString());
        }
Example #21
0
        private void treeList1_Click(object sender, EventArgs e)
        {
            TreeListMultiSelection selectedNodes = treeList1.Selection;

            try
            {
                Globals.id_res   = (int)(selectedNodes[0].GetValue(treeList1.Columns[5]));
                Globals.id_zavis = (int)(selectedNodes[0].GetValue(treeList1.Columns[6]));
                if (xtraTabControl1.SelectedTabPage == xtraTabPage1)
                {
                    if (Globals.id_res == 1)
                    {
                        this.deb_bytTableAdapter.FillBySever(this.uristDataSet1.deb_byt);
                    }
                    else if (Globals.id_res == 14)
                    {
                        this.deb_bytTableAdapter.FillByTalas(this.uristDataSet1.deb_byt);
                    }
                    else
                    {
                        if (Globals.id_zavis != 1 || Globals.id_zavis != 14)
                        {
                            if (Globals.id_res == 5 || Globals.id_res == 6 || Globals.id_res == 7 || Globals.id_res == 8 || Globals.id_res == 9 || Globals.id_res == 11 || Globals.id_res == 13 || Globals.id_res == 16 ||
                                Globals.id_res == 17 ||
                                Globals.id_res == 18 ||
                                Globals.id_res == 19)
                            {
                                this.deb_bytTableAdapter.FillByRes1(this.uristDataSet1.deb_byt, Globals.id_res);
                            }
                            else
                            {
                                this.deb_bytTableAdapter.FillByRes(this.uristDataSet1.deb_byt, Globals.id_res);
                            }
                        }
                        else
                        {
                            this.deb_bytTableAdapter.FillByUchastok(this.uristDataSet1.deb_byt, Globals.id_res.ToString());
                        }
                    }
                }
                if (xtraTabControl1.SelectedTabPage == xtraTabPage2)
                {
                    if (Globals.id_res == 1)
                    {
                        this.deb_promTableAdapter.FillBySever(this.uristDataSet1.deb_prom);
                    }
                    else if (Globals.id_res == 14)
                    {
                        this.deb_promTableAdapter.FillByTalas(this.uristDataSet1.deb_prom);
                    }
                    else
                    {
                        if (Globals.id_zavis != 1 || Globals.id_zavis != 14)
                        {
                            if (Globals.id_res == 5 || Globals.id_res == 6 || Globals.id_res == 7 || Globals.id_res == 8 || Globals.id_res == 9 || Globals.id_res == 11 || Globals.id_res == 13 || Globals.id_res == 4 || Globals.id_res == 10 || Globals.id_res == 12 || Globals.id_res == 17 ||
                                Globals.id_res == 18 || Globals.id_res == 16 || Globals.id_res == 15 ||
                                Globals.id_res == 19)
                            {
                                this.deb_promTableAdapter.FillByRes1(this.uristDataSet1.deb_prom, Globals.id_res);
                            }
                            else
                            {
                                this.deb_promTableAdapter.FillByRes(this.uristDataSet1.deb_prom, Globals.id_res);
                            }
                        }
                        else
                        {
                            this.deb_promTableAdapter.FillByUchastok(this.uristDataSet1.deb_prom, Globals.id_res.ToString());
                        }
                    }
                }
            }
            catch { }
        }
Example #22
0
        /// <summary>
        /// 设定计划事件
        /// </summary>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                TreeListMultiSelection NodeList = treeListDesignBom.Selection;
                if (NodeList.Count == 1)
                {
                    TreeListNode focusedNode = treeListDesignBom.FocusedNode;
                    if (focusedNode == null)
                    {
                        MessageHandler.ShowMessageBox("请选择要设定生产计划的设计Bom信息。");
                        return;
                    }
                    int isUse = DataTypeConvert.GetInt(focusedNode["IsUse"]);
                    if (isUse == 0)
                    {
                        MessageHandler.ShowMessageBox("设计Bom已经停用,不可以设定生产计划。");
                        return;
                    }

                    int autoId = DataTypeConvert.GetInt(focusedNode["ReId"]);
                    FrmProductionScheduleBom_InputSingle.bomListAutoId = autoId;
                    FrmProductionScheduleBom_InputSingle.psBomAutoId   = 0;
                    FrmProductionScheduleBom_InputSingle psBomForm = new FrmProductionScheduleBom_InputSingle();
                    if (psBomForm.ShowDialog() == DialogResult.OK)
                    {
                        RefreshPSBomInfo();
                    }
                }
                else
                {
                    if (NodeList.Count == 0)
                    {
                        MessageHandler.ShowMessageBox("请选择要设定生产计划的设计Bom信息。");
                        return;
                    }
                    List <int> bomListAutoIdList = new List <int>();
                    foreach (TreeListNode node in NodeList)
                    {
                        bomListAutoIdList.Add(DataTypeConvert.GetInt(node["ReId"]));
                    }

                    FrmProductionScheduleBom_InputMulti multiPSBomForm = new FrmProductionScheduleBom_InputMulti();
                    if (multiPSBomForm.ShowDialog() == DialogResult.OK)
                    {
                        //int isAll = DataTypeConvert.GetInt(multiPSBomForm.radioType.EditValue);
                        double   remainQty = DataTypeConvert.GetDouble(multiPSBomForm.spinRemainQty.Value);
                        DateTime planDate  = multiPSBomForm.datePlanDate.DateTime.Date;
                        if (bomDAO.SaveMultiProductionScheduleBom(bomListAutoIdList, 0, planDate, remainQty))
                        {
                            RefreshPSBomInfo();
                            ClearTreeListSelection_FocusedNode();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--设定计划事件错误。", ex);
            }
        }
Example #23
0
        /// <summary>
        /// Show user info in gridcontrol when user choose in treelist control
        /// </summary>
        private void treeMenu_RowCellClick(object sender, DevExpress.XtraTreeList.RowCellClickEventArgs e)
        {
            try
            {
                TreeList treeList = (TreeList)sender;
                TreeListMultiSelection selectedNodes = treeList.Selection;
                //Get mode from treelist
                //G: Group
                //R: All user
                //I: One user
                string mode = selectedNodes[0].GetValue(treeList.Columns[2]).ToString();

                //Edit user group info
                MouseEventArgs me = (MouseEventArgs)e;
                if (me.Button == MouseButtons.Right)
                {
                    if (mode == "G")
                    {
                        groupUserId   = selectedNodes[0].GetValue(treeList.Columns[0]).ToString();
                        groupUserName = selectedNodes[0].GetValue(treeList.Columns[1]).ToString();
                        popupUser.ShowPopup(Control.MousePosition);
                    }
                    return;
                }

                //Load user information to grid
                string title = "";

                //Get all user
                List <GroupUser> groupUsers = GroupUser.LoadAllUserGroup();

                //Init DataTable
                InitTableStructure(dtSource);



                if (mode == "R")
                {
                    dtSource.Clear();
                    DataTable dt = new DataTable();
                    InitTableStructure(dt);

                    //Load all user to grid
                    foreach (GroupUser g in groupUsers)
                    {
                        dt = g.ToDataTable();
                        foreach (DataRow dr1 in dt.Rows)
                        {
                            dtSource.ImportRow(dr1);
                        }
                    }
                    title = "All user";
                }
                else
                if (mode == "G")
                {
                    dtSource.Clear();
                    string groupUserId = selectedNodes[0].GetValue(treeList.Columns[0]).ToString();

                    //Load user by group to grid
                    foreach (GroupUser g in groupUsers)
                    {
                        if (g.groupId == groupUserId)
                        {
                            dtSource = g.ToDataTable();
                            title    = g.groupName;
                        }
                    }
                }
                else
                if (mode == "I")
                {
                    dtSource.Clear();
                    string userId = selectedNodes[0].GetValue(treeList.Columns[0]).ToString();

                    //Load one user to grid
                    foreach (GroupUser g in groupUsers)
                    {
                        foreach (Users u in g.ListUsers)
                        {
                            if (u.Id == userId)
                            {
                                DataRow dr2 = dtSource.NewRow();
                                dr2["userId"]     = u.Id;
                                dr2["personName"] = u.Name;
                                dr2["email"]      = u.Email;
                                if (u.ListCard == null)
                                {
                                    dr2["card"] = 0;
                                }
                                else
                                {
                                    dr2["card"] = u.ListCard.Count;
                                }
                                dtSource.Rows.Add(dr2);
                                if (Convert.ToBoolean(u.Status))
                                {
                                    dr2["status"] = "Active";
                                }
                                else
                                {
                                    dr2["status"] = "Deactive";
                                }
                                title = u.Name;
                            }
                        }
                    }
                }

                gridUser.DataSource = dtSource;
                lblTitle.Text       = title;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }