⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateinfo.cs

📁 网上购物中介
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label4.Text = " 提供商:";
			// 
			// textBox2
			// 
			this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBox2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
			this.textBox2.Location = new System.Drawing.Point(112, 24);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(304, 21);
			this.textBox2.TabIndex = 25;
			this.textBox2.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(32, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 16);
			this.label3.TabIndex = 24;
			this.label3.Text = "名称:";
			// 
			// comboBox1
			// 
			this.comboBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.comboBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
			this.comboBox1.Location = new System.Drawing.Point(88, 64);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(104, 20);
			this.comboBox1.TabIndex = 23;
			this.comboBox1.Text = "====请选择====";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(32, 64);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 16);
			this.label2.TabIndex = 22;
			this.label2.Text = "类别:";
			// 
			// button6
			// 
			this.button6.Location = new System.Drawing.Point(432, 16);
			this.button6.Name = "button6";
			this.button6.Size = new System.Drawing.Size(88, 24);
			this.button6.TabIndex = 40;
			this.button6.Text = "查询商品信息";
			this.button6.Click += new System.EventHandler(this.button6_Click);
			// 
			// button4
			// 
			this.button4.Location = new System.Drawing.Point(376, 320);
			this.button4.Name = "button4";
			this.button4.Size = new System.Drawing.Size(80, 24);
			this.button4.TabIndex = 43;
			this.button4.Text = " 退出";
			this.button4.Click += new System.EventHandler(this.button4_Click_1);
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(224, 320);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(80, 24);
			this.button3.TabIndex = 42;
			this.button3.Text = " 取消";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(72, 320);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(80, 24);
			this.button2.TabIndex = 41;
			this.button2.Text = "修改";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// dataGrid1
			// 
			this.dataGrid1.AlternatingBackColor = System.Drawing.Color.WhiteSmoke;
			this.dataGrid1.BackColor = System.Drawing.Color.Gainsboro;
			this.dataGrid1.BackgroundColor = System.Drawing.Color.DarkGray;
			this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.dataGrid1.CaptionBackColor = System.Drawing.Color.DarkKhaki;
			this.dataGrid1.CaptionFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dataGrid1.CaptionForeColor = System.Drawing.Color.Black;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.dataGrid1.FlatMode = true;
			this.dataGrid1.Font = new System.Drawing.Font("Times New Roman", 9F);
			this.dataGrid1.ForeColor = System.Drawing.Color.Black;
			this.dataGrid1.GridLineColor = System.Drawing.Color.Silver;
			this.dataGrid1.HeaderBackColor = System.Drawing.Color.Black;
			this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dataGrid1.HeaderForeColor = System.Drawing.Color.White;
			this.dataGrid1.LinkColor = System.Drawing.Color.DarkSlateBlue;
			this.dataGrid1.Location = new System.Drawing.Point(0, 381);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.LightGray;
			this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
			this.dataGrid1.SelectionBackColor = System.Drawing.Color.Firebrick;
			this.dataGrid1.SelectionForeColor = System.Drawing.Color.White;
			this.dataGrid1.Size = new System.Drawing.Size(528, 96);
			this.dataGrid1.TabIndex = 44;
			// 
			// comboBox3
			// 
			this.comboBox3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.comboBox3.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
			this.comboBox3.Items.AddRange(new object[] {
														   "展出商品",
														   "出售商品"});
			this.comboBox3.Location = new System.Drawing.Point(224, 16);
			this.comboBox3.Name = "comboBox3";
			this.comboBox3.Size = new System.Drawing.Size(96, 20);
			this.comboBox3.TabIndex = 45;
			this.comboBox3.Text = "请选择表";
			this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
			// 
			// UpdateInfo
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(528, 477);
			this.Controls.Add(this.comboBox3);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.button4);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.button5);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button6);
			this.Name = "UpdateInfo";
			this.Text = "添加商品信息";
			this.Load += new System.EventHandler(this.UpdateInfo_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			this.Dispose();
		}

		private void button5_Click(object sender, System.EventArgs e)
		{
		    id=this.textBox1.Text.Trim();
			int i=0;
			if(id.Equals(""))
			{
				MessageBox.Show("请填写查询值!");
				this.textBox1.Focus();
				return;
			}
			table=this.comboBox3.Text.Trim();
			if(table.Equals("请选择表"))
			{
				MessageBox.Show("请选择表!");
				this.comboBox3.Focus();
				return;
			}
            System.Data.OleDb.OleDbConnection con=_3DLib.DataBaseCon.GetCon();
			OleDbCommand cmd=new OleDbCommand();
			cmd.Connection=con;
			cmd.CommandText="select * from "+table+" where ID='"+id+"'";
			OleDbDataReader odr;
			con.Open();
			odr=cmd.ExecuteReader();
			while(odr.Read())
			{
				textBox2.Text=odr.GetString(2);
				comboBox1.Text=odr.GetString(1);
				if(table.Equals("展出商品"))
				{
					comboBox2.Text=odr.GetString(3);
					textBox3.Text=odr.GetString(4);
					textBox4.Text=odr.GetString(5);
					textBox5.Text=odr.GetString(6);
					textBox6.Text=odr.GetString(7);
				    //textBox7.Text=odr.GetString(8);
				}
				else
				{
                    textBox3.Text=odr.GetString(3);
					textBox4.Text=odr.GetString(4);
					textBox5.Text=odr.GetString(5);
					textBox6.Text=odr.GetString(6);
					textBox7.Text=odr.GetString(7);
				}
				i++;
			}
			if(i==0)
			{
				MessageBox.Show("表中没有这项纪录!");
				comboBox3.Focus();
			}
			con.Close();
			this.dataGrid1.DataSource=_3DLib.SelectAll.getOneInfo(table,id,"ID");
		}

		private void groupBox1_Enter(object sender, System.EventArgs e)
		{
		
		}

		private void comboBox2_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void UpdateInfo_Load(object sender, System.EventArgs e)
		{
			object[] my=_3DLib.InitComcoBox.getItem("提供商");
			this.comboBox2.Items.AddRange(my);
			object[] my1=_3DLib.InitComcoBox.getItem("类别");
			this.comboBox1.Items.AddRange(my1);
		}

		private void button6_Click(object sender, System.EventArgs e)
		{
			AllInfo ai=new AllInfo();
			ai.Show();
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			string name=textBox2.Text.Trim();
			string type=comboBox1.Text.Trim();
			string tgs=comboBox2.Text.Trim();
			string scj=textBox3.Text.Trim();
			string xj=textBox4.Text.Trim();
			string total=textBox5.Text.Trim();
			string tupian=textBox6.Text.Trim();
			string note=textBox7.Text.Trim();
//			if(name.Equals("")||type.Equals("====请选择====")||tgs.Equals("====请选择===="))
//			{
//				MessageBox.Show("请检查您的信息是否正确!");
//				return;
//			}
			string rs1=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),name,"名称",textBox1.Text.Trim());
			string rs2=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),type,"类别",textBox1.Text.Trim());
			string rs3="ok";
			if(!tgs.Equals(""))
			{
				rs3=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),tgs,"提供商",textBox1.Text.Trim());
			}
			string rs4=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),scj,"市场价",textBox1.Text.Trim());
			string rs5=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),xj,"现价",textBox1.Text.Trim());
			string rs6=null;
			if(this.comboBox3.Text.Equals("出售商品"))
			{
				rs6=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),total,"数量",textBox1.Text.Trim());
			}
			else{rs6="OK";}
			string rs7=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),tupian,"图片",textBox1.Text.Trim());
			string rs8=_3DLib.UpdateInfo.updateOneInfo(comboBox3.Text.Trim(),note,"备注",textBox1.Text.Trim());
			if(rs1.Equals("OK")&&rs2.Equals("OK")&&rs3.Equals("OK")&&rs4.Equals("OK")&&rs5.Equals("OK")&&rs6.Equals("OK")&&rs7.Equals("OK")&&rs8.Equals("OK"))
			{
				MessageBox.Show("修改成功!"+rs6);
				string time=GetTime.getCurrent();
				log.Class1.operateLog(relogin.uid,time,"修改了"+id);
			}
			else MessageBox.Show("修改失败!请检查您的修改值"+rs7);
			this.dataGrid1.DataSource=_3DLib.SelectAll.getOneInfo(table,id,"ID");
		    this.dataGrid1.Refresh();
		}

		private void comboBox3_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(this.comboBox3.Text.Equals("展出商品"))
				this.textBox5.Enabled=false;
		}

		private void button4_Click_1(object sender, System.EventArgs e)
		{
			this.Dispose();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -