前一篇介紹手持設備開發基本步驟。在CE客戶端,咱們一般用vs2008 c#客戶端,c#
後端有用socket調用存儲過程,也有經過http請求的,前篇也有介紹了。一個請求後端
HttpUtil 類。這回合來看看。服務端若是來實現。cookie
LoginControllersocket
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;spa
using Basic.Enum;
using Basic.Utility;
using Sys.Services;
using Basic.ModelBinders;
using Basic.DomainModel; code
namespace PDA.Controllers
{
public class LoginController : Controller
{
public ActionResult LoginOut()
{
HttpCookie cookie = Response.Cookies[FormsAuthentication.FormsCookieName];
cookie.Value = null;
cookie.Domain = Globals.RootDomain;
cookie.Expires = new DateTime(1980, 10, 12);
FormsAuthentication.SignOut();
return null;
}orm
public ActionResult Menu()
{
return View();
}圖片
[HttpPost]
public int LoginPDA()
{
string userName = Request.Params["userName"];
string password = Request.Params["password"];
ISys_UserService service = UnityHelper.GetInstance<ISys_UserService>;
int result = service.UserLogin(userName, password);
return result;
}開發
}
}string
來張圖片):
using System.Collections.Generic;
using System.Web.Mvc;
using Basic.Enum;
using Basic.Utility;
using PDA.DomainModel;
using PDA.Services;
namespace PDA.Controllers
{
public class StockController : Controller
{
private static readonly IStockService service = UnityHelper.GetInstance<IStoreService>;
[HttpPost]
public JsonResult GetAddre(string addrecode)
{
IList<Stock_AddreModel> model = service.GetAddre(addrecode);
return Json(model);
}
[HttpPost]
public JsonResult GetAllAddre()
{
IList<Stock_AddreModel> ilist = service.GetAllAddre();
return Json(ilist);
}
[HttpPost]
public JsonResult GetPo(string pocode)
{
IList<Wms_Po_OrderModel> model = service.GetPo(pocode);
return Json(model);
}
[HttpPost]
public JsonResult GetAllPo()
{
IList<Wms_Po_OrderModel> ilist = service.GetAllPo();
return Json(ilist);
}
}
}