Example #1
0
        private void Personal_Load(object sender, EventArgs e)
        {
            this.Width  = Fuctions.winFormWidth;
            this.Height = Fuctions.winFormHeight;

            strSql = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false' order by BorrowID DESC";
            BorrowBLL borrowbll = new BorrowBLL();

            borrows = borrowbll.selByCondition(strSql);
            userDataGrid.DataSource = borrows;

            userDataGrid.ReadOnly = true;
            userDataGrid.Width    = Fuctions.dataGridViewWidth;
            userDataGrid.Height   = Fuctions.dataGridViewHeight;
            userDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY);

            userDataGrid.Columns[0].HeaderText  = "主键";  //修改显示的列名
            userDataGrid.Columns[0].Visible     = false;
            userDataGrid.Columns[1].HeaderText  = "员工";
            userDataGrid.Columns[2].HeaderText  = "名称";
            userDataGrid.Columns[3].HeaderText  = "阶段";
            userDataGrid.Columns[4].HeaderText  = "编号";
            userDataGrid.Columns[5].HeaderText  = "借用日期";
            userDataGrid.Columns[6].HeaderText  = "归还日期";
            userDataGrid.Columns[7].HeaderText  = "是否归还";
            userDataGrid.Columns[7].Visible     = false;
            userDataGrid.Columns[8].HeaderText  = "试验项目";
            userDataGrid.Columns[9].HeaderText  = "状态";
            userDataGrid.Columns[10].HeaderText = "备注";
            userDataGrid.Columns[11].HeaderText = "操作人";


            userDataGrid.Columns[1].Width  = 50;
            userDataGrid.Columns[2].Width  = Fuctions.dataGridViewPhoneName;
            userDataGrid.Columns[3].Width  = 80;
            userDataGrid.Columns[4].Width  = 80;
            userDataGrid.Columns[5].Width  = 120;
            userDataGrid.Columns[6].Width  = 120;
            userDataGrid.Columns[8].Width  = Fuctions.dataGridViewTest;;
            userDataGrid.Columns[9].Width  = 50;
            userDataGrid.Columns[10].Width = 150;
            userDataGrid.Columns[11].Width = 50;

            Fuctions.AutoSize(userDataGrid);
        }
        //硬件测试组 未还样机按钮
        private void button1_Click(object sender, EventArgs e)
        {
            string strsqla = "select pmborrow.BorrowID, pmborrow.StaffName, pmborrow.PhoneName, pmborrow.PhoneStage, pmborrow.PhoneNum, pmborrow.BorrowDate,pmborrow.ReturnDate, pmborrow.IsReturn, pmborrow.Test, pmborrow.IsNormal, pmborrow.Remark, pmborrow.Operator";
            string strSqlb = " FROM pmstaff, pmborrow WHERE pmstaff.StaffCode='Y' AND pmborrow.StaffName=pmstaff.StaffName and pmborrow.isreturn='false'";
            string strSql  = strsqla + strSqlb;


            if (cbbPhoneName.Text != "")
            {
                strSql = strSql + " and PhoneName ='" + cbbPhoneName.Text + "'";
                if (cbbPhoneStage.Text != "")
                {
                    strSql = strSql + " and PhoneStage ='" + cbbPhoneStage.Text + "'";
                }

                strSql = strSql + " order by BorrowID desc";
                BorrowBLL borrowbll = new BorrowBLL();
                borrows = borrowbll.selByCondition(strSql);
                borrowQDataGrid.DataSource = borrows;
            }
        }
Example #3
0
        private void Father_son_Load(object sender, EventArgs e)
        {
            MinimizeBox     = false;
            MaximizeBox     = false;
            ControlBox      = false;
            FormBorderStyle = FormBorderStyle.None;

            strSql = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false'";
            MySqlConnection conn      = new MySqlConnection(GetConn.connection);            //显示所有借阅信息
            BorrowBLL       borrowbll = new BorrowBLL();

            borrows = borrowbll.selByCondition(strSql);
            userDataGrid.DataSource = borrows;

            userDataGrid.ReadOnly = true;
            userDataGrid.RowHeadersWidthSizeMode     = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
            userDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            userDataGrid.Width  = Fuctions.dataGridViewWidth;
            userDataGrid.Height = Fuctions.dataGridViewHeight;


            userDataGrid.Columns[0].HeaderText  = "主键";  //修改显示的列名
            userDataGrid.Columns[0].Visible     = false;
            userDataGrid.Columns[1].HeaderText  = "员工";
            userDataGrid.Columns[2].HeaderText  = "样机名称";
            userDataGrid.Columns[3].HeaderText  = "样机阶段";
            userDataGrid.Columns[4].HeaderText  = "样机编号";
            userDataGrid.Columns[5].HeaderText  = "借用日期";
            userDataGrid.Columns[6].HeaderText  = "归还日期";
            userDataGrid.Columns[7].HeaderText  = "是否归还";
            userDataGrid.Columns[8].HeaderText  = "试验项目";
            userDataGrid.Columns[9].HeaderText  = "是否正常";
            userDataGrid.Columns[10].HeaderText = "备注";
            userDataGrid.Columns[11].HeaderText = "备用";
            userDataGrid.Columns[11].Visible    = false;

            Fuctions.AutoSizeColumn(userDataGrid);
        }
