public static CashIn convertToCashIn(WFSCIMCASHIN item) { CashIn unit = new CashIn(); unit.usNumber = item.usNumber; unit.fwType = item.fwType; unit.cUnitID = item.cUnitID; unit.cCurrencyID = item.cCurrencyID; unit.ulValues = item.ulValues; unit.ulCashInCount = item.ulCashInCount; unit.ulCount = item.ulCount; unit.ulMaximum = item.ulMaximum; unit.usStatus = item.usStatus; unit.bAppLock = item.bAppLock; unit.usNumPhysicalCUs = item.usNumPhysicalCUs; if (item.usNumPhysicalCUs > 0) { unit.lppPhysical = XFSUtil.XFSPtrToArray <WFSCIMPHCU>(item.lppPhysical, item.usNumPhysicalCUs); } else { unit.lppPhysical = new WFSCIMPHCU[0]; } var notnumberList = new WFSCIMNOTENUMBERLIST(); XFSUtil.PtrToStructure <WFSCIMNOTENUMBERLIST>(item.lpNoteNumberList, ref notnumberList); unit.lpNoteNumberList = convertToNoteNumberList(notnumberList); unit.lpszExtra = item.lpszExtra; return(unit); }
public static CashUnit convertToCashUnit(WFSCDMCASHUNIT item) { CashUnit unit = new CashUnit(); unit.bAppLock = item.bAppLock; unit.cCurrencyID = item.cCurrencyID; unit.cUnitID = item.cUnitID; unit.szCashUnitName = item.szCashUnitName; unit.ulCount = item.ulCount; unit.ulInitialCount = item.ulInitialCount; unit.ulMaximum = item.ulMaximum; unit.ulMinimum = item.ulMinimum; unit.ulRejectCount = item.ulRejectCount; unit.ulValues = item.ulValues; unit.usNumber = item.usNumber; unit.usNumPhysicalCUs = item.usNumPhysicalCUs; unit.usStatus = item.usStatus; unit.usType = item.usType; if (item.usNumPhysicalCUs > 0) { unit.PhysicalCashUnits = XFSUtil.XFSPtrToArray <WFSCDMPHCU>(item.lppPhysical, item.usNumPhysicalCUs); } else { unit.PhysicalCashUnits = new WFSCDMPHCU[0]; } return(unit); }
public static NoteNumberList convertToNoteNumberList(WFSCIMNOTENUMBERLIST item) { NoteNumberList noteNumberList = new NoteNumberList(); noteNumberList.usNumOfNoteNumbers = item.usNumOfNoteNumbers; if (item.usNumOfNoteNumbers > 0) { noteNumberList.lppNoteNumber = XFSUtil.XFSPtrToArray <WFSCIMNOTENUMBER>(item.lppNoteNumber, item.usNumOfNoteNumbers); } else { noteNumberList.lppNoteNumber = new WFSCIMNOTENUMBER[0]; } return(noteNumberList); }
protected override void OnExecuteComplete(ref WFSRESULT result) { switch (result.dwCommandCodeOrEventID) { case IDCDefinition.WFS_CMD_IDC_READ_RAW_DATA: if (result.hResult == XFSDefinition.WFS_SUCCESS) { WFSIDCCardData[] data = XFSUtil.XFSPtrToArray <WFSIDCCardData>(result.lpBuffer); IDCCardData[] outerData = new IDCCardData[data.Length]; for (int i = 0; i < data.Length; ++i) { outerData[i] = new IDCCardData(); outerData[i].DataSource = data[i].wDataSource; outerData[i].WriteMethod = data[i].fwWriteMethod; outerData[i].Status = data[i].wStatus; if (data[i].ulDataLength > 0) { outerData[i].Data = new byte[data[i].ulDataLength]; for (int j = 0; j < data[i].ulDataLength; ++j) { outerData[i].Data[j] = Marshal.ReadByte(data[i].lpbData, j); } } } OnReadRawDataComplete(outerData); } else { OnReadRawDataError(result.hResult); } break; case IDCDefinition.WFS_CMD_IDC_EJECT_CARD: if (result.hResult == XFSDefinition.WFS_SUCCESS) { OnEjectComplete(); } else { OnEjectError(result.hResult); } break; } }
public ISTATUS UnMarshal(IntPtr pointer) { var cashinfoObj = new CimCashInfoObject(); var cashunitInfo = new WFSCIMCASHINFO(); XFSUtil.PtrToStructure <WFSCIMCASHINFO>(pointer, ref cashunitInfo); cashinfoObj.usCount = cashunitInfo.usCount; var cashUnits = XFSUtil.XFSPtrToArray <WFSCIMCASHIN>(cashunitInfo.lppCashIn, cashunitInfo.usCount); cashinfoObj.CashIns = new CashIn[cashUnits.Length]; for (int i = 0; i < cashUnits.Length; i++) { cashinfoObj.CashIns[i] = CashIn.convertToCashIn(cashUnits[i]); } return(cashinfoObj); }
protected IDCCardData[] OnReadRawDataComplete(IntPtr ptr) { WFSIDCCardData[] data = XFSUtil.XFSPtrToArray <WFSIDCCardData>(ptr); IDCCardData[] outerData = new IDCCardData[data.Length]; for (int i = 0; i < data.Length; ++i) { outerData[i] = new IDCCardData(); outerData[i].DataSource = data[i].wDataSource; outerData[i].WriteMethod = data[i].fwWriteMethod; outerData[i].Status = data[i].wStatus; if (data[i].ulDataLength > 0) { outerData[i].Data = new byte[data[i].ulDataLength]; for (int j = 0; j < data[i].ulDataLength; ++j) { outerData[i].Data[j] = Marshal.ReadByte(data[i].lpbData, j); } } } return(outerData); }
public ISTATUS UnMarshal(IntPtr pointer) { var cashinfoObj = new CashInfoObject(); var cashunitInfo = new WFS_CDM_CashUnit_INFO(); XFSUtil.PtrToStructure <WFS_CDM_CashUnit_INFO>(pointer, ref cashunitInfo); cashinfoObj.TellerID = cashunitInfo.usTellerID; cashinfoObj.usCount = cashunitInfo.usCount; var cashUnits = XFSUtil.XFSPtrToArray <WFSCDMCASHUNIT>(cashunitInfo.lppList, cashunitInfo.usCount); cashinfoObj.CashUnits = new CashUnit[cashUnits.Length]; for (int i = 0; i < cashUnits.Length; i++) { cashinfoObj.CashUnits[i] = CashUnit.convertToCashUnit(cashUnits[i]); } return(cashinfoObj); }
private void XFSDevice_ExecuteComplete(ServiceTypes serviceType, IntPtr obj, int EventID) { try { lock (syncObject) { if (obj == IntPtr.Zero) { XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.IsExecuteSuccessfully = true; XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.Detail = "XFSDevice_ExecuteComplete"; var XfsCommand = (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand); if (XfsCommand != null && XfsCommand.LightControlCommand != null) { ExcuteSiuCommand(XfsCommand.LightControlCommand.CompleteSIU, serviceType); } SendResponse(XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand); return; } else { XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.IsExecuteSuccessfully = true; #region old //switch (EventID) //{ // case IDCDefinition.WFS_CMD_IDC_READ_RAW_DATA: // { // //(CurrentCommand.XfsCommand as ExecuteCommand).Result = Activator.CreateInstance((CurrentCommand.XfsCommand as ExecuteCommand).ResultType); // var resobj = OnReadRawDataComplete(obj); // if(resobj.Length==0) // { // XFSDevice_ExecuteError(serviceType, "", -500, "-500"); // return; // } // (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand).ResultModel = resobj; // break; // } // default: // { // break; // } //} #endregion XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.Detail = "XFSDevice_ExecuteComplete"; var XfsCommand = (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand); if ((XfsCommand.ResultXfs.GetType().Name.Equals("JArray"))) { int len = 0; var data = XFSUtil.XFSPtrToArray(obj, XfsCommand.ResultXfsType, ref len); var model = Array.CreateInstance(XfsCommand.ResultModelType, len); for (int i = 0; i < len; ++i) { var tmp = (IXfsResultModel)Activator.CreateInstance(XfsCommand.ResultModelType); tmp.Fill(data.GetValue(i)); model.SetValue(tmp, i); } XfsCommand.ResultModel = model; } else { object data = null; XFSUtil.PtrToStructure(obj, XfsCommand.ResultXfsType, ref data); var model = (IXfsResultModel)Activator.CreateInstance(XfsCommand.ResultModelType); model.Fill(data); XfsCommand.ResultModel = model; } if (XfsCommand != null && XfsCommand.LightControlCommand != null) { ExcuteSiuCommand(XfsCommand.LightControlCommand.CompleteSIU, serviceType); } SendResponse(XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand); } } } catch (Exception ex) { L4Logger.Error(ex); } }