| | |
| | | using DAL; |
| | | using Microsoft.AspNet.SignalR; |
| | | using Model; |
| | | using SQLHelper; |
| | | using System; |
| | |
| | | { |
| | | private JsonResult objJsonResult = new JsonResult(); |
| | | private json objjson = new json(); |
| | | // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); |
| | | // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); |
| | | public string sWhere = ""; |
| | | public WebServer webserver = new WebServer(); |
| | | public DataSet ds = new DataSet(); |
| | |
| | | public static bool Add_Log(string WorkList, string CurUserName, string State) |
| | | { |
| | | |
| | | DBUtility.ClsPub.SetIPAddress(); |
| | | string IPAddress; |
| | | string ComputerName; |
| | | IPAddress = DBUtility.ClsPub.IPAddress; |
| | | ComputerName = DBUtility.ClsPub.ComputerName; |
| | | ClsCNSRM oCnLoc = new ClsCNSRM(); |
| | | try |
| | | { |
| | | oCnLoc.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + |
| | | "(getdate(),'" + CurUserName + "','" + ComputerName + "','" + WorkList + "','SRM系统','" + IPAddress + "','" + State + "')" |
| | | ); |
| | | DBUtility.ClsPub.SetIPAddress(); |
| | | string IPAddress; |
| | | string ComputerName; |
| | | IPAddress = DBUtility.ClsPub.IPAddress; |
| | | ComputerName = DBUtility.ClsPub.ComputerName; |
| | | ClsCNSRM oCnLoc = new ClsCNSRM(); |
| | | try |
| | | { |
| | | oCnLoc.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + |
| | | "(getdate(),'" + CurUserName + "','" + ComputerName + "','" + WorkList + "','SRM系统','" + IPAddress + "','" + State + "')" |
| | | ); |
| | | |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return false; |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception) |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "登录异常!"; |
| | | objJsonResult.Message = "登录异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 触发hub的api |
| | | /// </summary> |
| | | /// <param name="request">request</param> |
| | | /// <returns>message</returns> |
| | | [AllowAnonymous] |
| | | [Route("show/hub"), HttpGet] |
| | | public HttpResponseMessage GetMessage(HttpRequestMessage request) |
| | | { |
| | | var hub = GlobalHost.ConnectionManager.GetHubContext<MyHub>(); |
| | | //注意这里的showMessage 就是对RepairHub下定义的showMessage方法调用,同样前端也是调用这个方法 |
| | | string aa = hub.Clients.All.showMessage("这里面可以放入任意对象,前台可以收到此内容"); |
| | | return request.CreateResponse(HttpStatusCode.OK, aa); |
| | | } |
| | | |
| | | [Route("Message/MsgCount")] |
| | | [HttpPost] |
| | | public object MsgCount() |
| | | { |
| | | ClsCNSRM oCn = new ClsCNSRM(); |
| | | DataSet oDs = new DataSet(); |
| | | oDs = oCn.RunProcReturn("select * from Gy_Message", "Gy_Message"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "返回数据"; |
| | | objJsonResult.data = oDs; |
| | | return objJsonResult; ; |
| | | } |
| | | |
| | | } |
| | | } |