Example #4
0
        private void BorrowInfoForm_Load(object sender, EventArgs e)            //加载窗体时执行操作
        {
            this.Width  = Fuctions.winFormWidth;
            this.Height = Fuctions.winFormHeight;

            string    strSql    = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false' order by BorrowID DESC"; //样机名称combobox内容加载
            BorrowBLL borrowbll = new BorrowBLL();                                                                                                      //DataGrid 内容加载

            borrows = borrowbll.selByCondition(strSql);
            borrowDataGrid.DataSource = borrows;


            borrowDataGrid.ReadOnly = true;
            borrowDataGrid.RowHeadersWidthSizeMode     = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
            borrowDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            borrowDataGrid.Width    = Fuctions.dataGridViewWidth;
            borrowDataGrid.Height   = 335;
            borrowDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY);

            borrowDataGrid.Columns[0].HeaderText  = "主键";  //修改显示的列名
            borrowDataGrid.Columns[0].Visible     = false;
            borrowDataGrid.Columns[1].HeaderText  = "员工";
            borrowDataGrid.Columns[2].HeaderText  = "名称";
            borrowDataGrid.Columns[3].HeaderText  = "阶段";
            borrowDataGrid.Columns[4].HeaderText  = "编号";
            borrowDataGrid.Columns[5].HeaderText  = "借用日期";
            borrowDataGrid.Columns[6].HeaderText  = "归还日期";
            borrowDataGrid.Columns[7].HeaderText  = "是否归还";
            borrowDataGrid.Columns[7].Visible     = false;
            borrowDataGrid.Columns[8].HeaderText  = "试验项目";
            borrowDataGrid.Columns[9].HeaderText  = "状态";
            borrowDataGrid.Columns[10].HeaderText = "备注";
            borrowDataGrid.Columns[11].HeaderText = "操作人";


            borrowDataGrid.Columns[1].Width  = 50;
            borrowDataGrid.Columns[2].Width  = Fuctions.dataGridViewPhoneName;
            borrowDataGrid.Columns[3].Width  = 80;
            borrowDataGrid.Columns[4].Width  = Fuctions.dataGridViewPhoneNum;;
            borrowDataGrid.Columns[5].Width  = 120;
            borrowDataGrid.Columns[6].Width  = 120;
            borrowDataGrid.Columns[8].Width  = Fuctions.dataGridViewTest;
            borrowDataGrid.Columns[9].Width  = 50;
            borrowDataGrid.Columns[10].Width = Fuctions.dataGridViewNote;
            borrowDataGrid.Columns[11].Width = 50;

            Fuctions.AutoSize(borrowDataGrid);


            /*
             * 样机相关内容加载
             *
             */

            //样机名称加载
            strSql = "select distinct PhoneName from PmPhone where PhoneStatus = '在库' and PhoneDisplay = 'TRUE'"; //样机名称combobox内容加载
            MySqlCommand cmd = new MySqlCommand(strSql, conn);

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataSet          ds = new DataSet();

            conn.Open();
            da.Fill(ds, "PmPhone");
            conn.Close();
            cbbPhoneName.DisplayMember = "PhoneName";
            cbbPhoneName.ValueMember   = "PhoneName";
            cbbPhoneName.DataSource    = ds.Tables["PmPhone"];
            cbbPhoneName.Text          = "";


            //实验名称加载
            strSql = "select distinct HGroupTest from PmGroup where HGroupName = '可靠性'";
            cmd    = new MySqlCommand(strSql, conn);

            da = new MySqlDataAdapter(cmd);
            ds = new DataSet();
            conn.Open();
            da.Fill(ds, "PmTest");
            conn.Close();
            cbbHGroupTest.DisplayMember = "HGroupTest";
            cbbHGroupTest.ValueMember   = "HGroupTest";
            cbbHGroupTest.DataSource    = ds.Tables["PmTest"];
            cbbHGroupTest.Text          = "";


            //还样机状态IsNormal内容加载
            DataTable  dt  = new DataTable();
            DataColumn dc1 = new DataColumn("text");
            DataColumn dc2 = new DataColumn("value");

            dt.Columns.Add(dc1);
            dt.Columns.Add(dc2);

            DataRow dr1 = dt.NewRow();

            dr1["text"]  = "正常";
            dr1["value"] = "hello 正常";
            DataRow dr2 = dt.NewRow();

            dr2["text"]  = "故障";
            dr2["value"] = "hello 故障";
            dt.Rows.Add(dr1);
            dt.Rows.Add(dr2);

            //cbb中内容加载
            cbbIsNormal.DisplayMember = "text";
            cbbIsNormal.ValueMember   = "value";
            cbbIsNormal.DataSource    = dt.Copy();
            cbbIsNormal.Text          = "正常";

            cbbIsNormal1.DisplayMember = "text";
            cbbIsNormal1.ValueMember   = "value";
            cbbIsNormal1.DataSource    = dt.Copy();
            cbbIsNormal1.Text          = "正常";

            cbbIsNormal2.DisplayMember = "text";
            cbbIsNormal2.ValueMember   = "value";
            cbbIsNormal2.DataSource    = dt.Copy();
            cbbIsNormal2.Text          = "正常";

            cbbIsNormal3.DisplayMember = "text";
            cbbIsNormal3.ValueMember   = "value";
            cbbIsNormal3.DataSource    = dt.Copy();
            cbbIsNormal3.Text          = "正常";

            cbbIsNormal4.DisplayMember = "text";
            cbbIsNormal4.ValueMember   = "value";
            cbbIsNormal4.DataSource    = dt.Copy();
            cbbIsNormal4.Text          = "正常";

            cbbIsNormal5.DisplayMember = "text";
            cbbIsNormal5.ValueMember   = "value";
            cbbIsNormal5.DataSource    = dt.Copy();
            cbbIsNormal5.Text          = "正常";

            cbbIsNormal6.DisplayMember = "text";
            cbbIsNormal6.ValueMember   = "value";
            cbbIsNormal6.DataSource    = dt.Copy();
            cbbIsNormal6.Text          = "正常";

            cbbIsNormal9.DisplayMember = "text";
            cbbIsNormal9.ValueMember   = "value";
            cbbIsNormal9.DataSource    = dt.Copy();
            cbbIsNormal9.Text          = "正常";

            cbbIsNormal7.DisplayMember = "text";
            cbbIsNormal7.ValueMember   = "value";
            cbbIsNormal7.DataSource    = dt.Copy();
            cbbIsNormal7.Text          = "正常";

            cbbIsNormal8.DisplayMember = "text";
            cbbIsNormal8.ValueMember   = "value";
            cbbIsNormal8.DataSource    = dt.Copy();
            cbbIsNormal8.Text          = "正常";
        }
