private void StaffQueryForm_Load(object sender, EventArgs e) //加载窗体时显示所有员工 { this.Width = Fuctions.winFormWidth; this.Height = Fuctions.winFormHeight; StaffBLL staffbll = new StaffBLL(); staffs = staffbll.getAllStaff(); staffDataGrid.DataSource = staffs; staffDataGrid.ReadOnly = true; staffDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; staffDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; staffDataGrid.Width = Fuctions.dataGridViewWidth; staffDataGrid.Height = Fuctions.dataGridViewHeight; staffDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY); staffDataGrid.Columns[0].HeaderText = "主键"; //修改显示的列名 staffDataGrid.Columns[0].Visible = false; staffDataGrid.Columns[1].HeaderText = "员工"; staffDataGrid.Columns[2].HeaderText = "性别"; staffDataGrid.Columns[3].HeaderText = "权限"; staffDataGrid.Columns[3].Visible = false; staffDataGrid.Columns[4].HeaderText = "密码"; staffDataGrid.Columns[4].Visible = false; staffDataGrid.Columns[5].HeaderText = "编号"; Fuctions.AutoSize(staffDataGrid); }
private void SetChild() { if (m_dOldNumberCount < m_dNowNumberCount) { for (int i = m_dOldNumberCount; i < m_dNowNumberCount; i++) { GameObject tmpObject = ResourceLoad.GetEzGuiTexture(m_scriptNumberSetManager.GetObjectNumber()); tmpObject.name = string.Format("{0}{1}", "NumberChild_", m_listChild.Count); tmpObject.GetComponent <EzGui_Texture>().SetColor(m_Color); tmpObject.transform.parent = gameObject.transform; tmpObject.GetComponent <EzGui_Texture>().SetValid(Valid); m_listChild.Add(tmpObject); if (m_IsCommaOn) { if (i % 3 == 0 && i != 0) { GameObject tmpObject1 = ResourceLoad.GetEzGuiTexture(m_scriptNumberSetManager.GetObjectNumber()); tmpObject1.name = string.Format("{0}{1}", "NumberChild_", m_listChild.Count); tmpObject1.GetComponent <EzGui_Texture>().SetColor(m_Color); tmpObject1.transform.parent = gameObject.transform; tmpObject1.GetComponent <EzGui_Texture>().SetValid(Valid); m_listChild.Add(tmpObject1); } } } } SetChildPos(); List <int> tmpNumList = new List <int>(); Fuctions.SetNumberList(m_NowNumber, ref tmpNumList); int ListCount = m_listChild.Count; for (int i = 0, count = 0; count < ListCount; i++, count++) { if (m_IsCommaOn) { if (m_dNowNumberCount >= 4) { if ((m_dNowNumberCount - i) % 3 == 0 && i != 0) { m_listChild[count].GetComponent <EzGui_Texture>().GetEZGUITexture().SetUVs(m_scriptNumberSetManager.GetNumberUV(10)); count++; } } } m_listChild[count].GetComponent <EzGui_Texture>().SetcontrolIsEnabled(false); m_listChild[count].GetComponent <EzGui_Texture>().GetEZGUITexture().SetUVs(m_scriptNumberSetManager.GetNumberUV(tmpNumList[i])); } }
private void StaffInfoForm_Load(object sender, EventArgs e) { this.Width = Fuctions.winFormWidth; this.Height = Fuctions.winFormHeight; StaffBLL staffbll = new StaffBLL(); staffs = staffbll.getAllStaff(); staffDataGrid.DataSource = staffs; //将数据库中的数据提到列表中,再通过 DataGrid控件显示; staffDataGrid.ReadOnly = true; staffDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; staffDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; staffDataGrid.Width = Fuctions.dataGridViewWidth; staffDataGrid.Height = Fuctions.dataGridViewHeight; staffDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY); staffDataGrid.Columns[0].HeaderText = "主键"; //修改显示的列名 staffDataGrid.Columns[0].Visible = false; staffDataGrid.Columns[1].HeaderText = "员工"; staffDataGrid.Columns[2].HeaderText = "性别"; staffDataGrid.Columns[3].HeaderText = "权限"; staffDataGrid.Columns[4].HeaderText = "密码"; staffDataGrid.Columns[4].Visible = false; staffDataGrid.Columns[5].HeaderText = "编号"; Fuctions.AutoSize(staffDataGrid); DataTable dt = new DataTable(); //表中cbb权限内容加载 DataColumn dc1 = new DataColumn("id"); DataColumn dc2 = new DataColumn("name"); dt.Columns.Add(dc1); dt.Columns.Add(dc2); DataRow dr1 = dt.NewRow(); dr1["id"] = "1"; dr1["name"] = "管理员"; DataRow dr2 = dt.NewRow(); dr2["id"] = "2"; dr2["name"] = "员工"; dt.Rows.Add(dr1); dt.Rows.Add(dr2); cbbStaffDept.DisplayMember = "name"; cbbStaffDept.ValueMember = "id"; cbbStaffDept.DataSource = dt; cbbStaffDept.Text = ""; }
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 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); }
private void PhoneInfoForm_Load(object sender, EventArgs e) { cbbPhoneDisplay.DropDownStyle = ComboBoxStyle.DropDownList; cbbPhoneNameD.DropDownStyle = ComboBoxStyle.DropDownList; cbbPhoneStageD.DropDownStyle = ComboBoxStyle.DropDownList; cbbPhoneOwner.DropDownStyle = ComboBoxStyle.DropDown; cbbPhoneStage.DropDownStyle = ComboBoxStyle.DropDown; this.Width = Fuctions.winFormWidth; this.Height = Fuctions.winFormHeight; PhoneBLL phonebll = new PhoneBLL(); phones = phonebll.getAllPhones(); PhoneDataGrid.DataSource = phones; //将数据库中的数据提到列表中,再通过 DataGrid控件显示; PhoneDataGrid.ReadOnly = true; PhoneDataGrid.Width = Fuctions.dataGridViewWidth; //PhoneDataGrid.Height = 300; PhoneDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY); PhoneDataGrid.Columns[0].HeaderText = "主键"; //修改显示的列名 PhoneDataGrid.Columns[0].Visible = false; PhoneDataGrid.Columns[1].HeaderText = "Phone ID"; PhoneDataGrid.Columns[2].HeaderText = "名称"; PhoneDataGrid.Columns[3].HeaderText = "阶段"; PhoneDataGrid.Columns[4].HeaderText = "编号"; PhoneDataGrid.Columns[5].HeaderText = "状态"; PhoneDataGrid.Columns[6].HeaderText = "备注"; PhoneDataGrid.Columns[7].HeaderText = "接口人"; PhoneDataGrid.Columns[8].HeaderText = "显示"; PhoneDataGrid.Columns[8].Visible = false; PhoneDataGrid.Columns[9].HeaderText = "主管"; PhoneDataGrid.Columns[10].HeaderText = "启用时间"; PhoneDataGrid.Columns[1].Width = 80; PhoneDataGrid.Columns[2].Width = Fuctions.dataGridViewPhoneName; PhoneDataGrid.Columns[3].Width = 80; PhoneDataGrid.Columns[4].Width = Fuctions.dataGridViewPhoneNum;; PhoneDataGrid.Columns[5].Width = 50; PhoneDataGrid.Columns[6].Width = Fuctions.dataGridViewNote; PhoneDataGrid.Columns[7].Width = 50; PhoneDataGrid.Columns[8].Width = 50; PhoneDataGrid.Columns[9].Width = 50; PhoneDataGrid.Columns[10].Width = 120; Fuctions.AutoSize(PhoneDataGrid); //StageBLL stagebll = new StageBLL(); //从数据库中读出状态信息,显示于CBB中。 //stages = stagebll.getAllStages(); //cbbPhoneStage.DataSource = stages; //cbbPhoneStage.DisplayMember = "StageName"; //cbbPhoneStage.ValueMember = "StageName"; //cbbPhoneStage.SelectedIndex = -1; //cbbPhoneStage.Text = ""; //***********************************************样机是否显示 cbb内容更新 string strSql = "select distinct PhoneName from PmPhone order by PhoneName asc"; //样机名称cbbD内容加载 MySqlCommand cmd = new MySqlCommand(strSql, conn); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataSet ds = new DataSet(); conn.Open(); da.Fill(ds, "PmPhone"); conn.Close(); cbbPhoneNameD.DisplayMember = "PhoneName"; cbbPhoneNameD.ValueMember = "PhoneName"; cbbPhoneNameD.DataSource = ds.Tables["PmPhone"]; cbbPhoneNameD.SelectedIndex = -1; //cbbPhoneNameD.Text = ""; }
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 = "正常"; }
/* *需求:通过按键实现样机 借还一起,主要是为了记录做过的实验,及实验后的状态 *思路:先借 后还 */ 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 = "正常"; }
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; } } //MySqlConnection conn = new MySqlConnection(GetConn.connection); //连接对象 BorrowBLL borrowbll = new BorrowBLL(); PhoneBLL phonebll = new PhoneBLL(); // 若是第一行的五个中有一个为空,则给出提示 if (cbbStaffName1.Text == "" || 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(cbbStaffName1.Text, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum1.Text, cbbHGroupTest1.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(cbbStaffName1.Text, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum2.Text, cbbHGroupTest1.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(cbbStaffName1.Text, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum3.Text, cbbHGroupTest1.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(cbbStaffName1.Text, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum4.Text, cbbHGroupTest1.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(cbbStaffName1.Text, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum5.Text, cbbHGroupTest1.Text, cbbIsNormal5.Text, txtRemark5.Text) && phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum5.Text)) { //MessageBox.Show("样机归还成功", "提示"); } else { MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示"); } } } borrows = borrowbll.GetAllBorrow(); borrowDataGrid.DataSource = borrows; //**********************************************************借机相关内容更新 string 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 StaffName from PmBorrow"; //--还员工姓名combobox内容更新 strSql = "select distinct StaffName from PmBorrow where IsReturn='false' order by convert(StaffName USING gbk) asc"; cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmBorrow"); conn.Close(); cbbStaffName1.DisplayMember = "StaffName"; cbbStaffName1.ValueMember = "StaffName"; cbbStaffName1.DataSource = ds.Tables["PmBorrow"]; cbbStaffName1.Text = ""; //cbbHGroupName1.Text = ""; //--其余的清空 //cbbHGroupTest1.Text = ""; cbbIsNormal1.Text = ""; txtRemark1.Text = ""; cbbIsNormal2.Text = ""; txtRemark2.Text = ""; cbbIsNormal3.Text = ""; txtRemark3.Text = ""; cbbIsNormal4.Text = ""; txtRemark4.Text = ""; cbbIsNormal5.Text = ""; txtRemark5.Text = ""; }
private void BorrowInfoForm_Load(object sender, EventArgs e) //加载窗体时执行操作 { this.Width = Fuctions.winFormWidth; this.Height = Fuctions.winFormHeight; BorrowBLL borrowbll = new BorrowBLL(); //DataGrid 内容加载 borrows = borrowbll.GetAllBorrow(); borrowDataGrid.DataSource = borrows; borrowDataGrid.ReadOnly = true; 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); //**********************************************************借机相关内容加载 StaffBLL staffbll = new StaffBLL(); //员工姓名combobox内容加载 staffs = staffbll.getAllStaff(); cbbStaffName.DisplayMember = "StaffName"; cbbStaffName.ValueMember = "StaffName"; cbbStaffName.DataSource = staffs; cbbStaffName.Text = ""; string 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 StaffName from PmBorrow where IsReturn='false' order by convert(StaffName USING gbk) asc"; //还员工姓名combobox内容加载--cbbPhoneName1--cbbPhoneStage1--cbbPhoneNum1 cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmBorrow"); conn.Close(); cbbStaffName1.DisplayMember = "StaffName"; cbbStaffName1.ValueMember = "StaffName"; cbbStaffName1.DataSource = ds.Tables["PmBorrow"]; cbbStaffName1.Text = ""; strSql = "select distinct HGroupName from PmGroup"; //还员工小组名combobox内容加载--cbbHGroupTest cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmGroup"); conn.Close(); cbbHGroupName1.DisplayMember = "HGroupName"; cbbHGroupName1.ValueMember = "HGroupName"; cbbHGroupName1.DataSource = ds.Tables["PmGroup"]; cbbHGroupName1.Text = ""; DataTable dt = new DataTable(); //还样机状态IsNormal内容加载 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); cbbIsNormal1.DisplayMember = "text"; cbbIsNormal1.ValueMember = "value"; cbbIsNormal1.DataSource = dt; 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 = ""; }
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; } } //MySqlConnection conn = new MySqlConnection(GetConn.connection); //连接对象 BorrowBLL borrowbll = new BorrowBLL(); PhoneBLL phonebll = new PhoneBLL(); if (cbbStaffName.Text == "" || 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(this.cbbStaffName.Text, 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(this.cbbStaffName.Text, 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(this.cbbStaffName.Text, 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(this.cbbStaffName.Text, 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(this.cbbStaffName.Text, 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("借阅成功"); } borrows = borrowbll.GetAllBorrow(); //DataGridView显示所借样机 borrowDataGrid.DataSource = borrows; //**************************************************借样机相关内容更新 string 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 StaffName from PmStaff"; //还员工姓名combobox内容加载--cbbPhoneName1--cbbPhoneStage1--cbbPhoneNum1 strSql = "select distinct StaffName from PmBorrow where IsReturn='false' order by convert(StaffName USING gbk) asc"; cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmStaff"); conn.Close(); cbbStaffName1.DisplayMember = "StaffName"; cbbStaffName1.ValueMember = "StaffName"; cbbStaffName1.DataSource = ds.Tables["PmStaff"]; cbbStaffName1.Text = ""; }
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 = ""; }
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 btnReturn_Click(object sender, EventArgs e) //还样机按钮 { string ip = Fuctions.GetIpAddress(); if (LoginForm.admin == 0) { if (ip != IPADRESS) { MessageBox.Show("请去指定电脑进行样机借阅"); return; } } BorrowBLL borrowbll = new BorrowBLL(); PhoneBLL phonebll = new PhoneBLL(); if (cbbPhoneName1.Text == "" || cbbPhoneStage1.Text == "" || cbbPhoneNum1.Text == "" || cbbHGroupName1.Text == "" || cbbHGroupTest1.Text == "" || cbbIsNormal1.Text == "") { MessageBox.Show("请输入除备注以外的所有信息", "提示"); return; } else if (cbbIsNormal1.Text == "故障" && txtRemark.Text == "") { MessageBox.Show("样机故障,请输入故障信息", "提示"); return; } else { if (borrowbll.returnPhone(LoginForm.usrName, cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum1.Text, cbbHGroupTest1.Text, cbbIsNormal1.Text, txtRemark.Text)) { MessageBox.Show("样机归还成功", "提示"); } if (phonebll.updatePhoneStatusIn(cbbPhoneName1.Text, cbbPhoneStage1.Text, cbbPhoneNum1.Text)) { MessageBox.Show("样机状态更新成功", "提示"); } else { MessageBox.Show("样机状态未成功更新,请检查信息是否输入正确", "提示"); } } borrows = borrowbll.GetAllBorrow(); borrowDataGrid.DataSource = borrows; //借机相关内容更新********************************************************** string 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 = ""; cbbIsNormal1.Text = ""; txtRemark.Text = ""; }
private void BorrowQueryForm_Load(object sender, EventArgs e) { this.Width = Fuctions.winFormWidth; this.Height = Fuctions.winFormHeight; BorrowBLL borrowbll = new BorrowBLL(); borrows = borrowbll.GetNoneBorrow(); borrowQDataGrid.DataSource = borrows; borrowQDataGrid.ReadOnly = true; borrowQDataGrid.Width = Fuctions.dataGridViewWidth; borrowQDataGrid.Height = Fuctions.dataGridViewHeight; borrowQDataGrid.Location = new Point(Fuctions.dataGridViewLocationX, Fuctions.dataGridViewLocationY); borrowQDataGrid.Columns[0].HeaderText = "主键"; //修改显示的列名 borrowQDataGrid.Columns[0].Visible = false; borrowQDataGrid.Columns[1].HeaderText = "员工"; borrowQDataGrid.Columns[2].HeaderText = "名称"; borrowQDataGrid.Columns[3].HeaderText = "阶段"; borrowQDataGrid.Columns[4].HeaderText = "编号"; borrowQDataGrid.Columns[5].HeaderText = "借用日期"; borrowQDataGrid.Columns[6].HeaderText = "归还日期"; borrowQDataGrid.Columns[7].HeaderText = "是否归还"; borrowQDataGrid.Columns[7].Visible = false; borrowQDataGrid.Columns[8].HeaderText = "试验项目"; borrowQDataGrid.Columns[9].HeaderText = "状态"; borrowQDataGrid.Columns[10].HeaderText = "备注"; borrowQDataGrid.Columns[11].HeaderText = "操作人"; borrowQDataGrid.Columns[1].Width = 50; borrowQDataGrid.Columns[2].Width = Fuctions.dataGridViewPhoneName; borrowQDataGrid.Columns[3].Width = 90; borrowQDataGrid.Columns[4].Width = Fuctions.dataGridViewPhoneNum; borrowQDataGrid.Columns[5].Width = 120; borrowQDataGrid.Columns[6].Width = 120; borrowQDataGrid.Columns[8].Width = 120; borrowQDataGrid.Columns[9].Width = 50; borrowQDataGrid.Columns[10].Width = Fuctions.dataGridViewNote; borrowQDataGrid.Columns[11].Width = 50; Fuctions.AutoSize(borrowQDataGrid); //**********************************************************还机相关内容更新 string strSql = "select distinct StaffName from PmBorrow"; //--还员工姓名combobox内容更新 MySqlCommand cmd = new MySqlCommand(strSql, conn); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataSet ds = new DataSet(); conn.Open(); da.Fill(ds, "PmBorrow"); conn.Close(); cbbStaffName.DisplayMember = "StaffName"; cbbStaffName.ValueMember = "StaffName"; cbbStaffName.DataSource = ds.Tables["PmBorrow"]; cbbStaffName.Text = ""; //只显示让显示的 strSql = "SELECT DISTINCT pmborrow.PhoneName FROM pmborrow,pmphone WHERE pmborrow.PhoneName = pmphone.PhoneName AND pmphone.PhoneDisplay = 'TRUE' "; //还样机名称combobox内容加载 cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmBorrow"); conn.Close(); cbbPhoneName.DisplayMember = "PhoneName"; cbbPhoneName.ValueMember = "PhoneName"; cbbPhoneName.DataSource = ds.Tables["PmBorrow"]; cbbPhoneName.Text = ""; strSql = "select distinct HGroupName from PmGroup"; //还员工小组名combobox内容加载 cmd = new MySqlCommand(strSql, conn); da = new MySqlDataAdapter(cmd); ds = new DataSet(); conn.Open(); da.Fill(ds, "PmGroup"); conn.Close(); cbbHGroupName.DisplayMember = "HGroupName"; cbbHGroupName.ValueMember = "HGroupName"; cbbHGroupName.DataSource = ds.Tables["PmGroup"]; cbbHGroupName.Text = ""; DataTable dt = new DataTable(); //还样机状态IsNormal内容加载 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); cbbIsNormal.DisplayMember = "text"; cbbIsNormal.ValueMember = "value"; cbbIsNormal.DataSource = dt; cbbIsNormal.Text = ""; }
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 = ""; }