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

📄 serverdoc.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 5 页
字号:
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}

					pMsg->Type = 2221;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1910:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

//					StringSeg(pMsg->ShortMessage,2);
					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [商品基本资料]";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					CString sReturn,str;
					str.Format("%d",pView->m_iRefresh);
					sReturn = str;
					sReturn += CHARFLAG;
					str.Format("%d",(int)ulColCount);
					sReturn += str;
					sReturn += CHARFLAG;

					for(int i = 0; i < pView->m_iRefresh; i++)
					{
						for(int j = 0; j < (int)ulColCount; j++)
						{
							sReturn += sResult[j][i];
							sReturn += CHARFLAG;
						}
					}

					pMsg->Type = 2910;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1911:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					StringSeg(pMsg->ShortMessage);
					
					for(int i = 0; i < m_iRow; i++)
					{
						CStringArray sResult[100];
						CString strSelect;
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where 商品编码 = '" + m_StrArray[i*m_iCol] + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);
						CStringArray saValues;
						saValues.RemoveAll();
						if(sResult[0][0] == m_StrArray[i*m_iCol])
						{
							for(int j = 0; j < m_iCol; j++)
							{
								saValues.Add(m_StrArray.GetAt(j+i*m_iCol));
							}
							pView->UpDateRow(strSelect,saValues);

						}
						else
						{
							CStringArray saTmp;
							saTmp.RemoveAll();
							for(int j = 0; j < m_iCol; j++)
							{
								saTmp.Add(m_StrArray.GetAt(j+i*m_iCol));
	//							saTmp.SetAt(j,m_StrArray.GetAt(j+i*m_iCol));
							}

							pView->InsertRow("商品基本资料",saTmp);
						}
					}
					pMsg->Type = 2911;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1912:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					StringSeg(pMsg->ShortMessage,4);

					CString sReturn,str;
					if(m_StrArray.GetAt(3) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2912;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else if(m_StrArray.GetAt(1) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(2) + " = '" + m_StrArray.GetAt(3) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2912;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' and " + m_StrArray.GetAt(2) + " = '" + m_StrArray.GetAt(3) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2912;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}

/*					StringSeg(pMsg->ShortMessage,2);
					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					if(sResult[0][0] == "")	return;
					CString sReturn,str;
					str.Format("%d",pView->m_iRefresh);
					sReturn = str;
					sReturn += CHARFLAG;
					str.Format("%d",(int)ulColCount);
					sReturn += str;
					sReturn += CHARFLAG;
					
					for(int i = 0; i < pView->m_iRefresh; i++)
					{
						for(int j = 0; j < (int)ulColCount; j++)
						{
							sReturn += sResult[j][i];
							sReturn += CHARFLAG;
						}
					}
*/
					pMsg->Type = 2912;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
/*		case 1913:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

					StringSeg(pMsg->ShortMessage,3);
					if(m_StrArray.GetAt(0) == "0")
					{
						m_StrArray.SetAt(0,"供货商");
					}
					else if(m_StrArray.GetAt(0) == "1")
					{
						m_StrArray.SetAt(0,"生产厂商");
					}
						
					CString sReturn,str;
					if(m_StrArray.GetAt(2) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	return;
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else if(m_StrArray.GetAt(1) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where 名称 = '" + m_StrArray.GetAt(2) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	return;
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [商品基本资料] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' and 名称 = '" + m_StrArray.GetAt(2) + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	return;
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}

					pMsg->Type = 2913;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
*/		case 1212:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [商品基本资料] where 商品编码 = '" + pMsg->ShortMessage + "'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					
					if(sResult[0][0] == "")	
					{
						pMsg->Type = 2212;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}

					CString sReturn="",str;
					str.Format("%d",pView->m_iRefresh);
					sReturn = str;
					sReturn += CHARFLAG;
					str.Format("%d",(int)ulColCount);
					sReturn += str;
					sReturn += CHARFLAG;

⌨️ 快捷键说明

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