DressManage.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  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. DataToArray(&m_typearray,&m_List1array,&m_dressareaarray);
  123. int i = 0;
  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. return true;
  199. }
  200. void DressManage::OnAdd()
  201. {
  202. // TODO: Add your control notification handler code here
  203. UpdateData();
  204. m_type.TrimLeft (); m_type.TrimRight ();
  205. CString str;
  206. for(int i=0; i<m_List1.GetCount (); i++)
  207. {
  208. m_List1.GetText (i, str);
  209. if(str==m_type)
  210. {
  211. AfxMessageBox("已有此类别的记录!");
  212. return;
  213. }
  214. }
  215. CString sql;
  216. sql.Format ("insert into dresstype(name,type)values('%s','%d')", m_type,m_radio1);
  217. g_sendhead.bsql=1;
  218. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  219. GetType();
  220. }
  221. void DressManage::OnDel()
  222. {
  223. // TODO: Add your control notification handle r code here
  224. int pos=m_List1.GetCurSel ();
  225. if(pos==-1)
  226. {
  227. AfxMessageBox("请先选中您要删除的类别!");
  228. return;
  229. }
  230. CString str;
  231. m_List1.GetText (pos, str);
  232. CString sql;
  233. sql.Format ("delete from dresstype where name='%s'", str);
  234. g_sendhead.bsql=1;
  235. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  236. GetType();
  237. }
  238. void DressManage::GetData()
  239. {
  240. g_sendhead.bsql=0;
  241. g_sendhead.code[0]=72;
  242. g_sendhead.tabcount=1;
  243. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  244. DataToArray(&m_List1array);
  245. TypeChange2();
  246. }
  247. void DressManage::OnSelchangeList1()
  248. {
  249. // TODO: Add your control notification handler code here
  250. int pos;
  251. pos=m_List1.GetCurSel ();
  252. if(pos==-1)return;
  253. UpdateData();
  254. m_List1.GetText (pos, m_dresstype);
  255. UpdateData(false);
  256. }
  257. void DressManage::OnBUTsave()
  258. {
  259. // TODO: Add your control notification handler code here
  260. UpdateData();
  261. m_no.TrimLeft ();m_no.TrimRight ();
  262. m_name.TrimLeft ();m_name.TrimRight ();
  263. m_count.TrimLeft ();m_count.TrimRight ();
  264. CString dressarea;
  265. int pos=m_comboarea.GetCurSel ();
  266. if(pos!=-1)
  267. {
  268. m_comboarea.GetLBText (pos, dressarea);
  269. }
  270. if(m_dresstype.IsEmpty ()||m_no.IsEmpty ()||m_name.IsEmpty ()||m_count.IsEmpty ()||dressarea.IsEmpty ())
  271. {
  272. AfxMessageBox("资料不全!");
  273. return;
  274. }
  275. CString sql;
  276. if(m_bModify==0)
  277. {
  278. sql="select count(*) as cot from dressinfo where [no]='"+m_no+"' or [name]='"+m_name+"'";
  279. g_sendhead.bsql=1;
  280. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  281. if(g_ncount)
  282. {
  283. AfxMessageBox("已有此编号或名称的记录!");
  284. return;
  285. }
  286. 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);
  287. g_sendhead.bsql=1;
  288. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  289. }
  290. else
  291. {
  292. if(IsHasRights2new(43)==0)return;
  293. 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+"'";
  294. g_sendhead.bsql=1;
  295. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  296. }
  297. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  298. GetData();
  299. CString str;
  300. for(int i=0; i<m_List2.GetCount (); i++)
  301. {
  302. m_List2.GetText (i, str);
  303. if(str==m_name)
  304. {
  305. m_List2.SetCurSel (i);
  306. break;
  307. }
  308. }
  309. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  310. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  311. GetDlgItem(IDC_EDITno)->EnableWindow(0);
  312. GetDlgItem(IDC_EDITname)->EnableWindow(0);
  313. // GetDlgItem(IDC_BUTsave)->SetWindowText("修改礼服资料");
  314. // GetDlgItem(IDC_BUTsave)->Invalidate();
  315. m_bModify=1;
  316. }
  317. void DressManage::GetType()
  318. {
  319. g_sendhead.bsql=0;
  320. g_sendhead.code[0]=71;
  321. g_sendhead.tabcount=1;
  322. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  323. DataToArray(&m_typearray);
  324. TypeChange();
  325. }
  326. void DressManage::OnBUTdel5()
  327. {
  328. // TODO: Add your control notification handler code here
  329. if(IsHasRights2new(49)==0)return;
  330. int pos=m_List2.GetCurSel ();
  331. if(pos==-1)
  332. {
  333. AfxMessageBox("请先选中您要删除的礼服!");
  334. return;
  335. }
  336. if(AfxMessageBox("删除后将不可恢复, 是否继续?", MB_YESNO|MB_ICONSTOP)!=IDYES)
  337. return;
  338. CString str;
  339. m_List2.GetText (pos, str);
  340. CString sql;
  341. sql.Format ("delete from dressinfo where name='%s'", str);
  342. g_sendhead.bsql=1;
  343. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  344. GetData();
  345. }
  346. void DressManage::OnSelchangeList5()
  347. {
  348. // TODO: Add your control notification handler code here
  349. int pos;
  350. pos=m_List2.GetCurSel ();
  351. if(pos==-1)return;
  352. m_List2.GetText (pos, m_name);
  353. CString filter="name='"+m_name+"'";
  354. g_sendhead.bsql=0;
  355. g_sendhead.code[0]=72;
  356. g_sendhead.tabcount=1;
  357. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  358. CArray<CStringArray, CStringArray>m_List1array;
  359. DataToArray(&m_List1array);
  360. if(m_List1array.GetSize ())
  361. {
  362. m_dresstype = m_List1array.ElementAt (0).ElementAt (0);
  363. m_no = m_List1array.ElementAt (0).ElementAt (1);
  364. m_count =m_List1array.ElementAt (0).ElementAt (4);
  365. m_price1 = m_List1array.ElementAt (0).ElementAt (8);
  366. m_price2 = m_List1array.ElementAt (0).ElementAt (9);
  367. m_remark = m_List1array.ElementAt (0).ElementAt (10);
  368. m_date = m_List1array.ElementAt (0).ElementAt (11);
  369. CString dressarea = m_List1array.ElementAt (0).ElementAt (3);
  370. int pos=m_comboarea.FindString (0, dressarea);
  371. if(pos!=-1)
  372. {
  373. m_comboarea.SetCurSel (pos);
  374. }
  375. else
  376. {
  377. m_comboarea.AddString (dressarea);
  378. m_comboarea.SetCurSel (m_comboarea.FindString (0, dressarea));
  379. }
  380. CString savepath=g_path5+"\\";
  381. if(m_pImg)delete m_pImg;m_pImg=NULL;
  382. if(PathFileExists( savepath+""+m_no+".jpg" ) )
  383. {
  384. ::LoadImageFromBuf (&m_pImg, savepath+""+m_no+".jpg");
  385. }
  386. CRect rc;
  387. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  388. ScreenToClient(rc);
  389. InvalidateRect(rc);
  390. }
  391. if(m_pImg==NULL)
  392. {
  393. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  394. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  395. }
  396. else if(IsHasRights2new(43))
  397. {
  398. GetDlgItem(IDC_BUTload)->EnableWindow(1);
  399. GetDlgItem(IDC_BUTdel)->EnableWindow(1);
  400. }
  401. else
  402. {
  403. GetDlgItem(IDC_BUTload)->EnableWindow(0);
  404. GetDlgItem(IDC_BUTdel)->EnableWindow(0);
  405. }
  406. GetDlgItem(IDC_EDITno)->EnableWindow(0);
  407. GetDlgItem(IDC_EDITname)->EnableWindow(0);
  408. // GetDlgItem(IDC_BUTsave)->SetWindowText("修改礼服资料");GetDlgItem(IDC_BUTsave)->Invalidate();
  409. m_bModify=1;
  410. UpdateData(false);
  411. // GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(43));
  412. }
  413. void DressManage::OnBUTreset()
  414. {
  415. // TODO: Add your control notification handler code here
  416. GetDlgItem(IDC_BUTload)->EnableWindow(0);
  417. GetDlgItem(IDC_BUTdel)->EnableWindow(0);
  418. GetDlgItem(IDC_EDITno)->EnableWindow(1);
  419. GetDlgItem(IDC_EDITname)->EnableWindow(1);
  420. // GetDlgItem(IDC_BUTsave)->SetWindowText("添加新礼服");
  421. // GetDlgItem(IDC_BUTsave)->Invalidate();
  422. m_bModify=0;
  423. UpdateData();
  424. m_count = _T("");
  425. m_name = _T("");
  426. m_remark = _T("");
  427. m_no = _T("");
  428. m_price1 = _T("");
  429. m_price2 = _T("");
  430. m_date = g_date;
  431. m_comboarea.SetCurSel (-1);
  432. UpdateData(false);
  433. if(m_pImg)delete m_pImg;m_pImg=NULL;
  434. CRect rc;
  435. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  436. ScreenToClient(rc);
  437. InvalidateRect(rc);
  438. // GetDlgItem(IDC_BUTsave)->EnableWindow(1);
  439. }
  440. extern void SaveImageToFile(Image *img, CString path);
  441. void DressManage::OnBUTload()
  442. {
  443. // TODO: Add your control notification handler code here
  444. if(g_path5.IsEmpty ())
  445. {
  446. AfxMessageBox("未设置礼服图片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  447. return;
  448. }
  449. if(!::CheckFolderFileExist (g_path5))
  450. {
  451. AfxMessageBox("礼服图片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  452. return;
  453. }
  454. CFileDialog fdlg(true, NULL,"", OFN_HIDEREADONLY, "jpg files(*jpg)|*.jpg||");
  455. if(fdlg.DoModal ()!=IDOK)return;
  456. CString path=fdlg.GetPathName();
  457. if(m_pImg)delete m_pImg;m_pImg=NULL;
  458. ::LoadImageFromBuf (&m_pImg, path);
  459. if(m_pImg==NULL)
  460. AfxMessageBox("无效图片文件!");
  461. else
  462. {
  463. CRect rc(0,0,160,160);
  464. RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
  465. Image *pTemp=m_pImg->GetThumbnailImage(rc.Width (), rc.Height (), NULL, NULL);
  466. Graphics graphic(pTemp);
  467. graphic.SetSmoothingMode(SmoothingModeHighQuality);
  468. graphic.DrawImage(m_pImg, 0,0,pTemp->GetWidth(), pTemp->GetHeight() );
  469. CString savepath=g_path5+"\\";
  470. ::SaveImageToFile (pTemp, savepath+"s"+m_no+".jpg");
  471. ::SaveImageToFile (m_pImg, savepath+m_no+".jpg");
  472. delete pTemp;
  473. // CRect rc;
  474. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  475. ScreenToClient(rc);
  476. InvalidateRect(rc);
  477. }
  478. }
  479. void DressManage::OnBUTdel()
  480. {
  481. // TODO: Add your control notification handler code here
  482. CString savepath=g_path5+"\\";
  483. ::DeleteFile (savepath+"s"+m_no+".jpg"); // 删除礼服管理中的s的jpg;
  484. ::DeleteFile (savepath+m_no+".jpg"); // 删除礼服管理中的jpg;
  485. delete m_pImg;m_pImg=NULL;
  486. CRect rc;
  487. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  488. ScreenToClient(rc);
  489. InvalidateRect(rc);
  490. }
  491. void DressManage::OnPaint()
  492. {
  493. CPaintDC dc(this); // device context for painting
  494. // TODO: Add your message handler code here
  495. if(m_pImg)
  496. {
  497. CRect rc;
  498. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  499. ScreenToClient(rc);
  500. RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
  501. Graphics dcgraph(dc.GetSafeHdc());
  502. Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ());
  503. dcgraph.DrawImage(m_pImg, destinationRect, 0,0,m_pImg->GetWidth(), m_pImg->GetHeight(),UnitPixel);
  504. }
  505. // Do not call MyFormView::OnPaint() for painting messages
  506. }
  507. void DressManage::OnBUTgetno()
  508. {
  509. // TODO: Add your control notification handler code here
  510. UpdateData();
  511. if(m_dresstype.IsEmpty ())
  512. {
  513. AfxMessageBox("请先选择礼服类别!");
  514. return;
  515. }
  516. CString strRes1;
  517. ChinesePinYin::GetFirstLetter(m_dresstype, strRes1);
  518. int begin=1;
  519. BOOL bFind=1;
  520. while(bFind)
  521. {
  522. int i = 0;
  523. m_no.Format ("%s%03d", strRes1, begin++);
  524. for( i=0; i< m_List1array.GetSize (); i++)
  525. {
  526. if(m_no==m_List1array.ElementAt (i).ElementAt (1))
  527. {
  528. break;
  529. }
  530. }
  531. if(i==m_List1array.GetSize ())bFind=0;
  532. }
  533. UpdateData(false);
  534. }
  535. void DressManage::OnBUTgetno2()
  536. {
  537. // TODO: Add your control notification handler code here
  538. SPLBDlg dlg;
  539. dlg.m_mode=11;
  540. dlg.DoModal ();
  541. m_comboarea.ResetContent ();
  542. g_sendhead.bsql=0;
  543. g_sendhead.code[0]=190;
  544. g_sendhead.tabcount=1;
  545. g_pMainWnd->ProcessChatMessageRequest2(0);if(g_bSendOK==0)return;
  546. DataToArray(&m_dressareaarray);
  547. for(int i=0; i<m_dressareaarray.GetSize (); i++)
  548. {
  549. m_comboarea.AddString( m_dressareaarray.ElementAt (i).ElementAt (0) );
  550. }
  551. }
  552. void DressManage::OnStatic2()
  553. {
  554. // TODO: Add your control notification handler code here
  555. if(m_pImg)
  556. {
  557. ShowPhoto dlg;
  558. dlg.m_pImg=m_pImg;
  559. dlg.DoModal();
  560. }
  561. }
  562. void DressManage::OnRadio1()
  563. {
  564. // TODO: Add your control notification handler code here
  565. OnRadio2() ;
  566. }
  567. void DressManage::OnRadio2()
  568. {
  569. // TODO: Add your control notification handler code here
  570. UpdateData();
  571. if(m_radio1==0)
  572. {
  573. GetDlgItem(IDC_STATIC3)->SetWindowText("礼服类别");
  574. GetDlgItem(IDC_STATIC4)->SetWindowText("添加礼服");
  575. GetDlgItem(IDC_STATIC5)->SetWindowText("全部礼服");
  576. GetDlgItem(IDC_STATIC6)->SetWindowText("*礼服类别:");
  577. GetDlgItem(IDC_STATIC7)->SetWindowText("*礼服编号:");
  578. GetDlgItem(IDC_STATIC8)->SetWindowText("*礼服名称:");
  579. GetDlgItem(IDC_STATIC9)->SetWindowText("*礼服件数:");
  580. }
  581. else
  582. {
  583. GetDlgItem(IDC_STATIC3)->SetWindowText("其它类别");
  584. GetDlgItem(IDC_STATIC4)->SetWindowText("添加");
  585. GetDlgItem(IDC_STATIC5)->SetWindowText("全部");
  586. GetDlgItem(IDC_STATIC6)->SetWindowText("*类别:");
  587. GetDlgItem(IDC_STATIC7)->SetWindowText("*编号:");
  588. GetDlgItem(IDC_STATIC8)->SetWindowText("*名称:");
  589. GetDlgItem(IDC_STATIC9)->SetWindowText("*数量:");
  590. }
  591. TypeChange();TypeChange2();
  592. }
  593. void DressManage::TypeChange()
  594. {
  595. UpdateData();
  596. m_List1.ResetContent ();
  597. for(int i=0; i<m_typearray.GetSize (); i++)
  598. {
  599. if(m_radio1!=atoi(m_typearray.ElementAt (i).ElementAt (1)))continue;
  600. if(m_List1.GetCount()%2)
  601. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol1, m_List1.GetCount());
  602. else
  603. m_List1.AddEntry( m_typearray.ElementAt (i).ElementAt (0) , g_gridcol2, m_List1.GetCount());
  604. }
  605. m_List1.Invalidate ();
  606. }
  607. void DressManage::TypeChange2()
  608. {
  609. UpdateData();
  610. m_List2.ResetContent ();
  611. for(int i=0; i<m_List1array.GetSize (); i++)
  612. {
  613. if(m_radio1!=atoi(m_List1array.ElementAt (i).ElementAt (12)))continue;
  614. if(m_List2.GetCount()%2)
  615. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol1, m_List2.GetCount());
  616. else
  617. m_List2.AddEntry( m_List1array.ElementAt (i).ElementAt (2) , g_gridcol2, m_List2.GetCount());
  618. }
  619. m_List2.Invalidate ();
  620. }