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

📄 xinzengshanchuwupin.h

📁 采用VC++.net做的超市收银管理系统
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->textBox6->Name = S"textBox6";
			this->textBox6->Size = System::Drawing::Size(160, 21);
			this->textBox6->TabIndex = 72;
			this->textBox6->Text = S"";
			// 
			// textBox3
			// 
			this->textBox3->Location = System::Drawing::Point(400, 64);
			this->textBox3->Name = S"textBox3";
			this->textBox3->Size = System::Drawing::Size(176, 21);
			this->textBox3->TabIndex = 65;
			this->textBox3->Text = S"";
			// 
			// textBox2
			// 
			this->textBox2->Location = System::Drawing::Point(128, 64);
			this->textBox2->Name = S"textBox2";
			this->textBox2->Size = System::Drawing::Size(152, 21);
			this->textBox2->TabIndex = 63;
			this->textBox2->Text = S"";
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(128, 24);
			this->textBox1->Name = S"textBox1";
			this->textBox1->Size = System::Drawing::Size(152, 21);
			this->textBox1->TabIndex = 61;
			this->textBox1->Text = S"";
			// 
			// button2
			// 
			this->button2->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->button2->Location = System::Drawing::Point(400, 16);
			this->button2->Name = S"button2";
			this->button2->Size = System::Drawing::Size(80, 32);
			this->button2->TabIndex = 75;
			this->button2->Text = S"添加";
			this->button2->Click += new System::EventHandler(this, button2_Click);
			// 
			// dataGrid1
			// 
			this->dataGrid1->DataMember = S"";
			this->dataGrid1->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dataGrid1->Location = System::Drawing::Point(8, 208);
			this->dataGrid1->Name = S"dataGrid1";
			this->dataGrid1->Size = System::Drawing::Size(592, 240);
			this->dataGrid1->TabIndex = 73;
			this->dataGrid1->CurrentCellChanged += new System::EventHandler(this, dataGrid1_CurrentCellChanged);
			// 
			// 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(40, 104);
			this->label4->Name = S"label4";
			this->label4->Size = System::Drawing::Size(96, 23);
			this->label4->TabIndex = 66;
			this->label4->Text = S"物品生产商:";
			// 
			// label3
			// 
			this->label3->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label3->Location = System::Drawing::Point(312, 64);
			this->label3->Name = S"label3";
			this->label3->Size = System::Drawing::Size(80, 23);
			this->label3->TabIndex = 64;
			this->label3->Text = S"物品型号:";
			this->label3->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(48, 64);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(80, 23);
			this->label2->TabIndex = 62;
			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(296, 16);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(80, 32);
			this->button1->TabIndex = 74;
			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(56, 24);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(72, 23);
			this->label1->TabIndex = 60;
			this->label1->Text = S"物品ID:";
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// xinzengshanchuwupin
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(608, 454);
			this->Controls->Add(this->textBox6);
			this->Controls->Add(this->textBox4);
			this->Controls->Add(this->textBox7);
			this->Controls->Add(this->textBox5);
			this->Controls->Add(this->label8);
			this->Controls->Add(this->label7);
			this->Controls->Add(this->textBox8);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->label5);
			this->Controls->Add(this->label6);
			this->Controls->Add(this->textBox3);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->dataGrid1);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->label1);
			this->Name = S"xinzengshanchuwupin";
			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();
		   String *WNAME=this->textBox2->Text->Trim();
		   String *MODEL=this->textBox3->Text->Trim();
		   String *PRODUCER=this->textBox4->Text->Trim();
		   String *SELLPRICE=this->textBox5->Text->Trim();
		   String *STOCKPRICE=this->textBox6->Text->Trim();
		   String *LASTSTOCK=this->textBox7->Text->Trim();
		   String *MAXSTOCK=this->textBox8->Text->Trim();


         oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称, MODEL as 型号,PRODUCER as 生产商,SELLPRICE as 出售价格,STOCKPRICE as 进货价格,LASTSTOCK as 底数库存量,MAXSTOCK 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 *WID=this->textBox1->Text->Trim();
              oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称, MODEL as 型号,PRODUCER as 生产商,SELLPRICE as 出售价格,STOCKPRICE as 进货价格,LASTSTOCK as 底数库存量,MAXSTOCK as 最高库存量 from  物品表 where ",S"WID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter1->Fill(table1);
			this->dataGrid1->DataSource=table1;
			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->textBox1->Text->CompareTo("")==0) {MessageBox::Show("物品ID不能为空");
				   i++;          }
			       if(this->textBox1->Text->Length>10) {MessageBox::Show("物品ID输入太长");
				   i++;}
				   if(this->textBox2->Text->CompareTo("")==0) {MessageBox::Show("物品名称不能为空");
				   i++;          }
			       if(this->textBox2->Text->Length>30) {MessageBox::Show("物品名称输入太长");
				   i++;}
				   if(this->textBox3->Text->CompareTo("")==0) {MessageBox::Show("物品型号不能为空");
				   i++;          }
			       if(this->textBox3->Text->Length>10) {MessageBox::Show("物品型号输入太长");
				   i++;}
			       if(this->textBox4->Text->CompareTo("")==0) {MessageBox::Show("物品生产商不能为空");
				   i++;}
				   if(this->textBox4->Text->Length>30) {MessageBox::Show("物品生产商输入太长");
				   i++;              }
				   if(this->textBox5->Text->CompareTo("")==0) {MessageBox::Show("出售价格不能为空");
				   i++;}
				   if(this->textBox5->Text->Length>8){ MessageBox::Show("出售价格输入太长");
				   i++;}
				   if(this->textBox6->Text->CompareTo("")==0) {MessageBox::Show("进货价格不能为空");
				   i++;}
				   if(this->textBox6->Text->Length>8){ MessageBox::Show("进货价格输入太长");
				   i++;}	 
				   if(this->textBox7->Text->CompareTo("")==0) {MessageBox::Show("库存底数提醒不能为空");
				   i++;          }
			       if(this->textBox7->Text->Length>4) {MessageBox::Show("库存底数提醒输入太长");
				   i++;}
				   if(this->textBox8->Text->CompareTo("")==0) {MessageBox::Show("最高库存量不能为空");
				   i++;          }
			       if(this->textBox8->Text->Length>4) {MessageBox::Show("最高库存量输入太长");
				   i++;}
           
				   if(i==0){				    
		   String *WNAME=this->textBox2->Text->Trim();
		   String *MODEL=this->textBox3->Text->Trim();
		   String *PRODUCER=this->textBox4->Text->Trim();
		   String *SELLPRICE=this->textBox5->Text->Trim();
		   String *STOCKPRICE=this->textBox6->Text->Trim();
           String *STOCK=0;
		   String *LASTSTOCK=this->textBox7->Text->Trim();
		   String *MAXSTOCK=this->textBox8->Text->Trim();
		   String *STOCKCHA=this->textBox8->Text->Trim();
		     oleDbInsertCommand1->CommandText=String::Concat(S"insert into 物品表 (",   S"WID,WNAME,MODEL,PRODUCER,SELLPRICE,STOCKPRICE,STOCK,LASTSTOCK,MAXSTOCK,STOCKCHA) values ('",  WID, S"','",WNAME,S"','",MODEL,S"','",PRODUCER,S"','",SELLPRICE,S"','",STOCKPRICE,S"','",STOCK,S"','",LASTSTOCK,S"','",MAXSTOCK,S"','",STOCKCHA,S"')"  );
          oleDbSelectCommand1->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称, MODEL as 型号,PRODUCER as 生产商,SELLPRICE as 出售价格,STOCKPRICE as 进货价格,LASTSTOCK as 底数库存量,MAXSTOCK as 最高库存量 from  物品表 where ",S"WID='",WID,S"'");
		     oleDbConnection1->Open();
		     oleDbInsertCommand1->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();
			 
			 oleDbDeleteCommand1->CommandText=String::Concat(S"delete from 物品表 where ",S"WID='",WID,S"'");
             oleDbConnection1->Open();
		     oleDbDeleteCommand1->ExecuteNonQuery();
		     oleDbConnection1->Close();
		     DataTable *table1=new DataTable();
             oleDbDataAdapter1->Fill(table1);
			 this->dataGrid1->DataSource=table1;
		 }

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"";
			 this->textBox7->Text=S"";
			 this->textBox8->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();
			   this->textBox7->Text=row->Item[6]->ToString();
			   this->textBox8->Text=row->Item[7]->ToString();
		 }

};
}

⌨️ 快捷键说明

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