public void GetResv() { AjaxRes ajaxRes = new AjaxRes(); RESVREQ vrGet = new RESVREQ(); vrGet.dwCheckStat = (uint)UNIRESERVE.DWSTATUS.RESVSTAT_DOING; vrGet.dwClassKind = (uint)UNIDEVCLS.DWKIND.CLSKIND_SEAT; m_Request.m_UniDCom.SessionID = (uint)Session["sessionid"]; UNIRESERVE[] vtRes; REQUESTCODE uResponse = m_Request.Reserve.Get(vrGet, out vtRes); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { ajaxRes.nStatus = (int)AjaxRes.Status.SUCCESS; ajaxRes.total = vtRes.Length.ToString(); ajaxRes.rows = vtRes; } else { ajaxRes.nStatus = (int)AjaxRes.Status.ERROR; ajaxRes.szError = m_Request.szErrMessage; } string szRes = JsonConvert.SerializeObject(ajaxRes); Response.Write(szRes); Response.End(); }
protected void SacnLogin() { AjaxRes ajaxRes = new AjaxRes(); ajaxRes.nStatus = (int)AjaxRes.Status.ERROR; string szLogonName = Request["logonName"]; string szPassword = Request["password"]; string szMsn = Request["msn"]; ADMINLOGINREQ vrLogin = new ADMINLOGINREQ(); ADMINLOGINRES vrLoginRes; vrLogin.szLogonName = szLogonName; if (!string.IsNullOrEmpty(szPassword)) { vrLogin.szPassword = "******" + szPassword; } vrLogin.szIP = GetRealIP(); if (!string.IsNullOrEmpty(szMsn)) { vrLogin.szMSN = szMsn; } m_Request.m_UniDCom.StaSN = 1; vrLogin.dwLoginRole = (uint)ADMINLOGINREQ.DWLOGINROLE.LOGIN_USER | (uint)ADMINLOGINREQ.DWLOGINROLE.LOGINEXT_HP; vrLogin.szVersion = ((uint)ADMINLOGINREQ.SZVERSION.INTVER_MAIN).ToString() + "." + ((uint)ADMINLOGINREQ.SZVERSION.INTVER_RELEASE).ToString("00") + "." + ((uint)ADMINLOGINREQ.SZVERSION.INTVER_INTERNAL).ToString(); vrLogin.szIP = GetRealIP(); vrLogin.dwStaSN = 1; m_Request.m_UniDCom.StaSN = 1; m_Request.m_UniDCom.SessionID = 0; if (!(vrLogin.szLogonName == null && vrLogin.szMSN == "abc123")) { REQUESTCODE uResponse = m_Request.Admin.StaLogin(vrLogin, out vrLoginRes); if (uResponse == REQUESTCODE.ERR_MSN_NOBIND) { ajaxRes.nStatus = (int)AjaxRes.Status.ERROR; ajaxRes.szError = "该微信号未绑定账号"; } else if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { Session["sessionid"] = m_Request.m_UniDCom.SessionID; ajaxRes.nStatus = (int)AjaxRes.Status.SUCCESS; } } string szRes = JsonConvert.SerializeObject(ajaxRes); Response.Write(szRes); Response.End(); }
public JsonResult AddUser(UserViewModel usr) { AjaxRes result = new AjaxRes(); if (!ModelState.IsValid) { string errorMessages = ""; foreach (var item in ModelState.Values) { foreach (var er in item.Errors) { errorMessages += er.ErrorMessage + "\r\n"; } } result.Result = 0; result.Message = errorMessages; return(Json(result)); //return new JsonResult { Data = new { Result = 0, Message = "model valid değil" } }; } User userEntity = JsonConvert.DeserializeObject <User>(JsonConvert.SerializeObject(usr)); userEntity.UserType = 0; _userRepository.Add(userEntity); result.Result = 1; result.Message = "işlem başarılı"; var usrlist = _userRepository.List().OrderByDescending(c => c.Id).ToList(); return(Json(result)); //return new JsonResult { Data = new { Result = 1, Message = "işlem başarılı" } }; }