Example #5
0
        /*
         *需求:通过按键实现样机 借还一起,主要是为了记录做过的实验,及实验后的状态
         *思路:先借 后还
         */

        private void button1_Click(object sender, EventArgs e)
        {
            string ip = Fuctions.GetIpAddress();

            if (LoginForm.admin == 0)
            {
                if (ip != IPADRESS && ip != IPADDRESS1 && ip != IPADRESS2)
                {
                    MessageBox.Show("请去指定电脑进行样机借阅", "提示");
                    return;
                }
            }

            BorrowBLL borrowbll = new BorrowBLL();
            PhoneBLL  phonebll  = new PhoneBLL();

            //若是五行中的 样机编号没有选,给出提示
            if (cbbPhoneNum1.Text == "" && cbbPhoneNum2.Text == "" && cbbPhoneNum3.Text == "" && cbbPhoneNum4.Text == "" && cbbPhoneNum.Text == "" & cbbPhoneNum5.Text == "" && cbbPhoneNum6.Text == "" && cbbPhoneNum7.Text == "" && cbbPhoneNum8.Text == "" && cbbPhoneNum9.Text == "")
            {
                MessageBox.Show("请输入样机编号");
                return;
            }

            if (cbbPhoneName.Text == "" || cbbPhoneStage.Text == "")
            {
                MessageBox.Show("请输入样机信息");
                return;
            }
            else
            {
                //判断样机状态是否选择
                if (cbbPhoneNum.Text != "")
                {
                    if (cbbIsNormal.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注
                    if (cbbIsNormal.Text == "故障" && txtRemark.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum1.Text != "")
                {
                    if (cbbIsNormal1.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal1.Text == "故障" && txtRemark1.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum2.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal2.Text == "故障" && txtRemark2.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                    if (cbbIsNormal2.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                }
                if (cbbPhoneNum3.Text != "")
                {
                    if (cbbIsNormal3.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注
                    if (cbbIsNormal3.Text == "故障" && txtRemark3.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum4.Text != "")
                {
                    if (cbbIsNormal4.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal4.Text == "故障" && txtRemark4.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum5.Text != "")
                {
                    if (cbbIsNormal5.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal5.Text == "故障" && txtRemark5.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum6.Text != "")
                {
                    if (cbbIsNormal6.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal6.Text == "故障" && txtRemark6.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum7.Text != "")
                {
                    if (cbbIsNormal7.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal7.Text == "故障" && txtRemark7.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum8.Text != "")
                {
                    if (cbbIsNormal8.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal8.Text == "故障" && txtRemark8.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }
                if (cbbPhoneNum9.Text != "")
                {
                    if (cbbIsNormal9.Text == "")
                    {
                        MessageBox.Show("请输入样机状态");
                        return;
                    }
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal9.Text == "故障" && txtRemark9.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }
                }


                //借机操作
                if (cbbPhoneNum.Text != "")
                {
                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum.Text + "借", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum.Text, cbbHGroupTest.Text, cbbIsNormal.Text, txtRemark.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum.Text + "还", "提示");
                    }
                }


                //借机操作2
                if (cbbPhoneNum1.Text != "")
                {
                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum1.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum1.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum1.Text, cbbHGroupTest.Text, cbbIsNormal1.Text, txtRemark1.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum1.Text + "还错误", "提示");
                    }
                }

                //操作3
                if (cbbPhoneNum2.Text != "")
                {
                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum2.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum2.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum2.Text, cbbHGroupTest.Text, cbbIsNormal2.Text, txtRemark2.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum2.Text + "还错误", "提示");
                    }
                }


                //操作4
                if (cbbPhoneNum3.Text != "")
                {
                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum3.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum3.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum3.Text, cbbHGroupTest.Text, cbbIsNormal3.Text, txtRemark3.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum3.Text + "还错误", "提示");
                    }
                }


                //操作5
                if (cbbPhoneNum4.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal4.Text == "故障" && txtRemark4.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum4.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum4.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum4.Text, cbbHGroupTest.Text, cbbIsNormal4.Text, txtRemark4.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum4.Text + "还错误", "提示");
                    }
                }


                //操作6
                if (cbbPhoneNum5.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal5.Text == "故障" && txtRemark5.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum5.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum5.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum5.Text, cbbHGroupTest.Text, cbbIsNormal5.Text, txtRemark5.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum5.Text + "还错误", "提示");
                    }
                }


                //操作7
                if (cbbPhoneNum6.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal6.Text == "故障" && txtRemark6.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum6.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum6.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum6.Text, cbbHGroupTest.Text, cbbIsNormal6.Text, txtRemark6.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum6.Text + "还错误", "提示");
                    }
                }


                //操作8
                if (cbbPhoneNum7.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal7.Text == "故障" && txtRemark7.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum7.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum7.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum7.Text, cbbHGroupTest.Text, cbbIsNormal7.Text, txtRemark7.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum7.Text + "还错误", "提示");
                    }
                }


                //操作9
                if (cbbPhoneNum8.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal8.Text == "故障" && txtRemark8.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum8.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum8.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum8.Text, cbbHGroupTest.Text, cbbIsNormal8.Text, txtRemark8.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum8.Text + "还错误", "提示");
                    }
                }


                //操作10
                if (cbbPhoneNum9.Text != "")
                {
                    //样机状态是否正常,若是故障时需要输入备注

                    if (cbbIsNormal9.Text == "故障" && txtRemark9.Text == "")
                    {
                        MessageBox.Show("样机故障,请输入故障信息", "提示");
                        return;
                    }

                    //借与还操作
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum9.Text, LoginForm.usrName))
                    {
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum9.Text + "借错误", "提示");
                    }
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum9.Text, cbbHGroupTest.Text, cbbIsNormal9.Text, txtRemark9.Text))
                    {
                        //MessageBox.Show("操作成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show(this.cbbPhoneNum9.Text + "还错误", "提示");
                    }
                }
                MessageBox.Show("操作成功");
            }

            string strSql = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' order by BorrowID DESC"; //样机名称combobox内容加载

            borrows = borrowbll.selByCondition(strSql);                                                                    //DataGrid 内容加载
            borrowDataGrid.DataSource = borrows;

            //借机相关内容更新**********************************************************
            strSql = "select distinct PhoneName from PmPhone where PhoneStatus = '在库'and PhoneDisplay = 'TRUE'";  //更新借样机cbb中样机信息
            MySqlCommand     cmd = new MySqlCommand(strSql, conn);
            MySqlDataAdapter da  = new MySqlDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            conn.Open();
            da.Fill(ds, "PmPhone");
            conn.Close();
            cbbPhoneName.DisplayMember = "PhoneName";
            cbbPhoneName.ValueMember   = "PhoneName";
            cbbPhoneName.DataSource    = ds.Tables["PmPhone"];
            cbbPhoneName.Text          = "";

            //收尾工作:清空无关信息

            txtRemark.Text  = "";
            txtRemark1.Text = "";
            txtRemark2.Text = "";
            txtRemark3.Text = "";
            txtRemark4.Text = "";
            txtRemark5.Text = "";
            txtRemark6.Text = "";
            txtRemark7.Text = "";
            txtRemark8.Text = "";
            txtRemark9.Text = "";

            //默认正常
            cbbIsNormal.Text  = "正常";
            cbbIsNormal1.Text = "正常";
            cbbIsNormal2.Text = "正常";
            cbbIsNormal3.Text = "正常";
            cbbIsNormal4.Text = "正常";
            cbbIsNormal5.Text = "正常";
            cbbIsNormal6.Text = "正常";
            cbbIsNormal7.Text = "正常";
            cbbIsNormal8.Text = "正常";
            cbbIsNormal9.Text = "正常";
        }
