Beispiel #1
0
        /// <summary>
        /// 获取笔记本使用记录
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        private DataTable GetNootBooksRData()
        {
            COMSSmobilerDemo.common.NBRecordInfo NBRecordInfo = new COMSSmobilerDemo.common.NBRecordInfo();
            DataTable table = NBRecordInfo.GetNBData();

            return(table);
        }
        private void btnpop_Click(object sender, EventArgs e)
        {
            try
            {
                btnName = sender;
                COMSSmobilerDemo.common.NBRecordInfo NBRecordInfo = new COMSSmobilerDemo.common.NBRecordInfo();
                COMSSmobilerDemo.common.NBInfo       NBInfo       = new COMSSmobilerDemo.common.NBInfo();

                DataTable table = new DataTable();
                PopList1.Groups.Clear();
                PopListGroup poli = new PopListGroup();
                PopList1.Groups.Add(poli);
                switch (((Button)btnName).Name)
                {
                case "btnCODE2":

                    table     = NBInfo.GetNootBooksData(0, 3);
                    poli.Text = "笔记本序列号选择";
                    foreach (DataRow rowli in table.Rows)
                    {
                        poli.Items.Add(rowli["NB_EQNO"].ToString(), rowli["NB_EQNO"].ToString());
                        if (string.IsNullOrWhiteSpace(NB_EQNO) == false)
                        {
                            if (NB_EQNO.Equals(rowli["NB_EQNO"].ToString()))
                            {
                                PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
                            }
                        }
                    }

                    break;

                case "btnUser":
                case "btnUser2":
                    table     = NBRecordInfo.GetUserData();
                    poli.Text = "用户选择";
                    foreach (DataRow rowli in table.Rows)
                    {
                        poli.Items.Add(rowli["USER_NAME"].ToString(), rowli["USER_ID"].ToString());
                        if (string.IsNullOrWhiteSpace(User) == false)
                        {
                            if (User.Trim().ToUpper() == rowli["USER_ID"].ToString().Trim().ToUpper())
                            {
                                PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
                            }
                        }
                    }

                    break;

                case "btnType":
                case "btnType2":
                    table     = NBRecordInfo.StateData();
                    poli.Text = "操作类型选择";
                    foreach (DataRow rowli in table.Rows)
                    {
                        poli.Items.Add(rowli["StateName"].ToString(), rowli["State"].ToString());
                        if (Type.ToString().Length > 0)
                        {
                            if (Type.Equals(rowli["State"]))
                            {
                                PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
                            }
                        }
                    }

                    break;

                case "btnNBR_LOCATION":
                case "btnNBR_LOCATION2":
                    table     = NBInfo.AddressData();
                    poli.Text = "所在位置";
                    foreach (DataRow rowli in table.Rows)
                    {
                        poli.Items.Add(rowli["Address"].ToString(), rowli["ID"].ToString());
                        if (btnNBR_LOCATION.Text.Trim().Length > 0)
                        {
                            if (btnNBR_LOCATION.Text.Equals(rowli["Address"]))
                            {
                                PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
                            }
                        }
                    }

                    break;
                }
                PopList1.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }