Просмотр исходного кода

设置中心跟数据库的联动处理好了

zhangyang 6 лет назад
Родитель
Сommit
75b6352e10

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


BIN
bin/Win32/Debug/zhipuzi_pos_windows_server/zhipuzi_pos_windows_server.exe


+ 179 - 169
lewaimai_dispatch/wnd/CMainWnd.cpp

@@ -30,10 +30,14 @@ LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl
     m_pm.AttachDialog(pRoot);
     m_pm.AddNotifier(this);
 
+    Init();
+
     OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
     orderlist->Refresh();
 
-    Init();
+    //初始化设置中心的状态
+    InitSettingStatus();
+
     return 0;
 }
 
@@ -401,15 +405,16 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
     else if(name == _T("setting_is_new_waimai_voice"))
     {
         CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_voice")));
-
+		
+		//注意这里的IsSelected如果为true,表示的是点击前为true,而不是点击后为true,所以这里设置状态要反过来
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_new_waimai_voice", "1");
+            CSetting::SetParam("setting_is_new_waimai_voice", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_new_waimai_voice", "0");
+            CSetting::SetParam("setting_is_new_waimai_voice", "1");
         }
     }
 
@@ -419,12 +424,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_new_waimai_autoconfirm", "1");
+            CSetting::SetParam("setting_is_new_waimai_autoconfirm", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_new_waimai_autoconfirm", "0");
+            CSetting::SetParam("setting_is_new_waimai_autoconfirm", "1");
         }
     }
 
@@ -434,12 +439,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_new_waimai_dialog", "1");
+            CSetting::SetParam("setting_is_new_waimai_dialog", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_new_waimai_dialog", "0");
+            CSetting::SetParam("setting_is_new_waimai_dialog", "1");
         }
     }
 
@@ -449,12 +454,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_new_waimai_printer", "1");
+            CSetting::SetParam("setting_is_new_waimai_printer", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_new_waimai_printer", "0");
+            CSetting::SetParam("setting_is_new_waimai_printer", "1");
         }
     }
 
@@ -464,12 +469,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_new_waimai_chufang_printer", "1");
+            CSetting::SetParam("setting_is_new_waimai_chufang_printer", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_new_waimai_chufang_printer", "0");
+            CSetting::SetParam("setting_is_new_waimai_chufang_printer", "1");
         }
     }
 
@@ -479,12 +484,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_auto_start", "1");
+            CSetting::SetParam("setting_is_auto_start", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_auto_start", "0");
+            CSetting::SetParam("setting_is_auto_start", "1");
         }
     }
 
@@ -494,12 +499,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_auto_login", "1");
+            CSetting::SetParam("setting_is_auto_login", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_auto_login", "0");
+            CSetting::SetParam("setting_is_auto_login", "1");
         }
     }
 
@@ -509,12 +514,12 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 
         if(box->IsSelected())
         {
-            CSetting::SetParam("setting_is_close_min", "1");
+            CSetting::SetParam("setting_is_close_min", "0");
         }
 
         else
         {
-            CSetting::SetParam("setting_is_close_min", "0");
+            CSetting::SetParam("setting_is_close_min", "1");
         }
     }
 }
@@ -605,40 +610,30 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
     {
         CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
         pControl->SelectItem(0);
-
-		InitSettingStatus();
     }
 
     else if(name == _T("setting_printer_switch"))
     {
         CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
         pControl->SelectItem(1);
-
-		InitSettingStatus();
     }
 
     else if(name == _T("setting_chufang_printer_switch"))
     {
         CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
         pControl->SelectItem(2);
-
-		InitSettingStatus();
     }
 
     else if(name == _T("setting_system_switch"))
     {
         CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
         pControl->SelectItem(3);
-
-		InitSettingStatus();
     }
 
     else if(name == _T("setting_system_update"))
     {
         CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
         pControl->SelectItem(4);
-
-		InitSettingStatus();
     }
 }
 
