Exemplo n.º 1
0
        private void bcpSearch_Click(object sender, EventArgs e)
        {

            try
            {
                string condition = String.Empty;

                if (tbPathNo.Text.Trim() != "")
                {
                    condition = "pd.PathNo like '%" + tbPathNo.Text + "%'";
                }
                else
                {
                    condition = "1=1";
                }

                if (tbStationAddress.Text.Trim() != "")
                {
                    condition += "and pd.StationAddress like '%" + Convert.ToInt32(tbStationAddress.Text).ToString() + "%'";
                }

                if (tbPointAddress.Text.Trim() != "")
                {
                    condition += "and pd.StationHeadAddress like '%" + Convert.ToInt32(tbPointAddress.Text).ToString() + "%'";
                }

                if (pathDetailBll == null)
                    pathDetailBll = new PathDetailBll();

                DataTable dt = pathDetailBll.SelectPathDetail(condition);

                SortDataGrid(dt);
            }
            catch( Exception ex)
            {
                MessageBox.Show("查询条件错误,分站或接收器地址应该为整数",ex.Message,MessageBoxButtons.OK,MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 2
0
        private void tvMain_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == MouseButtons.Left && e.Node.Nodes.Count < 1)
            {
                //MessageBox.Show(e.Node.Name);

                string pathNo = e.Node.Name;
                if (pathDetailBll == null)
                    pathDetailBll = new PathDetailBll();

                string condition = "pd.PathNo='" + pathNo + "'";

                DataTable dt = pathDetailBll.SelectPathDetail(condition);
                SortDataGrid(dt);
            }

            
        }
Exemplo n.º 3
0
        /// <summary>
        /// 操作 “增加” 或 “修改”时的操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddOrEdit_Click(object sender, EventArgs e)
        {
            if (CheckValue())
            {
                if (btnAddOrEdit.CaptionTitle == "增加")
                {
                    operated = 1;

                    int result = AddPathDetailInfo();
                    if (result == 1)
                    {
                        
                        
                        if (pathDetailBll == null)
                            pathDetailBll = new PathDetailBll();

                        MessageBox.Show("增加信息成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        if (!New_DBAcess.IsDouble)
                        {
                            DataTable dt = pathDetailBll.SelectPathDetail("");

                            SortDataGrid(dt);
                        }
                        else
                        {
                            timer1.Start();
                        }

                    }
                    else
                    {
                        MessageBox.Show("增加操作失败,记录可能已存在,不能增加重复记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else if (btnAddOrEdit.CaptionTitle == "修改")
                {
                    operated = 3;

                    int result = UpdatePathDetailInfo();
                    if (result == 1)
                    {
                        if (pathDetailBll == null)
                            pathDetailBll = new PathDetailBll();
                        MessageBox.Show("修改信息成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        if (!New_DBAcess.IsDouble)
                        {
                            DataTable dt = pathDetailBll.SelectPathDetail("");

                            SortDataGrid(dt);
                        }
                        else
                        {
                            timer1.Start();
                        }
                        
                    }
                    else
                    {
                        MessageBox.Show("修改操作失败,记录可能已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }