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

📄 wupinkongzhi.h

📁 采用VC++.net做的超市收银管理系统
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->oleDbDataAdapter1->TableMappings->AddRange(__mcTemp__1);
			this->oleDbDataAdapter1->UpdateCommand = this->oleDbUpdateCommand1;
			// 
			// oleDbDeleteCommand1
			// 
			this->oleDbDeleteCommand1->CommandText = S"DELETE FROM 物品表 WHERE (WID = \?)";
			this->oleDbDeleteCommand1->Connection = this->oleDbConnection1;
			this->oleDbDeleteCommand1->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"Original_WID", System::Data::OleDb::OleDbType::VarChar, 10, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"WID", System::Data::DataRowVersion::Original, 0));
			// 
			// button4
			// 
			this->button4->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->button4->Location = System::Drawing::Point(504, 72);
			this->button4->Name = S"button4";
			this->button4->Size = System::Drawing::Size(64, 32);
			this->button4->TabIndex = 60;
			this->button4->Text = S"重置";
			this->button4->Click += new System::EventHandler(this, button4_Click);
			// 
			// button3
			// 
			this->button3->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->button3->Location = System::Drawing::Point(504, 112);
			this->button3->Name = S"button3";
			this->button3->Size = System::Drawing::Size(64, 32);
			this->button3->TabIndex = 59;
			this->button3->Text = S"修改";
			this->button3->Click += new System::EventHandler(this, button3_Click);
			// 
			// dataGrid1
			// 
			this->dataGrid1->DataMember = S"";
			this->dataGrid1->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dataGrid1->Location = System::Drawing::Point(8, 160);
			this->dataGrid1->Name = S"dataGrid1";
			this->dataGrid1->Size = System::Drawing::Size(568, 232);
			this->dataGrid1->TabIndex = 58;
			this->dataGrid1->CurrentCellChanged += new System::EventHandler(this, dataGrid1_CurrentCellChanged);
			// 
			// textBox6
			// 
			this->textBox6->Location = System::Drawing::Point(384, 123);
			this->textBox6->Name = S"textBox6";
			this->textBox6->Size = System::Drawing::Size(104, 21);
			this->textBox6->TabIndex = 57;
			this->textBox6->Text = S"";
			// 
			// label6
			// 
			this->label6->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label6->Location = System::Drawing::Point(300, 123);
			this->label6->Name = S"label6";
			this->label6->Size = System::Drawing::Size(80, 23);
			this->label6->TabIndex = 56;
			this->label6->Text = S"进货价格:";
			this->label6->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// label4
			// 
			this->label4->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label4->Location = System::Drawing::Point(24, 128);
			this->label4->Name = S"label4";
			this->label4->Size = System::Drawing::Size(96, 23);
			this->label4->TabIndex = 51;
			this->label4->Text = S"最高库存量:";
			this->label4->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// label2
			// 
			this->label2->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label2->Location = System::Drawing::Point(64, 56);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(56, 23);
			this->label2->TabIndex = 47;
			this->label2->Text = S"名称:";
			this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// button1
			// 
			this->button1->Font = new System::Drawing::Font(S"宋体", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->button1->Location = System::Drawing::Point(300, 19);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(68, 24);
			this->button1->TabIndex = 46;
			this->button1->Text = S"查询";
			this->button1->Click += new System::EventHandler(this, button1_Click);
			// 
			// label1
			// 
			this->label1->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label1->Location = System::Drawing::Point(80, 19);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(40, 23);
			this->label1->TabIndex = 44;
			this->label1->Text = S"ID:";
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// wupinkongzhi
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(584, 398);
			this->Controls->Add(this->textBox4);
			this->Controls->Add(this->textBox5);
			this->Controls->Add(this->textBox3);
			this->Controls->Add(this->label5);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->dataGrid1);
			this->Controls->Add(this->textBox6);
			this->Controls->Add(this->label6);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->label1);
			this->Name = S"wupinkongzhi";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
			this->Text = S"物品控制";
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dataGrid1))->EndInit();
			this->ResumeLayout(false);

		}		
	private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
			 {String *WID=this->textBox1->Text->Trim();
		   
		   oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称,LASTSTOCK as 底数库存量,SELLPRICE as 出售价格,MAXSTOCK as 最高库存量,STOCKPRICE as 进货价格 from  物品表 where ",S"WID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter1->Fill(table1);
			this->dataGrid1->DataSource=table1;
			 }

