public static wsConnManager Start(string programId) { wsConnManager wsConn = new wsConnManager(); wsConn.ProgramID = programId; try { //Api.ApiConnController apiConnController = new Api.ApiConnController(); //ApiConnStartDto apiConnInsertDto = new ApiConnStartDto(); //apiConnInsertDto.ProgramId = programId; //apiConnInsertDto.StartTime = DateTime.Now; //apiConnInsertDto.DeviceTypeId = Enums.DeviceTypes.Pc; //Response response = apiConnController.Start(apiConnInsertDto); //wsConn.ConnDbId = response.ReturnedId.Value; } catch (Exception ex) { } ConnList.Add(wsConn); return(wsConn); }
public static wsConnManager Get(string programId) { if (ConnList == null || ConnList.Count == 0) { return(null); } wsConnManager t_conn = ConnList.Where(x => x.ProgramID == programId).FirstOrDefault(); return(t_conn); }
public static void Close(string programId, string reason, bool wasClean, ushort code) { wsConnManager wsConn = Get(programId); ConnList.RemoveAll(x => x.ProgramID == programId); try { //ApiConnCloseDto apiConnCloseDto = new ApiConnCloseDto(); //apiConnCloseDto.Id = wsConn.ConnDbId; //apiConnCloseDto.ApiConnCloseReasonId = (Enums.ApiConnCloseReasons)code; //apiConnCloseDto.CloseReason = reason; //apiConnCloseDto.CloseWasClean = wasClean; //Api.ApiConnController controller = new Api.ApiConnController(); //controller.Close(apiConnCloseDto); } catch (Exception ex) { } //SessionManager.SessionList.RemoveAll(x => x.ProgramID == ID); }