@@ -943,146 +938,161 @@ LRESULT CMainWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHa
 
 void CMainWnd::InitSettingStatus()
 {
-	CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("setting_switch")));
-	int sel = pControl->GetCurSel();
-
-	CCheckBoxUI* box = NULL;
-	CComboUI* com = NULL;
-
-	if (sel == 0)
-	{
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_voice")));
-		if (CSetting::GetParam("setting_is_new_waimai_voice") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_autoconfirm")));
-		if (CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_dialog")));
-		if (CSetting::GetParam("setting_is_new_waimai_dialog") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-	}
-	else if (sel == 1)
-	{
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_printer")));
-		if (CSetting::GetParam("setting_is_new_waimai_printer") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-
-		com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_printer_guige")));
-		if (CSetting::GetParam("setting_printer_guige") == "58")
-		{
-			com->SelectItem(0, false, false);
-			com->SetText(L"58mm");
-		}
-		else
-		{
-			com->SelectItem(1, false, false);
-			com->SetText(L"80mm");
-		}
-
-		com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_printer_lianshu")));
-		std::string setting_printer_lianshu = CSetting::GetParam("setting_printer_lianshu");
-		if (setting_printer_lianshu == "1")
-		{
-			com->SelectItem(0, false, false);
-			com->SetText(L"1联");
-		}
-		else if (setting_printer_lianshu == "2")
-		{
-			com->SelectItem(1, false, false);
-			com->SetText(L"2联");
-		}
-		else if (setting_printer_lianshu == "3")
-		{
-			com->SelectItem(2, false, false);
-			com->SetText(L"3联");
-		}
-		else if (setting_printer_lianshu == "4")
-		{
-			com->SelectItem(3, false, false);
-			com->SetText(L"4联");
-		}
-	}
-	else if (sel == 2)
-	{
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_chufang_printer")));
-		if (CSetting::GetParam("setting_is_new_waimai_chufang_printer") == "1")
-		{
-			box->Selected(true, false);
-			com->SetText(L"58mm");
-		}
-		else
-		{
-			box->Selected(false, false);
-			com->SetText(L"80mm");
-		}
-
-		com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_chufang_printer_guige")));
-		if (CSetting::GetParam("setting_chufang_printer_guige") == "58")
-		{
-			com->SelectItem(0, false, false);
-		}
-		else
-		{
-			com->SelectItem(1, false, false);
-		}
-	}
-	else if (sel == 3)
-	{
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_start")));
-		if (CSetting::GetParam("setting_is_auto_start") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_login")));
-		if (CSetting::GetParam("setting_is_auto_login") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-
-		box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_close_min")));
-		if (CSetting::GetParam("setting_is_close_min") == "1")
-		{
-			box->Selected(true, false);
-		}
-		else
-		{
-			box->Selected(false, false);
-		}
-	}
+    CCheckBoxUI* box = NULL;
+    CComboUI* com = NULL;
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_voice")));
+
+    if(CSetting::GetParam("setting_is_new_waimai_voice") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_autoconfirm")));
+
+    if(CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_dialog")));
+
+    if(CSetting::GetParam("setting_is_new_waimai_dialog") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_printer")));
+
+    if(CSetting::GetParam("setting_is_new_waimai_printer") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_printer_guige")));
+    if(CSetting::GetParam("setting_printer_guige") == "58")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(0, false, false);
+    }
+
+    else
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(1, false, false);
+    }
+
+    com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_printer_lianshu")));
+    std::string setting_printer_lianshu = CSetting::GetParam("setting_printer_lianshu");
+
+    if(setting_printer_lianshu == "1")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(0, false, false);
+        com->SetText(L"1联");
+    }
+
+    else if(setting_printer_lianshu == "2")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(1, false, false);
+        com->SetText(L"2联");
+    }
+
+    else if(setting_printer_lianshu == "3")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(2, false, false);
+        com->SetText(L"3联");
+    }
+
+    else if(setting_printer_lianshu == "4")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(3, false, false);
+        com->SetText(L"4联");
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_chufang_printer")));
+
+    if(CSetting::GetParam("setting_is_new_waimai_chufang_printer") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_chufang_printer_guige")));
+
+    if(CSetting::GetParam("setting_chufang_printer_guige") == "58")
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(0, false, false);
+    }
+
+    else
+    {
+		com->SetInternVisible(true);
+        com->SelectItem(1, false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_start")));
+
+    if(CSetting::GetParam("setting_is_auto_start") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_login")));
+
+    if(CSetting::GetParam("setting_is_auto_login") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
+
+    box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_close_min")));
+
+    if(CSetting::GetParam("setting_is_close_min") == "1")
+    {
+        box->Selected(true, false);
+    }
+
+    else
+    {
+        box->Selected(false, false);
+    }
 }