private void UpdataHomeUnit() { string str = "select distinct cm_homeunit from CarManage where cm_szqy = '" + ConnectionManger.G_MineArea + "' "; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { listHomeUnit.Add(dt.Rows[i]["cm_homeunit"].ToString()); } cmbHomeUnit.Items.AddRange(listHomeUnit.ToArray()); dt.Dispose(); }
//private void UpdataCarType() //{ // string str = "select distinct cm_cx from CarManage where cm_szqy = '" + ConnectionManger.G_MineArea + "'"; // DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; // for (int i = 0; i < dt.Rows.Count; i++) // { // listCarType.Add(dt.Rows[i]["cm_cx"].ToString()); // } // dt.Dispose(); //} private void UpdataContractNo() { string str = "select distinct cn_code from ContractNews where cn_area = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { listContractNo.Add(dt.Rows[i]["cn_code"].ToString()); } cmbContractNo.Items.AddRange(listContractNo.ToArray()); dt.Dispose(); }
private void UpdataReciveUnit() { string str = "select distinct ru_shdw from CZJL where cz_szq = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; listReciveUnit.Clear(); cmbReciveUnit.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { listReciveUnit.Add(dt.Rows[i]["ru_shdw"].ToString()); } cmbReciveUnit.Items.AddRange(listReciveUnit.ToArray()); dt.Dispose(); }
private void UpdataCarType() { string str = "select distinct cm_cx from CarManage where cm_szqy = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; listCarType.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { listCarType.Add(dt.Rows[i]["cm_cx"].ToString()); } //cmbCarType.Items.Clear(); //cmbCarType.Items.AddRange(listCarType.ToArray()); dt.Dispose(); }
private void UpdateSupplyUnit() { string str = "select su_unit from SupplyUnit where su_area = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; listSupplyUnit.Clear(); cmbSupplyUnit.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { listSupplyUnit.Add(dt.Rows[i]["su_unit"].ToString()); } cmbSupplyUnit.Items.AddRange(listSupplyUnit.ToArray()); dt.Dispose(); }
private void UpdateGoodsName() { string str = "select gn_name from GoodsName where gn_area = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; listGoodsName.Clear(); cmbGoodsName.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { listGoodsName.Add(dt.Rows[i]["gn_name"].ToString()); } cmbGoodsName.Items.AddRange(listGoodsName.ToArray()); dt.Dispose(); }
//public void readxml() //{ // XmlDocument xmlDoc = new XmlDocument(); // xmlDoc.Load("han.xml"); // XmlNodeList nodeList = xmlDoc.SelectSingleNode("han").ChildNodes;//获取bookstore节点的所有子节点 // foreach (XmlNode xn in nodeList)//遍历根节点的所有子节点 // { // XmlElement xe = (XmlElement)xn;//将子节点类型转换为XmlElement类型 // //if (xe.GetAttribute("lun") == "video1") // //{ // // strvideo1 = xe.InnerText.Trim(); //给视频赋值IP // //} // //if (xe.GetAttribute("lun") == "video2") // //{ // // strvideo2 = xe.InnerText.Trim(); // //} // //if (xe.GetAttribute("lun") == "video3") // //{ // // strvideo3 = xe.InnerText.Trim(); // //} // //if (xe.GetAttribute("lun") == "video4") // //{ // // strvideo4 = xe.InnerText.Trim(); // //} // if (xe.GetAttribute("lun") == "qu") // { // ConnectionManger.G_MineArea = xe.InnerText.Trim(); // } // //if (xe.GetAttribute("lun") == "Com") // //{ // // Com = xe.InnerText.Trim(); // //} // //if (xe.GetAttribute("lun") == "Com") // //{ // // Com = xe.InnerText.Trim(); // //} // } //} private void FrmNew_Load(object sender, EventArgs e) { //readxml(); ConnectionManger.readxml(); string str = "select * from user_table where user_area = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { CmbName.Items.Add(dt.Rows[i]["user_name"].ToString()); } dt.Dispose(); if (CmbName.Items.Count > 0) { CmbName.SelectedIndex = 0; } TxtMima.Focus(); TxtMima.Select(); }
private void Button1_Click(object sender, EventArgs e) { string mimastr = ""; string str; if (TxtNewMima1.Text != TxtNewMima2.Text) { MessageBox.Show("新密码输入不一致!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtNewMima1.Text = ""; TxtNewMima2.Text = ""; return; } str = "select * from user_table where user_area = '" + ConnectionManger.G_MineArea + "' and user_name = '" + ConnectionManger.UserName + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; if (dt.Rows.Count > 0) { mimastr = dt.Rows[0]["user_pwd"].ToString(); } dt.Dispose(); if (TxtOldMima.Text != mimastr) { MessageBox.Show("密码输入不正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtOldMima.Text = ""; TxtNewMima1.Text = ""; TxtNewMima2.Text = ""; return; } try { str = "update user_table set user_pwd = '" + TxtNewMima1.Text + "' where user_area = '" + ConnectionManger.G_MineArea + "' and user_name = '" + ConnectionManger.UserName + "'"; SQLHelper.ExecuteNonQuery(CommandType.Text, str, null); MessageBox.Show("密码修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch { MessageBox.Show("密码修改失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Frm_SystemSet_Load(object sender, EventArgs e) { DataTable dt = SQLHelper.GetDataSet("select * from print_table where p_area='" + ConnectionManger.G_MineArea + "'", CommandType.Text).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < 8; i++) { string p = dt.Rows[0][i + 2].ToString(); if (p == "1") { checkedListBox1.SetItemCheckState(i, CheckState.Checked); } else { checkedListBox1.SetItemCheckState(i, CheckState.Unchecked); } } } }
private void cmbContractNo_SelectedIndexChanged(object sender, EventArgs e) { string str = "select ru_unit,cn_hwmc,cn_htzl,cn_yysl,(cn_htzl-cn_yysl) as syl from ContractNews where cn_code = '" + cmbContractNo.Text + "' and cn_area = '" + ConnectionManger.G_MineArea + "'"; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; if (dt.Rows.Count > 0) { txtGoodsName.Text = dt.Rows[0]["cn_hwmc"].ToString(); txtSumWeight.Text = dt.Rows[0]["cn_htzl"].ToString(); txtWeight.Text = dt.Rows[0]["cn_yysl"].ToString(); txtSYWeight.Text = dt.Rows[0]["syl"].ToString(); cmbHomeUnit.Text = dt.Rows[0]["ru_unit"].ToString(); } else { txtGoodsName.Text = ""; txtSumWeight.Text = ""; txtWeight.Text = ""; } }
private void UpdateDataGrid(string where) { DGVTruck.AutoGenerateColumns = false; string str = "select cm_kcode,cm_carnumber,cm_jsy,cn_code,cm_bzweight,cm_homeunit,(case (select top 1 wcbj from Flow fw where fw.fw_kh=cm.cm_kcode and fw.fw_area=cm.cm_szqy order by inserttime desc) when '完成' then '完成' else '未完成' end ) as wc,(select top 1 fw_flow from Flow fw where fw.fw_kh=cm.cm_kcode and fw.fw_area=cm.cm_szqy order by inserttime desc) as flow,cm_id from CarManage cm where cm_szqy = '" + ConnectionManger.G_MineArea + "'" + where; DGVTruck.DataSource = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; if (DGVTruck.RowCount == 0) { return; } int carcount = 0; for (int i = 0; i < DGVTruck.RowCount; i++) { if (DGVTruck.Rows[i].Cells[7].Value.ToString() == "未完成") { carcount += 1; } } label6.Text = "场内当前车辆为:" + carcount.ToString(); }
private void UpdateImage(string bdh, int flag) { string str = "select p_photo from CZPhoto where p_bdh = '" + bdh + "' order by p_id "; DataTable dt = SQLHelper.GetDataSet(str, CommandType.Text).Tables[0]; if (flag == 0) { if (dt.Rows.Count >= 4) { byte[] imgbyte1 = (byte[])(dt.Rows[0]["p_photo"]); MemoryStream ms = new MemoryStream(imgbyte1); Image img = Image.FromStream(ms); pic1.Image = img; byte[] imgbyte2 = (byte[])(dt.Rows[1]["p_photo"]); ms = new MemoryStream(imgbyte2); img = new Bitmap(ms); pic2.Image = img; byte[] imgbyte3 = (byte[])(dt.Rows[2]["p_photo"]); ms = new MemoryStream(imgbyte3); img = new Bitmap(ms); pic3.Image = img; byte[] imgbyte4 = (byte[])(dt.Rows[3]["p_photo"]); ms = new MemoryStream(imgbyte4); img = new Bitmap(ms); pic4.Image = img; } else { pic1.Image = null; pic2.Image = null; pic3.Image = null; pic4.Image = null; } } if (flag == 1) { if (dt.Rows.Count >= 8) { byte[] imgbyte1 = (byte[])(dt.Rows[4]["p_photo"]); MemoryStream ms = new MemoryStream(imgbyte1); Image img = Image.FromStream(ms); pic1.Image = img; byte[] imgbyte2 = (byte[])(dt.Rows[5]["p_photo"]); ms = new MemoryStream(imgbyte2); img = new Bitmap(ms); pic2.Image = img; byte[] imgbyte3 = (byte[])(dt.Rows[6]["p_photo"]); ms = new MemoryStream(imgbyte3); img = new Bitmap(ms); pic3.Image = img; byte[] imgbyte4 = (byte[])(dt.Rows[7]["p_photo"]); ms = new MemoryStream(imgbyte4); img = new Bitmap(ms); pic4.Image = img; } else { pic1.Image = null; pic2.Image = null; pic3.Image = null; pic4.Image = null; } } dt.Dispose(); }