private: System::Void button2_Click(System::Object *  sender, System::EventArgs *  e)
		 {String *WNAME=this->textBox2->Text->Trim();
		   
		   oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称,LASTSTOCK as 底数库存量,SELLPRICE as 出售价格,MAXSTOCK as 最高库存量,STOCKPRICE as 进货价格 from  物品表 where ",S"WNAME='",WNAME,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter1->Fill(table1);
			this->dataGrid1->DataSource=table1;
		 }

private: System::Void button3_Click(System::Object *  sender, System::EventArgs *  e)
		 {   String *WID=this->textBox1->Text->Trim();
		 if(this->textBox1->Text->CompareTo("")==0) MessageBox::Show("物品ID不能为空");
		 else{  oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称,LASTSTOCK as 底数库存量,SELLPRICE as 出售价格,MAXSTOCK as 最高库存量,STOCKPRICE as 进货价格 from  物品表 where ",S"WID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		  DataTable *table2=new DataTable();
		  oleDbDataAdapter1->Fill(table2);
          this->dataGrid1->DataSource=table2;
          int nindex=dataGrid1->CurrentRowIndex;
			   DataTable *table3=__try_cast<DataTable*>(dataGrid1->DataSource);
			             
			 if(nindex<0) MessageBox::Show("物品ID不存在");
           
			 else{ 
			       int i=0;
				   if(this->textBox3->Text->CompareTo("")==0) {MessageBox::Show("底数库存量不能为空");
				   i++;          }
			       if(this->textBox3->Text->Length>4) {MessageBox::Show("底数库存量输入太长");
				   i++;}
			       if(this->textBox4->Text->CompareTo("")==0) {MessageBox::Show("出售价格不能为空");
				   i++;}
				   if(this->textBox4->Text->Length>8) {MessageBox::Show("出售价格输入太长");
				   i++;              }
				   if(this->textBox5->Text->CompareTo("")==0) {MessageBox::Show("最高库存量不能为空");
				   i++;}
				   if(this->textBox5->Text->Length>4){ MessageBox::Show("最高库存量输入太长");
				   i++;}
				   if(this->textBox6->Text->CompareTo("")==0) {MessageBox::Show("进货价格不能为空");
				   i++;}
				   if(this->textBox6->Text->Length>8){ MessageBox::Show("进货价格输入太长");
				   i++;}	           
           
				   if(i==0){			 
			
		   String *LASTSTOCK=this->textBox3->Text->Trim();
		   String *SELLPRICE=this->textBox4->Text->Trim();
		   String *STOCK=this->textBox5->Text->Trim();
		   String *STOCKPRICE=this->textBox6->Text->Trim();
		  oleDbUpdateCommand1->CommandText=String::Concat(S"update  物品表 set ",S"LASTSTOCK='",LASTSTOCK,S"',",S"SELLPRICE='",SELLPRICE,S"',",S" MAXSTOCK='",STOCK,S"',",S"STOCKPRICE='",STOCKPRICE,S"'",S" where WID='",WID,S"'" );
             
		      oleDbConnection1->Open();
		 oleDbUpdateCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter1->Fill(table1);
			this->dataGrid1->DataSource=table1;
		 }
		 }
		 }
		 }
private: System::Void button4_Click(System::Object *  sender, System::EventArgs *  e)
		 {this->textBox1->Text="";
			 this->textBox2->Text="";
			 this->textBox3->Text="";
			 this->textBox4->Text="";
			 this->textBox5->Text="";
			 this->textBox6->Text="";
		 }

private: System::Void dataGrid1_CurrentCellChanged(System::Object *  sender, System::EventArgs *  e)
		 {int nindex=dataGrid1->CurrentRowIndex;
			 if(nindex<0)
			 {this->textBox1->Text=S"";
			 this->textBox2->Text=S"";
			 this->textBox3->Text=S"";
			 this->textBox4->Text=S"";
			 this->textBox5->Text=S"";
			 this->textBox6->Text=S"";
			 return;
			 }
                         DataTable *table2=__try_cast<DataTable*>(dataGrid1->DataSource);
			   DataRow * row=table2->Rows->Item[nindex];
               this->textBox1->Text=row->Item[0]->ToString();
			   this->textBox2->Text=row->Item[1]->ToString();
			   this->textBox3->Text=row->Item[2]->ToString();
			   this->textBox4->Text=row->Item[3]->ToString();
			   this->textBox5->Text=row->Item[4]->ToString();
			   this->textBox6->Text=row->Item[5]->ToString();
		 }

};
}

⌨️ 快捷键说明

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