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

📄 coutstore.h

📁 MFC程序开发参考大全 【明日科技】宋坤 刘锐宁 李伟明 【丛 书 名】 软件工程师典藏 【出 版 社】 人民邮电出版社 本书详细介绍了MFC框架中所有常用类及控件的应用
💻 H
📖 第 1 页 / 共 3 页
字号:
#pragma once
#include "CDataManage.h"
#include "CLogin.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Data::Common;

namespace BOOKMANAGE {

	/// <summary>
	/// COutStore 摘要
	///
	/// 警告: 如果更改此类的名称,则需要更改
	///          与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
	///          “资源文件名”属性。否则,
	///          设计器将不能与此窗体的关联
	///          本地化资源正确交互。
	/// </summary>
	public ref class COutStore : public System::Windows::Forms::Form
	{
	public:
		COutStore(void)
		{
			InitializeComponent();
			CurInsertedRow = 0;
			//
			//TODO: 在此处添加构造函数代码
			//
		}

	protected:
		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		~COutStore()
		{
			if (components)
			{
				delete components;
			}
		}


		int CurInsertedRow;

	//统计总数量
	Decimal GroupNum()
	{
		Decimal temp = 0;
		for (int i = 0; i<BookList->RowCount; i++)
		{
			String^ str= Convert::ToString(BookList->Rows[i]->Cells[3]->Value);
			if (str != "")
			{
				temp += Convert::ToDecimal(str);	
			}
		}
		return temp;
	}

	//统计总金额
	
	Decimal GroupMoney()
	{
	
		Decimal temp = 0;
		for (int i = 0; i<BookList->RowCount; i++)
		{
			String^ str=Convert::ToString( BookList->Rows[i]->Cells[5]->Value);
			if (str != "")
			{
				temp += Convert::ToDecimal(str);	
			}
		}
		return temp;	
	}

	//清空编辑框文本

	void ClearText()
	{
		BookName->Text = "";
		Author->Text = "";
		BookPrice->Text = "";
		BookNum->Text = "0";
		BookRebate->Text = "1.0";
	}
	//清空表格数据
	void ClearGridData()
	{
		BookList->RowCount = 1;

		for (int col = 0; col < BookList->ColumnCount;col++)
		{
			BookList->Rows[0]->Cells[col]->Value = "";
		
		}
	
	}

	

	bool BookInfoIsNull()
	{
		for (int i = 0; i< groupBox1->Controls->Count;i++)
		{
			if (groupBox1->Controls[i]->GetType()->Name=="TextBox")
				if (groupBox1->Controls[i]->Text=="")
				{
					return true;
				}
		}
		return false;
	}

	CDataManage DataManage;
	
	//判断列表中的图书信息在仓库中是否存在

	bool BookInfoIsExist([Runtime::InteropServices::Out] String^ %str)
	{
		String^ sql;
		for (int i = 0 ; i< BookList->RowCount-1; i++)
		{
			
			sql = String::Format("select * from BookStorage where BookName = '{0}'",Convert::ToString(BookList->Rows[i]->Cells[0]->Value));

			DataManage.Command->CommandText = sql;
			DataManage.DataReader = DataManage.Command->ExecuteReader();

			if (!DataManage.DataReader->HasRows)
			{
				str = Convert::ToString(BookList->Rows[i]->Cells[0]->Value);
				DataManage.DataReader->Close();
				return false;
			
			}
			DataManage.DataReader->Close();
		
		}
		return true;
	}



	private: System::Windows::Forms::Button^  ButtonCancel;
	protected: 
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::TextBox^  TotalMoney;
	private: System::Windows::Forms::TextBox^  TotalNum;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::GroupBox^  groupBox1;
	private: System::Windows::Forms::TextBox^  Author;
	private: System::Windows::Forms::Label^  label10;
	private: System::Windows::Forms::TextBox^  BookRebate;
	private: System::Windows::Forms::Label^  label9;
	private: System::Windows::Forms::TextBox^  BookNum;
	private: System::Windows::Forms::Label^  label8;
	private: System::Windows::Forms::TextBox^  BookPrice;
	private: System::Windows::Forms::Label^  label7;
	private: System::Windows::Forms::TextBox^  BookName;
	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::Button^  button3;
	private: System::Windows::Forms::DataGridView^  BookList;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column1;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column6;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column2;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column3;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column4;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column5;
	private: System::Windows::Forms::TextBox^  Operator;
	private: System::Windows::Forms::DateTimePicker^  dateTime1;
	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::DataGridView^  AuList;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  dataGridViewTextBoxColumn1;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  dataGridViewTextBoxColumn2;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  dataGridViewTextBoxColumn3;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  dataGridViewTextBoxColumn4;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  dataGridViewTextBoxColumn5;

	private:
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要
		/// 使用代码编辑器修改此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			System::Windows::Forms::DataGridViewCellStyle^  dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
			this->ButtonCancel = (gcnew System::Windows::Forms::Button());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->TotalMoney = (gcnew System::Windows::Forms::TextBox());
			this->TotalNum = (gcnew System::Windows::Forms::TextBox());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
			this->Author = (gcnew System::Windows::Forms::TextBox());
			this->label10 = (gcnew System::Windows::Forms::Label());
			this->BookRebate = (gcnew System::Windows::Forms::TextBox());
			this->label9 = (gcnew System::Windows::Forms::Label());
			this->BookNum = (gcnew System::Windows::Forms::TextBox());
			this->label8 = (gcnew System::Windows::Forms::Label());
			this->BookPrice = (gcnew System::Windows::Forms::TextBox());
			this->label7 = (gcnew System::Windows::Forms::Label());
			this->BookName = (gcnew System::Windows::Forms::TextBox());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->BookList = (gcnew System::Windows::Forms::DataGridView());
			this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Column6 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Column4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Column5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Operator = (gcnew System::Windows::Forms::TextBox());
			this->dateTime1 = (gcnew System::Windows::Forms::DateTimePicker());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->AuList = (gcnew System::Windows::Forms::DataGridView());
			this->dataGridViewTextBoxColumn1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->dataGridViewTextBoxColumn2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->dataGridViewTextBoxColumn3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->dataGridViewTextBoxColumn4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->dataGridViewTextBoxColumn5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->groupBox1->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->BookList))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->AuList))->BeginInit();
			this->SuspendLayout();
			// 
			// ButtonCancel
			// 
			this->ButtonCancel->Location = System::Drawing::Point(467, 436);
			this->ButtonCancel->Name = L"ButtonCancel";
			this->ButtonCancel->Size = System::Drawing::Size(75, 23);
			this->ButtonCancel->TabIndex = 27;
			this->ButtonCancel->Text = L"取消";
			this->ButtonCancel->UseVisualStyleBackColor = true;
			this->ButtonCancel->Enter += gcnew System::EventHandler(this, &COutStore::BookName_Enter);
			this->ButtonCancel->Click += gcnew System::EventHandler(this, &COutStore::ButtonCancel_Click);
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(381, 436);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(75, 23);
			this->button1->TabIndex = 26;
			this->button1->Text = L"保存";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Enter += gcnew System::EventHandler(this, &COutStore::BookName_Enter);
			this->button1->Click += gcnew System::EventHandler(this, &COutStore::button1_Click);
			// 
			// TotalMoney
			// 
			this->TotalMoney->Enabled = false;
			this->TotalMoney->Location = System::Drawing::Point(235, 438);
			this->TotalMoney->Name = L"TotalMoney";
			this->TotalMoney->Size = System::Drawing::Size(100, 21);
			this->TotalMoney->TabIndex = 25;
			this->TotalMoney->Text = L"0";
			this->TotalMoney->Enter += gcnew System::EventHandler(this, &COutStore::BookName_Enter);
			// 
			// TotalNum
			// 
			this->TotalNum->Enabled = false;
			this->TotalNum->Location = System::Drawing::Point(68, 438);
			this->TotalNum->Name = L"TotalNum";
			this->TotalNum->Size = System::Drawing::Size(100, 21);
			this->TotalNum->TabIndex = 24;
			this->TotalNum->Text = L"0";
			this->TotalNum->Enter += gcnew System::EventHandler(this, &COutStore::BookName_Enter);
			// 
			// label5
			// 
			this->label5->AutoSize = true;

⌨️ 快捷键说明

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