DressManage.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. // DressManage.cpp : implementation file
  2. #include "stdafx.h"
  3. #include "ylgl.h"
  4. #include "DressManage.h"
  5. #include "MyMdi.H"
  6. #include "SPLBDlg.h"
  7. #include "ShowPhoto.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // DressManage IDC_LIST5
  15. IMPLEMENT_DYNCREATE(DressManage, MyFormView)
  16. DressManage::DressManage()
  17. : MyFormView(DressManage::IDD)
  18. {
  19. //{{AFX_DATA_INIT(DressManage)
  20. m_type = _T("");
  21. m_count = _T("");
  22. m_dresstype = _T("");
  23. m_name = _T("");
  24. m_remark = _T("");
  25. m_price1 = _T("");
  26. m_price2 = _T("");
  27. m_date = g_date;
  28. m_no = _T("");
  29. m_bModify=0;
  30. m_pImg=NULL;
  31. m_radio1 = 0;
  32. //}}AFX_DATA_INIT
  33. }
  34. DressManage::~DressManage()
  35. {
  36. if(m_pImg)delete m_pImg;
  37. }
  38. void DressManage::DoDataExchange(CDataExchange* pDX)
  39. {
  40. MyFormView::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(DressManage)
  42. DDX_Control(pDX, IDC_COMBO1, m_comboarea);
  43. DDX_Control(pDX, IDC_EDITprice2, m_editctrl3);
  44. DDX_Control(pDX, IDC_EDITprice1, m_editctrl2);
  45. DDX_Control(pDX, IDC_EDITdate, m_datectrl);
  46. DDX_Control(pDX, IDC_LIST5, m_List2);
  47. DDX_Control(pDX, IDC_EDITcount, m_editctrl);
  48. DDX_Control(pDX, IDC_LIST1, m_List1);
  49. DDX_Control(pDX, IDC_STATIC1, m_static1);
  50. DDX_Text(pDX, IDC_EDIT1, m_type);
  51. DDX_Text(pDX, IDC_EDITcount, m_count);
  52. DDX_Text(pDX, IDC_EDITdresstype, m_dresstype);
  53. DDX_Text(pDX, IDC_EDITname, m_name);
  54. DDX_Text(pDX, IDC_EDITremark, m_remark);
  55. DDV_MaxChars(pDX, m_remark, 1000);
  56. DDX_Text(pDX, IDC_EDITprice1, m_price1);
  57. DDX_Text(pDX, IDC_EDITprice2, m_price2);
  58. DDX_Text(pDX, IDC_EDITdate, m_date);
  59. DDX_Text(pDX, IDC_EDITno, m_no);
  60. DDX_Radio(pDX, IDC_RADIO1, m_radio1);
  61. //}}AFX_DATA_MAP
  62. }
  63. BEGIN_MESSAGE_MAP(DressManage, MyFormView)
  64. //{{AFX_MSG_MAP(DressManage)
  65. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  66. ON_BN_CLICKED(IDC_BUTTON2, OnAdd)
  67. ON_BN_CLICKED(IDC_BUTTON5, OnDel)
  68. ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
  69. ON_BN_CLICKED(IDC_BUTsave, OnBUTsave)
  70. ON_BN_CLICKED(IDC_BUTdel5, OnBUTdel5)
  71. ON_LBN_SELCHANGE(IDC_LIST5, OnSelchangeList5)
  72. ON_BN_CLICKED(IDC_BUTreset, OnBUTreset)
  73. ON_BN_CLICKED(IDC_BUTload, OnBUTload)
  74. ON_WM_PAINT()
  75. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  76. ON_BN_CLICKED(IDC_BUTgetno, OnBUTgetno)
  77. ON_BN_CLICKED(IDC_BUTgetno2, OnBUTgetno2)
  78. ON_BN_CLICKED(IDC_STATIC2, OnStatic2)
  79. ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  80. ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  81. //}}AFX_MSG_MAP
  82. END_MESSAGE_MAP()
  83. /////////////////////////////////////////////////////////////////////////////
  84. // DressManage diagnostics
  85. #ifdef _DEBUG
  86. void DressManage::AssertValid() const
  87. {
  88. MyFormView::AssertValid();
  89. }
  90. void DressManage::Dump(CDumpContext& dc) const
  91. {
  92. MyFormView::Dump(dc);
  93. }
  94. #endif //_DEBUG
  95. /////////////////////////////////////////////////////////////////////////////
  96. // DressManage message handlers
  97. void DressManage::OnInitialUpdate()
  98. {
  99. MyFormView::OnInitialUpdate();
  100. GetDlgItem(IDC_BUTdel5)->EnableWindow(IsHasRights2new(49));
  101. // TODO: Add your specialized code here and/or call the base class
  102. CMyMdi Mdi;
  103. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  104. // Here we create the outbar control using the splitter as its parent
  105. // and setting its id to the first pane.
  106. CRect rc2;
  107. GetWindowRect(rc2);
  108. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  109. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  110. m_comboarea.GetWindowRect (rc2);
  111. ScreenToClient(rc2);
  112. rc2.bottom +=200;
  113. m_comboarea.MoveWindow (rc2);
  114. m_static1.SetFont (&g_titlefont);
  115. m_List1.ResetContent ();
  116. g_sendhead.bsql=0;
  117. g_sendhead.code[0]=71;
  118. g_sendhead.code[1]=72;
  119. g_sendhead.code[2]=190;
  120. g_sendhead.tabcount=3;
  121. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  122. int i = 0;
  123. DataToArray(&m_typearray,&m_List1array,&m_dressareaarray);
  124. for( i=0; i<m_typearray.GetSize (); i++)
  125. {
  126. if(m_radio1!=atoi(m_typearray.ElementAt (i).ElementAt (1)))continue;
  127. if(m_List1.GetCount()%2)
  128. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol1, m_List1.GetCount());
  129. else
  130. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol2, m_List1.GetCount());
  131. }
  132. m_List1.Invalidate ();
  133. m_List2.ResetContent ();
  134. for( i=0; i<m_List1array.GetSize (); i++)
  135. {
  136. if(m_radio1!=atoi(m_List1array.ElementAt (i).ElementAt (12)))continue;
  137. if(m_List2.GetCount()%2)
  138. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol1, m_List2.GetCount());
  139. else
  140. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol2, m_List2.GetCount());
  141. }
  142. m_List2.Invalidate ();
  143. for( i=0; i<m_dressareaarray.GetSize (); i++)
  144. {
  145. m_comboarea.AddString( m_dressareaarray.ElementAt (i).ElementAt (0) );
  146. }
  147. }
  148. void DressManage::OnBUTclose()
  149. {
  150. // TODO: Add your control notification handler code here
  151. GetParent()->SendMessage(WM_CLOSE);
  152. }
  153. BOOL DressManage::PreTranslateMessage(MSG* pMsg)
  154. {
  155. // TODO: Add your specialized code here and/or call the base class
  156. try
  157. {
  158. if(pMsg->message==WM_KEYDOWN)
  159. {
  160. switch (pMsg->wParam)
  161. {
  162. case 0x43: // copy
  163. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  164. {
  165. GetFocus()->SendMessage(WM_COPY);
  166. return TRUE;
  167. }
  168. break;
  169. case 0x56: //Ctrl + V:
  170. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  171. {
  172. GetFocus()->SendMessage(WM_PASTE);
  173. return TRUE;
  174. }
  175. break;
  176. case 0x58: // cut
  177. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  178. {
  179. GetFocus()->SendMessage(WM_CUT);
  180. return TRUE;
  181. }
  182. break;
  183. case 0x5A: //undo
  184. case 0x59: //redo
  185. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  186. {
  187. GetFocus()->SendMessage(WM_UNDO);
  188. return TRUE;
  189. }
  190. break;
  191. }
  192. }
  193. return MyFormView::PreTranslateMessage(pMsg);
  194. }
  195. catch(...)
  196. {
  197. }
  198. }
  199. void DressManage::OnAdd()
  200. {
  201. // TODO: Add your control notification handler code here
  202. UpdateData();
  203. m_type.TrimLeft (); m_type.TrimRight ();
  204. CString str;
  205. for(int i=0; i<m_List1.GetCount (); i++)
  206. {
  207. m_List1.GetText (i, str);
  208. if(str==m_type)
  209. {
  210. AfxMessageBox("已有此类别的记录!");
  211. return;
  212. }
  213. }
  214. CString sql;
  215. sql.Format ("insert into dresstype(name,type)values('%s','%d')", m_type,m_radio1);
  216. g_sendhead.bsql=1;
  217. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  218. GetType();
  219. }
  220. void DressManage::OnDel()
  221. {
  222. // TODO: Add your control notification handle r code here
  223. int pos=m_List1.GetCurSel ();
  224. if(pos==-1)
  225. {
  226. AfxMessageBox("请先选中您要删除的类别!");
  227. return;
  228. }
  229. CString str;
  230. m_List1.GetText (pos, str);
  231. CString sql;
  232. sql.Format ("delete from dresstype where name='%s'", str);
  233. g_sendhead.bsql=1;
  234. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  235. GetType();
  236. }
  237. void DressManage::GetData()
  238. {
  239. g_sendhead.bsql=0;
  240. g_sendhead.code[0]=72;
  241. g_sendhead.tabcount=1;
  242. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  243. DataToArray(&m_List1array);
  244. TypeChange2();
  245. }
  246. void DressManage::OnSelchangeList1()
  247. {
  248. // TODO: Add your control notification handler code here
  249. int pos;
  250. pos=m_List1.GetCurSel ();
  251. if(pos==-1)return;
  252. UpdateData();
  253. m_List1.GetText (pos, m_dresstype);
  254. UpdateData(false);
  255. }
  256. void DressManage::OnBUTsave()
  257. {
  258. // TODO: Add your control notification handler code here
  259. UpdateData();
  260. m_no.TrimLeft ();m_no.TrimRight ();
  261. m_name.TrimLeft ();m_name.TrimRight ();
  262. m_count.TrimLeft ();m_count.TrimRight ();
  263. CString dressarea;
  264. int pos=m_comboarea.GetCurSel ();
  265. if(pos!=-1)
  266. {
  267. m_comboarea.GetLBText (pos, dressarea);
  268. }
  269. if(m_dresstype.IsEmpty ()||m_no.IsEmpty ()||m_name.IsEmpty ()||m_count.IsEmpty ()||dressarea.IsEmpty ())
  270. {
  271. AfxMessageBox("资料不全!");
  272. return;
  273. }
  274. CString sql;
  275. if(m_bModify==0)
  276. {
  277. sql="select count(*) as cot from dressinfo where [no]='"+m_no+"' or [name]='"+m_name+"'";
  278. g_sendhead.bsql=1;
  279. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  280. if(g_ncount)
  281. {
  282. AfxMessageBox("已有此编号或名称的记录!");
  283. return;
  284. }
  285. sql.Format ("insert into [dressinfo]([type],[no],[name],[count],[hirecount],[salecount],[balance],[remark],[price1],[price2],[date],[dressarea],[type2])values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d')", m_dresstype, m_no, m_name, m_count, "0","0",m_count, m_remark, m_price1, m_price2, m_date,dressarea,m_radio1);
  286. g_sendhead.bsql=1;
  287. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  288. }
  289. else
  290. {
  291. if(IsHasRights2new(43)==0)return;
  292. sql="update [dressinfo] set [type]='"+m_dresstype+"',[name]='"+m_name+"',[count]='"+m_count+"',[remark]='"+m_remark+"',[price1]='"+m_price1+"',[price2]='"+m_price2+"',[dressarea]='"+dressarea+"' where [no]='"+m_no+"'";
  293. g_sendhead.bsql=1;
  294. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  295. }
  296. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  297. GetData();
  298. CString str;
  299. for(int i=0; i<m_List2.GetCount (); i++)
  300. {
  301. m_List2.GetText (i, str);
  302. if(str==m_name)
  303. {
  304. m_List2.SetCurSel (i);
  305. break;
  306. }
  307. }
  308. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  309. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  310. GetDlgItem(IDC_EDITno)->EnableWindow(0);
  311. GetDlgItem(IDC_EDITname)->EnableWindow(0);
  312. // GetDlgItem(IDC_BUTsave)->SetWindowText("修改礼服资料");
  313. // GetDlgItem(IDC_BUTsave)->Invalidate();
  314. m_bModify=1;
  315. }
  316. void DressManage::GetType()
  317. {
  318. g_sendhead.bsql=0;
  319. g_sendhead.code[0]=71;
  320. g_sendhead.tabcount=1;
  321. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  322. DataToArray(&m_typearray);
  323. TypeChange();
  324. }
  325. void DressManage::OnBUTdel5()
  326. {
  327. // TODO: Add your control notification handler code here
  328. if(IsHasRights2new(49)==0)return;
  329. int pos=m_List2.GetCurSel ();
  330. if(pos==-1)
  331. {
  332. AfxMessageBox("请先选中您要删除的礼服!");
  333. return;
  334. }
  335. if(AfxMessageBox("删除后将不可恢复, 是否继续?", MB_YESNO|MB_ICONSTOP)!=IDYES)
  336. return;
  337. CString str;
  338. m_List2.GetText (pos, str);
  339. CString sql;
  340. sql.Format ("delete from dressinfo where name='%s'", str);
  341. g_sendhead.bsql=1;
  342. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  343. GetData();
  344. }
  345. void DressManage::OnSelchangeList5()
  346. {
  347. // TODO: Add your control notification handler code here
  348. int pos;
  349. pos=m_List2.GetCurSel ();
  350. if(pos==-1)return;
  351. m_List2.GetText (pos, m_name);
  352. CString filter="name='"+m_name+"'";
  353. g_sendhead.bsql=0;
  354. g_sendhead.code[0]=72;
  355. g_sendhead.tabcount=1;
  356. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  357. CArray<CStringArray, CStringArray>m_List1array;
  358. DataToArray(&m_List1array);
  359. if(m_List1array.GetSize ())
  360. {
  361. m_dresstype = m_List1array.ElementAt (0).ElementAt (0);
  362. m_no = m_List1array.ElementAt (0).ElementAt (1);
  363. m_count =m_List1array.ElementAt (0).ElementAt (4);
  364. m_price1 = m_List1array.ElementAt (0).ElementAt (8);
  365. m_price2 = m_List1array.ElementAt (0).ElementAt (9);
  366. m_remark = m_List1array.ElementAt (0).ElementAt (10);
  367. m_date = m_List1array.ElementAt (0).ElementAt (11);
  368. CString dressarea = m_List1array.ElementAt (0).ElementAt (3);
  369. int pos=m_comboarea.FindString (0, dressarea);
  370. if(pos!=-1)
  371. {
  372. m_comboarea.SetCurSel (pos);
  373. }
  374. else
  375. {
  376. m_comboarea.AddString (dressarea);
  377. m_comboarea.SetCurSel (m_comboarea.FindString (0, dressarea));
  378. }
  379. CString savepath=g_path5+"\\";
  380. if(m_pImg)delete m_pImg;m_pImg=NULL;
  381. if(::CheckFileExist( savepath+""+m_no+".jpg" ) )
  382. {
  383. ::LoadImageFromBuf (&m_pImg, savepath+""+m_no+".jpg");
  384. }
  385. CRect rc;
  386. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  387. ScreenToClient(rc);
  388. InvalidateRect(rc);
  389. }
  390. if(m_pImg==NULL)
  391. {
  392. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  393. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  394. }
  395. else if(IsHasRights2new(43))
  396. {
  397. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  398. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  399. }
  400. else
  401. {
  402. GetDlgItem(IDC_BUTload)->EnableWindow(0);
  403. GetDlgItem(IDC_BUTdel)->EnableWindow(0);
  404. }
  405. GetDlgItem(IDC_EDITno)->EnableWindow(0);
  406. GetDlgItem(IDC_EDITname)->EnableWindow(0);
  407. // GetDlgItem(IDC_BUTsave)->SetWindowText("修改礼服资料");GetDlgItem(IDC_BUTsave)->Invalidate();
  408. m_bModify=1;
  409. UpdateData(false);
  410. // GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(43));
  411. }
  412. void DressManage::OnBUTreset()
  413. {
  414. // TODO: Add your control notification handler code here
  415. GetDlgItem(IDC_BUTload)->EnableWindow(0);
  416. GetDlgItem(IDC_BUTdel)->EnableWindow(0);
  417. GetDlgItem(IDC_EDITno)->EnableWindow(1);
  418. GetDlgItem(IDC_EDITname)->EnableWindow(1);
  419. // GetDlgItem(IDC_BUTsave)->SetWindowText("添加新礼服");
  420. // GetDlgItem(IDC_BUTsave)->Invalidate();
  421. m_bModify=0;
  422. UpdateData();
  423. m_count = _T("");
  424. m_name = _T("");
  425. m_remark = _T("");
  426. m_no = _T("");
  427. m_price1 = _T("");
  428. m_price2 = _T("");
  429. m_date = g_date;
  430. m_comboarea.SetCurSel (-1);
  431. UpdateData(false);
  432. if(m_pImg)delete m_pImg;m_pImg=NULL;
  433. CRect rc;
  434. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  435. ScreenToClient(rc);
  436. InvalidateRect(rc);
  437. // GetDlgItem(IDC_BUTsave)->EnableWindow(1);
  438. }
  439. void DressManage::OnBUTload()
  440. {
  441. // TODO: Add your control notification handler code here
  442. if(g_path5.IsEmpty ())
  443. {
  444. AfxMessageBox("未设置礼服图片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  445. return;
  446. }
  447. if(!::CheckFolderFileExist (g_path5))
  448. {
  449. AfxMessageBox("礼服图片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  450. return;
  451. }
  452. CFileDialog fdlg(true, NULL,"", OFN_HIDEREADONLY, "jpg files(*jpg)|*.jpg||");
  453. if(fdlg.DoModal ()!=IDOK)return;
  454. CString path=fdlg.GetPathName();
  455. if(m_pImg)delete m_pImg;m_pImg=NULL;
  456. ::LoadImageFromBuf (&m_pImg, path);
  457. if(m_pImg==NULL)
  458. AfxMessageBox("无效图片文件!");
  459. else
  460. {
  461. CRect rc(0,0,160,160);
  462. RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
  463. Image *pTemp=m_pImg->GetThumbnailImage(rc.Width (), rc.Height (), NULL, NULL);
  464. Graphics graphic(pTemp);
  465. graphic.SetSmoothingMode(SmoothingModeHighQuality);
  466. graphic.DrawImage(m_pImg, 0,0,pTemp->GetWidth(), pTemp->GetHeight() );
  467. CString savepath=g_path5+"\\";
  468. ::SaveImageToFile (pTemp, savepath+"s"+m_no+".jpg");
  469. ::SaveImageToFile (m_pImg, savepath+m_no+".jpg");
  470. delete pTemp;
  471. // CRect rc;
  472. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  473. ScreenToClient(rc);
  474. InvalidateRect(rc);
  475. }
  476. }
  477. void DressManage::OnBUTdel()
  478. {
  479. // TODO: Add your control notification handler code here
  480. CString savepath=g_path5+"\\";
  481. ::DeleteFile (savepath+"s"+m_no+".jpg");
  482. ::DeleteFile (savepath+m_no+".jpg");
  483. delete m_pImg;m_pImg=NULL;
  484. CRect rc;
  485. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  486. ScreenToClient(rc);
  487. InvalidateRect(rc);
  488. }
  489. void DressManage::OnPaint()
  490. {
  491. CPaintDC dc(this); // device context for painting
  492. // TODO: Add your message handler code here
  493. if(m_pImg)
  494. {
  495. CRect rc;
  496. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  497. ScreenToClient(rc);
  498. RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
  499. Graphics dcgraph(dc.GetSafeHdc());
  500. Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ());
  501. dcgraph.DrawImage(m_pImg, destinationRect, 0,0,m_pImg->GetWidth(), m_pImg->GetHeight(),UnitPixel);
  502. }
  503. // Do not call MyFormView::OnPaint() for painting messages
  504. }
  505. void DressManage::OnBUTgetno()
  506. {
  507. // TODO: Add your control notification handler code here
  508. UpdateData();
  509. if(m_dresstype.IsEmpty ())
  510. {
  511. AfxMessageBox("请先选择礼服类别!");
  512. return;
  513. }
  514. CString strRes1;
  515. GetFirstLetter(m_dresstype, strRes1);
  516. int begin=1;
  517. BOOL bFind=1;
  518. while(bFind)
  519. {
  520. int i = 0;
  521. m_no.Format ("%s%03d", strRes1, begin++);
  522. for( i=0; i< m_List1array.GetSize (); i++)
  523. {
  524. if(m_no==m_List1array.ElementAt (i).ElementAt (1))
  525. {
  526. break;
  527. }
  528. }
  529. if(i==m_List1array.GetSize ())bFind=0;
  530. }
  531. UpdateData(false);
  532. }
  533. void DressManage::OnBUTgetno2()
  534. {
  535. // TODO: Add your control notification handler code here
  536. SPLBDlg dlg;
  537. dlg.m_mode=11;
  538. dlg.DoModal ();
  539. m_comboarea.ResetContent ();
  540. g_sendhead.bsql=0;
  541. g_sendhead.code[0]=190;
  542. g_sendhead.tabcount=1;
  543. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  544. DataToArray(&m_dressareaarray);
  545. for(int i=0; i<m_dressareaarray.GetSize (); i++)
  546. {
  547. m_comboarea.AddString( m_dressareaarray.ElementAt (i).ElementAt (0) );
  548. }
  549. }
  550. void DressManage::OnStatic2()
  551. {
  552. // TODO: Add your control notification handler code here
  553. if(m_pImg)
  554. {
  555. ShowPhoto dlg;
  556. dlg.m_pImg=m_pImg;
  557. dlg.DoModal();
  558. }
  559. }
  560. void DressManage::OnRadio1()
  561. {
  562. // TODO: Add your control notification handler code here
  563. OnRadio2() ;
  564. }
  565. void DressManage::OnRadio2()
  566. {
  567. // TODO: Add your control notification handler code here
  568. UpdateData();
  569. if(m_radio1==0)
  570. {
  571. GetDlgItem(IDC_STATIC3)->SetWindowText("礼服类别");
  572. GetDlgItem(IDC_STATIC4)->SetWindowText("添加礼服");
  573. GetDlgItem(IDC_STATIC5)->SetWindowText("全部礼服");
  574. GetDlgItem(IDC_STATIC6)->SetWindowText("*礼服类别:");
  575. GetDlgItem(IDC_STATIC7)->SetWindowText("*礼服编号:");
  576. GetDlgItem(IDC_STATIC8)->SetWindowText("*礼服名称:");
  577. GetDlgItem(IDC_STATIC9)->SetWindowText("*礼服件数:");
  578. }
  579. else
  580. {
  581. GetDlgItem(IDC_STATIC3)->SetWindowText("其它类别");
  582. GetDlgItem(IDC_STATIC4)->SetWindowText("添加");
  583. GetDlgItem(IDC_STATIC5)->SetWindowText("全部");
  584. GetDlgItem(IDC_STATIC6)->SetWindowText("*类别:");
  585. GetDlgItem(IDC_STATIC7)->SetWindowText("*编号:");
  586. GetDlgItem(IDC_STATIC8)->SetWindowText("*名称:");
  587. GetDlgItem(IDC_STATIC9)->SetWindowText("*数量:");
  588. }
  589. TypeChange();TypeChange2();
  590. }
  591. void DressManage::TypeChange()
  592. {
  593. UpdateData();
  594. m_List1.ResetContent ();
  595. for(int i=0; i<m_typearray.GetSize (); i++)
  596. {
  597. if(m_radio1!=atoi(m_typearray.ElementAt (i).ElementAt (1)))continue;
  598. if(m_List1.GetCount()%2)
  599. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol1, m_List1.GetCount());
  600. else
  601. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol2, m_List1.GetCount());
  602. }
  603. m_List1.Invalidate ();
  604. }
  605. void DressManage::TypeChange2()
  606. {
  607. UpdateData();
  608. m_List2.ResetContent ();
  609. for(int i=0; i<m_List1array.GetSize (); i++)
  610. {
  611. if(m_radio1!=atoi(m_List1array.ElementAt (i).ElementAt (12)))continue;
  612. if(m_List2.GetCount()%2)
  613. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol1, m_List2.GetCount());
  614. else
  615. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol2, m_List2.GetCount());
  616. }
  617. m_List2.Invalidate ();
  618. }