Example #6
0
        private void btnReturn_Click(object sender, EventArgs e)                                    //还样机按钮
        {
            string ip = Fuctions.GetIpAddress();

            //if (LoginForm.admin == 0)
            //{
            //    if (ip != IPADRESS && ip != IPADDRESS1 && ip != IPADRESS2)
            //    {
            //        MessageBox.Show("请去指定电脑进行样机借阅");
            //        return;
            //    }
            //}

            BorrowBLL borrowbll = new BorrowBLL();
            PhoneBLL  phonebll  = new PhoneBLL();

            // 若是第一行的四个中有一个为空,则给出提示
            if (cbbPhoneName1.Text == "" || cbbPhoneStage1.Text == "" || cbbHGroupName1.Text == "" || cbbHGroupTest1.Text == "")
            {
                MessageBox.Show("请输入除备注以外的所有信息", "提示");
                return;
            }

            //若是五行中的 样机编号没有选,给出提示
            if (cbbPhoneNum1.Text == "" && cbbPhoneNum2.Text == "" && cbbPhoneNum3.Text == "" && cbbPhoneNum4.Text == "" && cbbPhoneNum5.Text == "")
            {
                MessageBox.Show("请输入归还的样机编号");
            }

            //样机归还时第一行的信息是否完整
            if (cbbPhoneNum1.Text != "")
            {
                if (cbbPhoneNum1.Text == cbbPhoneNum2.Text || cbbPhoneNum1.Text == cbbPhoneNum3.Text || cbbPhoneNum1.Text == cbbPhoneNum4.Text || cbbPhoneNum1.Text == cbbPhoneNum5.Text)
                {
                    MessageBox.Show("归还样机编号重复,请检查编号");
                    return;
                }

                if (cbbIsNormal1.Text == "")
                {
                    MessageBox.Show("请输入样机状态");
                    return;
                }

                if (cbbIsNormal1.Text == "故障" && txtRemark1.Text == "")
                {
                    MessageBox.Show("样机故障,请输入故障信息", "提示");
                    return;
                }
                else
                {
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum1.Text, cbbHGroupTest1.Text + "|" + cbbHGroupTest2.Text + "|" + cbbHGroupTest3.Text, cbbIsNormal1.Text, txtRemark1.Text) &&
                        phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum1.Text))
                    {
                        MessageBox.Show("样机归还成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示");
                    }
                }
            }

            //样机归还时第二行的信息是否完整
            if (cbbPhoneNum2.Text != "")
            {
                if (cbbPhoneNum2.Text == cbbPhoneNum1.Text || cbbPhoneNum2.Text == cbbPhoneNum3.Text || cbbPhoneNum2.Text == cbbPhoneNum4.Text || cbbPhoneNum2.Text == cbbPhoneNum5.Text)
                {
                    MessageBox.Show("归还样机编号重复,请检查编号");
                    return;
                }
                if (cbbIsNormal2.Text == "")
                {
                    MessageBox.Show("请输入样机状态");
                    return;
                }

                if (cbbIsNormal2.Text == "故障" && txtRemark2.Text == "")
                {
                    MessageBox.Show("样机故障,请输入故障信息", "提示");
                    return;
                }
                else
                {
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum2.Text, cbbHGroupTest1.Text + "|" + cbbHGroupTest2.Text + "|" + cbbHGroupTest3.Text, cbbIsNormal2.Text, txtRemark2.Text) &&
                        phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum2.Text))
                    {
                        // MessageBox.Show("样机归还成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示");
                    }
                }
            }

            //样机归还时第三行的信息是否完整
            if (cbbPhoneNum3.Text != "")
            {
                if (cbbPhoneNum3.Text == cbbPhoneNum1.Text || cbbPhoneNum3.Text == cbbPhoneNum2.Text || cbbPhoneNum3.Text == cbbPhoneNum4.Text || cbbPhoneNum3.Text == cbbPhoneNum5.Text)
                {
                    MessageBox.Show("归还样机编号重复,请检查编号");
                    return;
                }

                if (cbbIsNormal3.Text == "")
                {
                    MessageBox.Show("请输入样机状态");
                    return;
                }

                if (cbbIsNormal3.Text == "故障" && txtRemark3.Text == "")
                {
                    MessageBox.Show("样机故障,请输入故障信息", "提示");
                    return;
                }
                else
                {
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum3.Text, cbbHGroupTest1.Text + "|" + cbbHGroupTest2.Text + "|" + cbbHGroupTest3.Text, cbbIsNormal3.Text, txtRemark3.Text) &&
                        phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum3.Text))
                    {
                        //MessageBox.Show("样机归还成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示");
                    }
                }
            }

            //样机归还时第四行的信息是否完整
            if (cbbPhoneNum4.Text != "")
            {
                if (cbbPhoneNum4.Text == cbbPhoneNum1.Text || cbbPhoneNum4.Text == cbbPhoneNum2.Text || cbbPhoneNum4.Text == cbbPhoneNum3.Text || cbbPhoneNum4.Text == cbbPhoneNum5.Text)
                {
                    MessageBox.Show("归还样机编号重复,请检查编号");
                    return;
                }

                if (cbbIsNormal4.Text == "")
                {
                    MessageBox.Show("请输入样机状态");
                    return;
                }

                if (cbbIsNormal4.Text == "故障" && txtRemark4.Text == "")
                {
                    MessageBox.Show("样机故障,请输入故障信息", "提示");
                    return;
                }
                else
                {
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum4.Text, cbbHGroupTest1.Text + "|" + cbbHGroupTest2.Text + "|" + cbbHGroupTest3.Text, cbbIsNormal4.Text, txtRemark4.Text) &&
                        phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum4.Text))
                    {
                        //MessageBox.Show("样机归还成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示");
                    }
                }
            }


            //样机归还时第五行的信息是否完整
            if (cbbPhoneNum5.Text != "")
            {
                if (cbbPhoneNum5.Text == cbbPhoneNum1.Text || cbbPhoneNum5.Text == cbbPhoneNum2.Text || cbbPhoneNum5.Text == cbbPhoneNum3.Text || cbbPhoneNum5.Text == cbbPhoneNum4.Text)
                {
                    MessageBox.Show("归还样机编号重复,请检查编号");
                    return;
                }

                if (cbbIsNormal5.Text == "")
                {
                    MessageBox.Show("请输入样机状态");
                    return;
                }

                if (cbbIsNormal5.Text == "故障" && txtRemark5.Text == "")
                {
                    MessageBox.Show("样机故障,请输入故障信息", "提示");
                    return;
                }
                else
                {
                    if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum5.Text, cbbHGroupTest1.Text + "|" + cbbHGroupTest2.Text + "|" + cbbHGroupTest3.Text, cbbIsNormal5.Text, txtRemark5.Text) &&
                        phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum5.Text))
                    {
                        //MessageBox.Show("样机归还成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示");
                    }
                }
            }

            string strSql = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false' order by BorrowID DESC"; //样机名称combobox内容加载

            borrows = borrowbll.selByCondition(strSql);                                                                                           //DataGrid 内容加载
            borrowDataGrid.DataSource = borrows;


            //借机相关内容更新**********************************************************
            strSql = "select distinct PhoneName from PmPhone where PhoneStatus = '在库' and PhoneDisplay = 'TRUE'";                //更新样机cbb信息
            MySqlCommand     cmd = new MySqlCommand(strSql, conn);
            MySqlDataAdapter da  = new MySqlDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            conn.Open();
            da.Fill(ds, "PmPhone");
            conn.Close();
            cbbPhoneName.DisplayMember = "PhoneName";
            cbbPhoneName.ValueMember   = "PhoneName";
            cbbPhoneName.DataSource    = ds.Tables["PmPhone"];
            cbbPhoneName.Text          = "";

            //**********************************************************还机相关内容更新

            strSql = "select distinct PhoneName from PmBorrow where IsReturn = 'false' and StaffName = '" + LoginForm.usrName + "'";        //还样机名称combobox内容加载
            cmd    = new MySqlCommand(strSql, conn);

            da = new MySqlDataAdapter(cmd);
            ds = new DataSet();
            conn.Open();
            da.Fill(ds, "PmBorrow");
            conn.Close();
            cbbPhoneName1.DisplayMember = "PhoneName";
            cbbPhoneName1.ValueMember   = "PhoneName";
            cbbPhoneName1.DataSource    = ds.Tables["PmBorrow"];
            cbbPhoneName1.Text          = "";



            //--其余的清空

            cbbHGroupName1.Text = "";
            cbbHGroupTest1.Text = "";
            cbbHGroupName2.Text = "";
            cbbHGroupTest2.Text = "";
            cbbHGroupName3.Text = "";
            cbbHGroupTest3.Text = "";

            cbbIsNormal1.Text = "";
            txtRemark1.Text   = "";

            cbbIsNormal2.Text = "";
            txtRemark2.Text   = "";

            cbbIsNormal3.Text = "";
            txtRemark3.Text   = "";

            cbbIsNormal4.Text = "";
            txtRemark4.Text   = "";

            cbbIsNormal5.Text = "";
            txtRemark5.Text   = "";
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)                                   //借样机按钮
        {
            string ip = Fuctions.GetIpAddress();

            if (LoginForm.admin == 0)
            {
                if (ip != IPADRESS && ip != IPADDRESS1 && ip != IPADRESS2 && ip != IPADRESS3)
                {
                    MessageBox.Show("请去指定电脑进行样机借阅", "提示");
                    return;
                }
            }

            BorrowBLL borrowbll = new BorrowBLL();
            PhoneBLL  phonebll  = new PhoneBLL();

            if (cbbPhoneName.Text == "" || cbbPhoneStage.Text == "" || ((cbbPhoneNum.Text == "") && (cbbPhoneNumL1.Text == "") && (cbbPhoneNumL2.Text == "") && (cbbPhoneNumL3.Text == "") && (cbbPhoneNumL4.Text == "")))
            {
                MessageBox.Show("请输入样机信息");
                return;
            }
            else
            {
                if (cbbPhoneNum.Text != "")
                {
                    if (cbbPhoneNum.Text == cbbPhoneNumL1.Text || cbbPhoneNum.Text == cbbPhoneNumL2.Text || cbbPhoneNum.Text == cbbPhoneNumL3.Text || cbbPhoneNum.Text == cbbPhoneNumL4.Text)
                    {
                        MessageBox.Show("借阅样机编号重复,请检查编号");
                        return;
                    }

                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNum.Text, LoginForm.usrName))
                    {
                        //MessageBox.Show("借阅成功");
                    }
                    if (phonebll.updatePhoneStatusOut(cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNum.Text))                            //更新数据库 PmPhone 中的信息
                    {
                        //MessageBox.Show("借阅成功");
                    }
                }

                if (cbbPhoneNumL1.Text != "")
                {
                    if (cbbPhoneNumL1.Text == cbbPhoneNum.Text || cbbPhoneNumL1.Text == cbbPhoneNumL2.Text || cbbPhoneNumL1.Text == cbbPhoneNumL3.Text || cbbPhoneNumL1.Text == cbbPhoneNumL4.Text)
                    {
                        MessageBox.Show("借阅样机编号重复,请检查编号");
                        return;
                    }
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNumL1.Text, LoginForm.usrName))
                    {
                        //MessageBox.Show("借阅成功");
                    }
                    if (phonebll.updatePhoneStatusOut(cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNumL1.Text))                            //更新数据库 PmPhone 中的信息
                    {
                        //MessageBox.Show("借阅成功");
                    }
                }

                if (cbbPhoneNumL2.Text != "")
                {
                    if (cbbPhoneNumL2.Text == cbbPhoneNum.Text || cbbPhoneNumL2.Text == cbbPhoneNumL1.Text || cbbPhoneNumL2.Text == cbbPhoneNumL3.Text || cbbPhoneNumL2.Text == cbbPhoneNumL4.Text)
                    {
                        MessageBox.Show("借阅样机编号重复,请检查编号");
                        return;
                    }

                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNumL2.Text, LoginForm.usrName))
                    {
                        //MessageBox.Show("借阅成功");
                    }
                    if (phonebll.updatePhoneStatusOut(cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNumL2.Text))                            //更新数据库 PmPhone 中的信息
                    {
                        //MessageBox.Show("借阅成功");
                    }
                }

                if (cbbPhoneNumL3.Text != "")
                {
                    if (cbbPhoneNumL3.Text == cbbPhoneNum.Text || cbbPhoneNumL3.Text == cbbPhoneNumL1.Text || cbbPhoneNumL3.Text == cbbPhoneNumL2.Text || cbbPhoneNumL3.Text == cbbPhoneNumL4.Text)
                    {
                        MessageBox.Show("借阅样机编号重复,请检查编号");
                        return;
                    }
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNumL3.Text, LoginForm.usrName))
                    {
                        //MessageBox.Show("借阅成功");
                    }
                    if (phonebll.updatePhoneStatusOut(cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNumL3.Text))                            //更新数据库 PmPhone 中的信息
                    {
                        //MessageBox.Show("借阅成功");
                    }
                }

                if (cbbPhoneNumL4.Text != "")
                {
                    if (cbbPhoneNumL4.Text == cbbPhoneNum.Text || cbbPhoneNumL4.Text == cbbPhoneNumL1.Text || cbbPhoneNumL4.Text == cbbPhoneNumL2.Text || cbbPhoneNumL4.Text == cbbPhoneNumL3.Text)
                    {
                        MessageBox.Show("借阅样机编号重复,请检查编号");
                        return;
                    }
                    if (borrowbll.addBorrow(LoginForm.usrName, this.cbbPhoneName.Text, this.cbbPhoneStage.Text, this.cbbPhoneNumL4.Text, LoginForm.usrName))
                    {
                        //MessageBox.Show("借阅成功");
                    }
                    if (phonebll.updatePhoneStatusOut(cbbPhoneName.Text, cbbPhoneStage.Text, cbbPhoneNumL4.Text))                            //更新数据库 PmPhone 中的信息
                    {
                        //MessageBox.Show("借阅成功");
                    }
                }

                MessageBox.Show("借阅成功");
            }


            string strSql = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false' order by BorrowID DESC"; //样机名称combobox内容加载

            borrows = borrowbll.selByCondition(strSql);                                                                                           //DataGrid 内容加载
            borrowDataGrid.DataSource = borrows;

            //借机相关内容更新**********************************************************
            strSql = "select distinct PhoneName from PmPhone where PhoneStatus = '在库'and PhoneDisplay = 'TRUE'";  //更新借样机cbb中样机信息
            MySqlCommand     cmd = new MySqlCommand(strSql, conn);
            MySqlDataAdapter da  = new MySqlDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            conn.Open();
            da.Fill(ds, "PmPhone");
            conn.Close();
            cbbPhoneName.DisplayMember = "PhoneName";
            cbbPhoneName.ValueMember   = "PhoneName";
            cbbPhoneName.DataSource    = ds.Tables["PmPhone"];
            cbbPhoneName.Text          = "";

            //还机相关内容更新**********************************************************
            strSql = "select distinct PhoneName from PmBorrow where IsReturn = 'false' and StaffName = '" + LoginForm.usrName + "'";        //还样机名称combobox内容加载
            cmd    = new MySqlCommand(strSql, conn);

            da = new MySqlDataAdapter(cmd);
            ds = new DataSet();
            conn.Open();
            da.Fill(ds, "PmBorrow");
            conn.Close();
            cbbPhoneName1.DisplayMember = "PhoneName";
            cbbPhoneName1.ValueMember   = "PhoneName";
            cbbPhoneName1.DataSource    = ds.Tables["PmBorrow"];
            cbbPhoneName1.Text          = "";
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            string strSql       = "select * from PmBorrow where 1=1";
            string strSqlNum    = "select * from PmPhone where 1 = 1";
            string strSqlNumOut = "select * from PmPhone where 1 = 1 and PhoneStatus = '借出'";
            string num          = "";
            string numOut       = "";

            txtNum.Text    = "";
            txtNumOut.Text = "";

            if (cbbStaffName.Text == "" && cbbPhoneName.Text == "" && cbbPhoneStage.Text == "" && cbbPhoneNum.Text == "" &&
                cbbHGroupTest.Text == "" && cbbIsNormal.Text == "" && cbbIsReturn.Text == "")
            {
                MessageBox.Show("请选择查询条件", "提示");
                return;
            }

            if (cbbStaffName.Text != "")
            {
                strSql = strSql + " and StaffName ='" + cbbStaffName.Text + "'";
            }
            if (cbbPhoneName.Text != "")
            {
                strSql = strSql + " and PhoneName ='" + cbbPhoneName.Text + "'";
            }
            if (cbbPhoneStage.Text != "")
            {
                strSql = strSql + " and PhoneStage ='" + cbbPhoneStage.Text + "'";
            }
            if (cbbPhoneNum.Text != "")
            {
                strSql = strSql + " and PhoneNum ='" + cbbPhoneNum.Text + "'";
            }
            if (cbbHGroupTest.Text != "")
            {
                strSql = strSql + " and Test ='" + cbbHGroupTest.Text + "'";
            }
            if (cbbIsNormal.Text != "")
            {
                strSql = strSql + " and IsNormal ='" + cbbIsNormal.Text + "'";
            }
            if (cbbIsReturn.Text != "")
            {
                strSql = strSql + " and IsReturn ='" + cbbIsReturn.Text + "'";
            }

            strSql = strSql + " order by BorrowID desc";

            BorrowBLL borrowbll = new BorrowBLL();

            borrows = borrowbll.selByCondition(strSql);
            borrowQDataGrid.DataSource = borrows;

            PhoneBLL phonebll = new PhoneBLL();


            if (cbbPhoneName.Text != "")
            {
                strSqlNum    = strSqlNum + " and PhoneName ='" + cbbPhoneName.Text + "'";
                strSqlNumOut = strSqlNumOut + " and PhoneName ='" + cbbPhoneName.Text + "'";

                if (cbbPhoneStage.Text != "")
                {
                    strSqlNum    = strSqlNum + " and PhoneStage ='" + cbbPhoneStage.Text + "'";
                    strSqlNumOut = strSqlNumOut + " and PhoneStage ='" + cbbPhoneStage.Text + "'";
                }

                num            = phonebll.selByConditionNum(strSqlNum);
                numOut         = phonebll.selByConditionNum(strSqlNumOut);
                txtNum.Text    = num;
                txtNumOut.Text = numOut;
            }
        }
Example #9
0
        private void BorrowInfoForm_Load(object sender, EventArgs e)            //加载窗体时执行操作
        {
            this.Width  = Fuctions.winFormWidth;
            this.Height = Fuctions.winFormHeight;

            string    strSql    = "select * from PmBorrow where StaffName = '" + LoginForm.usrName + "' and IsReturn = 'false' order by BorrowID DESC"; //样机名称combobox内容加载
            BorrowBLL borrowbll = new BorrowBLL();                                                                                                      //DataGrid 内容加载

            borrows = borrowbll.selByCondition(strSql);
            borrowDataGrid.DataSource = borrows;


            borrowDataGrid.ReadOnly = true;
            borrowDataGrid.RowHeadersWidthSizeMode     = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
            borrowDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            borrowDataGrid.Width = Fuctions.dataGridViewWidth;
            //borrowDataGrid.Height = 300;
            borrowDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY);

            borrowDataGrid.Columns[0].HeaderText  = "主键";  //修改显示的列名
            borrowDataGrid.Columns[0].Visible     = false;
            borrowDataGrid.Columns[1].HeaderText  = "员工";
            borrowDataGrid.Columns[2].HeaderText  = "名称";
            borrowDataGrid.Columns[3].HeaderText  = "阶段";
            borrowDataGrid.Columns[4].HeaderText  = "编号";
            borrowDataGrid.Columns[5].HeaderText  = "借用日期";
            borrowDataGrid.Columns[6].HeaderText  = "归还日期";
            borrowDataGrid.Columns[7].HeaderText  = "是否归还";
            borrowDataGrid.Columns[7].Visible     = false;
            borrowDataGrid.Columns[8].HeaderText  = "试验项目";
            borrowDataGrid.Columns[9].HeaderText  = "状态";
            borrowDataGrid.Columns[10].HeaderText = "备注";
            borrowDataGrid.Columns[11].HeaderText = "操作人";


            borrowDataGrid.Columns[1].Width  = 50;
            borrowDataGrid.Columns[2].Width  = Fuctions.dataGridViewPhoneName;
            borrowDataGrid.Columns[3].Width  = 80;
            borrowDataGrid.Columns[4].Width  = Fuctions.dataGridViewPhoneNum;;
            borrowDataGrid.Columns[5].Width  = 120;
            borrowDataGrid.Columns[6].Width  = 120;
            borrowDataGrid.Columns[8].Width  = Fuctions.dataGridViewTest;
            borrowDataGrid.Columns[9].Width  = 50;
            borrowDataGrid.Columns[10].Width = Fuctions.dataGridViewNote;
            borrowDataGrid.Columns[11].Width = 50;

            Fuctions.AutoSize(borrowDataGrid);


            //借机相关内容加载**********************************************************
            strSql = "select distinct PhoneName from PmPhone where PhoneStatus = '在库' and PhoneDisplay = 'TRUE'"; //样机名称combobox内容加载
            MySqlCommand cmd = new MySqlCommand(strSql, conn);

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataSet          ds = new DataSet();

            conn.Open();
            da.Fill(ds, "PmPhone");
            conn.Close();
            cbbPhoneName.DisplayMember = "PhoneName";
            cbbPhoneName.ValueMember   = "PhoneName";
            cbbPhoneName.DataSource    = ds.Tables["PmPhone"];
            cbbPhoneName.Text          = "";
        }