public CustomerInfo GetCustomerInfoByPhone(string telephone) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.TELEPHONE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CUSTOMERINFOBYPHONE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //telephone byte[] tempByte = Encoding.UTF8.GetBytes(telephone); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.TELEPHONE; Int32 operCode = 0; CustomerInfo customerInfo = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); customerInfo = JsonConvert.DeserializeObject <CustomerInfo>(strReceive); } socket.Close(); } return(customerInfo); }
/// <summary> /// 获取热销产品列表 /// </summary> /// <param name="telephone">电话号码</param> /// <returns></returns> public IList <TopSellGoods> GetTopSellGoods(string telephone) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.TELEPHONE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_TOPSELLGOODS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //telephone byte[] tempByte = Encoding.UTF8.GetBytes(telephone); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.TELEPHONE; IList <TopSellGoods> topSellGoodsList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); topSellGoodsList = JsonConvert.DeserializeObject <IList <TopSellGoods> >(strReceive); } socket.Close(); } return(topSellGoodsList); }
/// <summary> /// 获取交班记录 /// </summary> /// <param name="dailyStatementNo">日结号</param> /// <returns></returns> public IList <EmployeeHandoverRecord> GetHandoverRecord(string dailyStatementNo) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DAILY_STATEMENT_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_HANDOVER_RECORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //dailyStatementNo byte[] tempByte = Encoding.UTF8.GetBytes(dailyStatementNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DAILY_STATEMENT_NO; Int32 operCode = 0; IList <EmployeeHandoverRecord> handoverRecordList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); handoverRecordList = JsonConvert.DeserializeObject <IList <EmployeeHandoverRecord> >(strReceive); } socket.Close(); } return(handoverRecordList); }
public Shop GetCurrentShop(string ipAddress, int port) { const int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SHOP), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Shop currentShop = null; using (SocketClient socket = new SocketClient(ipAddress, port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); currentShop = JsonConvert.DeserializeObject <Shop>(strReceive); } socket.Close(); } return(currentShop); }
/// <summary> /// 获取日结营业额统计 /// </summary> /// <param name="dailyStatementNo">日结号</param> /// <returns></returns> public BusinessReport GetReportDataByDailyStatement(string dailyStatementNo) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DAILY_STATEMENT_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_REPORTDATABYDAILYSTATEMENT), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //dailyStatementNo byte[] tempByte = Encoding.UTF8.GetBytes(dailyStatementNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DAILY_STATEMENT_NO; BusinessReport bizReport = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); bizReport = JsonConvert.DeserializeObject <BusinessReport>(strReceive); } socket.Close(); } return(bizReport); }
public Int32 UpdateSalesOrder(SalesOrder salesOrder) { string json = JsonConvert.SerializeObject(salesOrder); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_SALESORDER), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return result; }
public Int32 UpdateSalesOrder(SalesOrder salesOrder) { string json = JsonConvert.SerializeObject(salesOrder); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_SALESORDER), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return(result); }
/// <summary> /// 获取最近一个月特定状态通话记录 /// </summary> /// <returns></returns> public IList <CallRecord> GetCallRecordByStatus(int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CALLRECORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); IList <CallRecord> callRecordList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); callRecordList = JsonConvert.DeserializeObject <IList <CallRecord> >(strReceive); } socket.Close(); } return(callRecordList); }
public IList <GoodsCheckStock> GetGoodsCheckStock() { const int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_GOODSCHECKSTOCK), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; IList <GoodsCheckStock> goodsCheckStockList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); goodsCheckStockList = JsonConvert.DeserializeObject <IList <GoodsCheckStock> >(strReceive); } socket.Close(); } return(goodsCheckStockList); }
public BusinessReport GetReportDataByHandoverRecordId(Guid handoverRecordId) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.HANDOVER_RECORD_ID; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_REPORTDATABYHANDOVERRECORDID), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //handoverRecordID byte[] tempByte = Encoding.UTF8.GetBytes(handoverRecordId.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.HANDOVER_RECORD_ID; BusinessReport bizReport = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); bizReport = JsonConvert.DeserializeObject<BusinessReport>(strReceive); } socket.Close(); } return bizReport; }
/// <summary> /// 日结操作 /// </summary> /// <param name="dailyBalance">日结号</param> /// <param name="unCheckDeviceNo">未结账的设备号</param> /// <returns></returns> public Int32 CreateDailyBalance(DailyBalance dailyBalance, out string unCheckDeviceNo) { string json = JsonConvert.SerializeObject(dailyBalance); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_CREATE_DAILYBALANCE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; int result = 0; unCheckDeviceNo = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); unCheckDeviceNo = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32, receiveData.Length - ParamFieldLength.PACKAGE_HEAD - BasicTypeLength.INT32).Trim('\0'); } socket.Close(); } return(result); }
public BizDesk GetBizDeskByName(string deskName) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DESK_NAME; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DESKBYNAME), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //deskName byte[] tempByte = Encoding.UTF8.GetBytes(deskName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DESK_NAME; BizDesk desk = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); desk = JsonConvert.DeserializeObject <BizDesk>(strReceive); } socket.Close(); } return(desk); }
public decimal GetLastCustomPrice(Guid goodsID) { byte[] bufferByte = Encoding.UTF8.GetBytes(goodsID.ToString()); int cByte = ParamFieldLength.PACKAGE_HEAD + bufferByte.Length; byte[] sendByte = new byte[cByte]; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_LASTCUSTOMPRICE), sendByte, BasicTypeLength.INT32); int byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(bufferByte, 0, sendByte, byteOffset, bufferByte.Length); byteOffset += bufferByte.Length; double result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToDouble(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return((decimal)result); }
/// <summary> /// 根据所属日期获取营业时间段 /// </summary> /// <param name="belongToDate">所属日期</param> /// <returns></returns> public IList <DailyBalanceTime> GetDailyBalanceTime(DateTime belongToDate) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DAILYBALANCETIME), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //belongToDate byte[] tempByte = Encoding.UTF8.GetBytes(belongToDate.ToString("yyyy-MM-dd")); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; Int32 operCode = 0; IList <DailyBalanceTime> dailyBalanceTimeList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); dailyBalanceTimeList = JsonConvert.DeserializeObject <IList <DailyBalanceTime> >(strReceive); } socket.Close(); } return(dailyBalanceTimeList); }
/// <summary> /// 获取交班记录 /// </summary> /// <param name="dailyStatementNo">日结号</param> /// <returns></returns> public IList<EmployeeHandoverRecord> GetHandoverRecord(string dailyStatementNo) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DAILY_STATEMENT_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_HANDOVER_RECORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //dailyStatementNo byte[] tempByte = Encoding.UTF8.GetBytes(dailyStatementNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DAILY_STATEMENT_NO; Int32 operCode = 0; IList<EmployeeHandoverRecord> handoverRecordList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); handoverRecordList = JsonConvert.DeserializeObject<IList<EmployeeHandoverRecord>>(strReceive); } socket.Close(); } return handoverRecordList; }
public Int32 AddVIPCardStoredValue(VIPCardAddMoney cardAddMoney, out string tradePayNo) { string json = JsonConvert.SerializeObject(cardAddMoney); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_ADD_CARDSTOREDVALUE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; int result = 0; tradePayNo = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); tradePayNo = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32, receiveData.Length - ParamFieldLength.PACKAGE_HEAD - BasicTypeLength.INT32).Trim('\0'); } socket.Close(); } return(result); }
public bool CreateHandover(HandoverInfo handover) { string json = JsonConvert.SerializeObject(handover); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_CREATE_HANDOVER), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return(result); }
public SysBasicData GetSysBasicData() { int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SYSBASICDATA), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; SysBasicData sysBasicData = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); sysBasicData = JsonConvert.DeserializeObject <SysBasicData>(strReceive); } socket.Close(); } return(sysBasicData); }
public string GetDailyStatementTimeInterval() { int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DAILYTIMEINTERVAL), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; string dailyTimeInterval = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { dailyTimeInterval = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); } socket.Close(); } return(dailyTimeInterval); }
public IList <DeskRealTimeInfo> GetDeskRealTimeInfo(string regionID) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.REGION_ID; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DESKREALTIMEINFO), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //regionID byte[] tempByte = Encoding.UTF8.GetBytes(regionID); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.REGION_ID; IList <DeskRealTimeInfo> deskInfoList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); deskInfoList = JsonConvert.DeserializeObject <IList <DeskRealTimeInfo> >(strReceive); } socket.Close(); } return(deskInfoList); }
public Int32 CheckLastDailyStatement(int breakDays) { int cByte = ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_CHECK_LASTDAILYSTATEMENT), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(breakDays), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return(result); }
/// <summary> /// 品项沽清 /// </summary> /// <returns>成功返回空字符,失败返回品项名称</returns> public string UpdateReducedGoodsQty(IList <GoodsCheckStock> goodsCheckStockList) { string json = JsonConvert.SerializeObject(goodsCheckStockList); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_REDUCEDGOODSQTY), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; string strReceive = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); } socket.Close(); } return(strReceive); }
public bool UpdateOrderStatus(Guid orderID, int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.ORDER_ID + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_ORDERSTATUS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //orderID tempByte = Encoding.UTF8.GetBytes(orderID.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ORDER_ID; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return(result); }
/// <summary> /// 日结操作 /// </summary> /// <param name="dailyBalance">日结号</param> /// <param name="unCheckDeviceNo">未结账的设备号</param> /// <returns></returns> public Int32 CreateDailyBalance(DailyBalance dailyBalance, out string unCheckDeviceNo) { string json = JsonConvert.SerializeObject(dailyBalance); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_CREATE_DAILYBALANCE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; int result = 0; unCheckDeviceNo = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); unCheckDeviceNo = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32, receiveData.Length - ParamFieldLength.PACKAGE_HEAD - BasicTypeLength.INT32).Trim('\0'); } socket.Close(); } return result; }
public decimal GetCardDiscountRate(string cardNo) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CARDDISCOUNTRATE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; double discountRate = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { discountRate = BitConverter.ToDouble(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return((decimal)discountRate); }
/// <summary> /// 品项沽清 /// </summary> /// <returns>成功返回空字符,失败返回品项名称</returns> public string UpdateReducedGoodsQty(IList<GoodsCheckStock> goodsCheckStockList) { string json = JsonConvert.SerializeObject(goodsCheckStockList); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_REDUCEDGOODSQTY), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; string strReceive = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); } socket.Close(); } return strReceive; }
public BizDesk GetBizDeskByName(string deskName) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DESK_NAME; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DESKBYNAME), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //deskName byte[] tempByte = Encoding.UTF8.GetBytes(deskName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DESK_NAME; BizDesk desk = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); desk = JsonConvert.DeserializeObject<BizDesk>(strReceive); } socket.Close(); } return desk; }
public SalesOrder GetSalesOrderByBillSearch(Guid orderID) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.ORDER_ID; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SALESORDERBYBILLSEARCH), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //orderID byte[] tempByte = Encoding.UTF8.GetBytes(orderID.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ORDER_ID; Int32 operCode = 0; SalesOrder salesOrder = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); salesOrder = JsonConvert.DeserializeObject <SalesOrder>(strReceive); } socket.Close(); } return(salesOrder); }
public bool UpdateCustomerInfo(CustomerInfo customerInfo) { string json = JsonConvert.SerializeObject(customerInfo); byte[] jsonByte = Encoding.UTF8.GetBytes(json); int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_CUSTOMERINFO), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length); byteOffset += jsonByte.Length; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return result; }
/// <summary> /// 获取用户信息 0:数据库操作失败, 1:成功, 2:账号或者密码错误 /// </summary> public int EmployeeLogin(string userName, string userPassword, ref Employee employee) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.USER_NO + ParamFieldLength.USER_PWD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_USERLOGIN), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //UserName tempByte = Encoding.UTF8.GetBytes(userName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_NO; //UserPassword tempByte = Encoding.UTF8.GetBytes(userPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_PWD; int result = 0; employee = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); employee = JsonConvert.DeserializeObject <Employee>(strReceive); result = 1; } else if (operCode == (int)RET_VALUE.ERROR_AUTHENTICATION) { result = 2; } else { result = 0; } socket.Close(); } return(result); }
/// <summary> /// 获取会员卡信息 0:数据库操作失败, 1:成功, 2:会员卡号或者密码错误 /// </summary> public int SearchVIPCard(string cardNo, string password, out VIPCard card) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.CARD_PASSWORD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_VIPCARD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //password tempByte = Encoding.UTF8.GetBytes(password); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_PASSWORD; int result = 0; card = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); card = JsonConvert.DeserializeObject <VIPCard>(strReceive); result = 1; } else if (operCode == (int)RET_VALUE.ERROR_AUTHENTICATION) { result = 2; } else { result = 0; } socket.Close(); } return(result); }
/// <summary> /// 获取会员卡信息 0:数据库操作失败, 1:成功, 2:会员卡号或者密码错误 /// </summary> public int SearchVIPCard(string cardNo, string password, out VIPCard card) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.CARD_PASSWORD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_VIPCARD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //password tempByte = Encoding.UTF8.GetBytes(password); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_PASSWORD; int result = 0; card = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); card = JsonConvert.DeserializeObject<VIPCard>(strReceive); result = 1; } else if (operCode == (int)RET_VALUE.ERROR_AUTHENTICATION) { result = 2; } else { result = 0; } socket.Close(); } return result; }
/// <summary> /// 获取用户信息 0:数据库操作失败, 1:成功, 2:账号或者密码错误 /// </summary> public int EmployeeLogin(string userName, string userPassword, ref Employee employee) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.USER_NO + ParamFieldLength.USER_PWD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_USERLOGIN), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //UserName tempByte = Encoding.UTF8.GetBytes(userName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_NO; //UserPassword tempByte = Encoding.UTF8.GetBytes(userPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_PWD; int result = 0; employee = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); employee = JsonConvert.DeserializeObject<Employee>(strReceive); result = 1; } else if (operCode == (int)RET_VALUE.ERROR_AUTHENTICATION) { result = 2; } else { result = 0; } socket.Close(); } return result; }
public IList <Order> GetOrderListBySearch(string strWhere, string orderBy, int pageIndex, int pageSize) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.SQL_WHERE + ParamFieldLength.SQL_ORDERBY + BasicTypeLength.INT32 + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_ORDERLISTBYSEARCH), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //strWhere byte[] tempByte = Encoding.UTF8.GetBytes(strWhere); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.SQL_WHERE; //orderBy tempByte = Encoding.UTF8.GetBytes(orderBy); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.SQL_ORDERBY; //PageIndex Array.Copy(BitConverter.GetBytes(pageIndex), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //PageSize Array.Copy(BitConverter.GetBytes(pageSize), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Int32 operCode = 0; IList <Order> orderList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); orderList = JsonConvert.DeserializeObject <IList <Order> >(strReceive); } socket.Close(); } return(orderList); }
public Int32 GetVIPCardTradeList(string cardNo, string beginDate, string endDate, ref VIPCardTradeRecord cardTradeRecord) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_VIPCARDTRADELIST), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //beginDate tempByte = Encoding.UTF8.GetBytes(beginDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endDate tempByte = Encoding.UTF8.GetBytes(endDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32, receiveData.Length - ParamFieldLength.PACKAGE_HEAD - BasicTypeLength.INT32).Trim('\0'); cardTradeRecord = JsonConvert.DeserializeObject <VIPCardTradeRecord>(strReceive); } socket.Close(); } return(result); }
public DeletedAllItems GetAllDeletedItems(string beginDate, string endDate, int dateType) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_ALLDELETEDITEMS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //beginDate tempByte = Encoding.UTF8.GetBytes(beginDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endDate tempByte = Encoding.UTF8.GetBytes(endDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; //dateType Array.Copy(BitConverter.GetBytes(dateType), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; DeletedAllItems deletedAllItems = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); deletedAllItems = JsonConvert.DeserializeObject <DeletedAllItems>(strReceive); } socket.Close(); } return(deletedAllItems); }
public int UpdateCardPassword(string cardNo, string currentPassword, string newPassword) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.CARD_PASSWORD + ParamFieldLength.CARD_PASSWORD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_CARDPASSWORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //currentPassword tempByte = Encoding.UTF8.GetBytes(currentPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_PASSWORD; //newPassword tempByte = Encoding.UTF8.GetBytes(newPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_PASSWORD; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return(result); }
public bool UpdateDeskStatus(string deskName, string deviceNo, int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DESK_NAME + ParamFieldLength.DEVICE_NO + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_DESKSTATUS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //deskName tempByte = Encoding.UTF8.GetBytes(deskName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DESK_NAME; //deviceNo tempByte = Encoding.UTF8.GetBytes(deviceNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DEVICE_NO; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return(result); }
public Int32 GetVIPCardTradeList(string cardNo, string beginDate, string endDate, ref VIPCardTradeRecord cardTradeRecord) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_VIPCARDTRADELIST), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //beginDate tempByte = Encoding.UTF8.GetBytes(beginDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endDate tempByte = Encoding.UTF8.GetBytes(endDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32, receiveData.Length - ParamFieldLength.PACKAGE_HEAD - BasicTypeLength.INT32).Trim('\0'); cardTradeRecord = JsonConvert.DeserializeObject<VIPCardTradeRecord>(strReceive); } socket.Close(); } return result; }
public string GetDailyStatementTimeInterval() { int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DAILYTIMEINTERVAL), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; string dailyTimeInterval = string.Empty; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { dailyTimeInterval = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); } socket.Close(); } return dailyTimeInterval; }
public IList <GroupPrice> GetItemPriceListByGroup(string beginDate, string endDate) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_ITEMPRICELISTBYGROUP), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //beginDate tempByte = Encoding.UTF8.GetBytes(beginDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endDate tempByte = Encoding.UTF8.GetBytes(endDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; IList <GroupPrice> groupPriceList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); groupPriceList = JsonConvert.DeserializeObject <IList <GroupPrice> >(strReceive); } socket.Close(); } return(groupPriceList); }
public Shop GetCurrentShop(string ipAddress, int port) { const int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SHOP), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Shop currentShop = null; using (SocketClient socket = new SocketClient(ipAddress, port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int) RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); currentShop = JsonConvert.DeserializeObject<Shop>(strReceive); } socket.Close(); } return currentShop; }
public SysBasicData GetSysBasicData() { int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SYSBASICDATA), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; SysBasicData sysBasicData = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); sysBasicData = JsonConvert.DeserializeObject<SysBasicData>(strReceive); } socket.Close(); } return sysBasicData; }
public IList<GoodsCheckStock> GetGoodsCheckStock() { const int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_GOODSCHECKSTOCK), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; IList<GoodsCheckStock> goodsCheckStockList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); goodsCheckStockList = JsonConvert.DeserializeObject<IList<GoodsCheckStock>>(strReceive); } socket.Close(); } return goodsCheckStockList; }
public bool UpdateDeskStatus(string deskName, string deviceNo, int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.DESK_NAME + ParamFieldLength.DEVICE_NO + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_DESKSTATUS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //deskName tempByte = Encoding.UTF8.GetBytes(deskName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DESK_NAME; //deviceNo tempByte = Encoding.UTF8.GetBytes(deviceNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.DEVICE_NO; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return result; }
public IList<Order> GetOrderListBySearch(string strWhere, string orderBy, int pageIndex, int pageSize) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.SQL_WHERE + ParamFieldLength.SQL_ORDERBY + BasicTypeLength.INT32 + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_ORDERLISTBYSEARCH), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //strWhere byte[] tempByte = Encoding.UTF8.GetBytes(strWhere); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.SQL_WHERE; //orderBy tempByte = Encoding.UTF8.GetBytes(orderBy); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.SQL_ORDERBY; //PageIndex Array.Copy(BitConverter.GetBytes(pageIndex), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //PageSize Array.Copy(BitConverter.GetBytes(pageSize), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Int32 operCode = 0; IList<Order> orderList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); orderList = JsonConvert.DeserializeObject<IList<Order>>(strReceive); } socket.Close(); } return orderList; }
public CustomerInfo GetCustomerInfoByPhone(string telephone) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.TELEPHONE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CUSTOMERINFOBYPHONE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //telephone byte[] tempByte = Encoding.UTF8.GetBytes(telephone); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.TELEPHONE; Int32 operCode = 0; CustomerInfo customerInfo = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); customerInfo = JsonConvert.DeserializeObject<CustomerInfo>(strReceive); } socket.Close(); } return customerInfo; }
public Int32 CheckLastDailyStatement(int breakDays) { int cByte = ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_CHECK_LASTDAILYSTATEMENT), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(breakDays), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return result; }
public IList<DeskRealTimeInfo> GetDeskRealTimeInfo(string regionID) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.REGION_ID; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DESKREALTIMEINFO), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //regionID byte[] tempByte = Encoding.UTF8.GetBytes(regionID); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.REGION_ID; IList<DeskRealTimeInfo> deskInfoList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0'); deskInfoList = JsonConvert.DeserializeObject<IList<DeskRealTimeInfo>>(strReceive); } socket.Close(); } return deskInfoList; }
public IList<GroupPrice> GetItemPriceListByGroup(string beginDate, string endDate) { const int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_ITEMPRICELISTBYGROUP), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //beginDate tempByte = Encoding.UTF8.GetBytes(beginDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endDate tempByte = Encoding.UTF8.GetBytes(endDate); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; IList<GroupPrice> groupPriceList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); groupPriceList = JsonConvert.DeserializeObject<IList<GroupPrice>>(strReceive); } socket.Close(); } return groupPriceList; }
public Int32 UpdateCardStatus(string cardNo, string password, int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO + ParamFieldLength.CARD_PASSWORD + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_CARDSTATUS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; //password tempByte = Encoding.UTF8.GetBytes(password); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_PASSWORD; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return result; }
/// <summary> /// 根据所属日期获取营业时间段 /// </summary> /// <param name="belongToDate">所属日期</param> /// <returns></returns> public IList<DailyBalanceTime> GetDailyBalanceTime(DateTime belongToDate) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DAILYBALANCETIME), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //belongToDate byte[] tempByte = Encoding.UTF8.GetBytes(belongToDate.ToString("yyyy-MM-dd")); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; Int32 operCode = 0; IList<DailyBalanceTime> dailyBalanceTimeList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); dailyBalanceTimeList = JsonConvert.DeserializeObject<IList<DailyBalanceTime>>(strReceive); } socket.Close(); } return dailyBalanceTimeList; }
public decimal GetCardDiscountRate(string cardNo) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.CARD_NO; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CARDDISCOUNTRATE), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //cardNo tempByte = Encoding.UTF8.GetBytes(cardNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.CARD_NO; double discountRate = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { discountRate = BitConverter.ToDouble(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return (decimal)discountRate; }
/// <summary> /// 获取热销产品列表 /// </summary> /// <param name="telephone">电话号码</param> /// <returns></returns> public IList<TopSellGoods> GetTopSellGoods(string telephone) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.TELEPHONE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_TOPSELLGOODS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //telephone byte[] tempByte = Encoding.UTF8.GetBytes(telephone); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.TELEPHONE; IList<TopSellGoods> topSellGoodsList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); topSellGoodsList = JsonConvert.DeserializeObject<IList<TopSellGoods>>(strReceive); } socket.Close(); } return topSellGoodsList; }
public int UpdateEmployeePassword(string employeeNo, string currentPassword, string newPassword) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.EMPLOYEE_NO + ParamFieldLength.EMPLOYEE_PASSWORD + ParamFieldLength.EMPLOYEE_PASSWORD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_EMPLOYEEPASSWORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //employeeNo tempByte = Encoding.UTF8.GetBytes(employeeNo); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.EMPLOYEE_NO; //currentPassword tempByte = Encoding.UTF8.GetBytes(currentPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.EMPLOYEE_PASSWORD; //newPassword tempByte = Encoding.UTF8.GetBytes(newPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.EMPLOYEE_PASSWORD; int result = 0; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = BitConverter.ToInt32(receiveData, ParamFieldLength.PACKAGE_HEAD); } socket.Close(); } return result; }
public bool UpdateOrderStatus(Guid orderID, int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.ORDER_ID + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_UPDATE_ORDERSTATUS), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //orderID tempByte = Encoding.UTF8.GetBytes(orderID.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ORDER_ID; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; bool result = false; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { result = true; } socket.Close(); } return result; }
public IList<DeliveryOrder> GetDeliveryOrderList() { int cByte = ParamFieldLength.PACKAGE_HEAD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_DELIVERYORDERLIST), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; IList<DeliveryOrder> deliveryOrderList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); deliveryOrderList = JsonConvert.DeserializeObject<IList<DeliveryOrder>>(strReceive); } socket.Close(); } return deliveryOrderList; }
public IList<String> GetRightsCodeList(string userName, string userPassword) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.USER_NO + ParamFieldLength.USER_PWD; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_RIGHTSCODELIST), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //UserName tempByte = Encoding.UTF8.GetBytes(userName); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_NO; //UserPassword tempByte = Encoding.UTF8.GetBytes(userPassword); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.USER_PWD; IList<String> rightsCodeList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); rightsCodeList = JsonConvert.DeserializeObject<IList<String>>(strReceive); } socket.Close(); } return rightsCodeList; }
/// <summary> /// 获取最近一个月特定状态通话记录 /// </summary> /// <returns></returns> public IList<CallRecord> GetCallRecordByStatus(int status) { int cByte = ParamFieldLength.PACKAGE_HEAD + BasicTypeLength.INT32; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_CALLRECORD), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; //status Array.Copy(BitConverter.GetBytes(status), 0, sendByte, byteOffset, BasicTypeLength.INT32); IList<CallRecord> callRecordList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); callRecordList = JsonConvert.DeserializeObject<IList<CallRecord>>(strReceive); } socket.Close(); } return callRecordList; }
public IList<HourOrderSales> GetHourSalesReport(DateTime beginTime, DateTime endTime) { int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE; byte[] sendByte = new byte[cByte]; int byteOffset = 0; Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_HOURSALESREPORT), sendByte, BasicTypeLength.INT32); byteOffset = BasicTypeLength.INT32; Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32); byteOffset += BasicTypeLength.INT32; byte[] tempByte = null; //beginTime tempByte = Encoding.UTF8.GetBytes(beginTime.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.BEGINDATE; //endTime tempByte = Encoding.UTF8.GetBytes(endTime.ToString()); Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length); byteOffset += ParamFieldLength.ENDDATE; IList<HourOrderSales> hourSalesList = null; using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port)) { Byte[] receiveData = null; Int32 operCode = socket.SendReceive(sendByte, out receiveData); if (operCode == (int)RET_VALUE.SUCCEEDED) { string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD); hourSalesList = JsonConvert.DeserializeObject<IList<HourOrderSales>>(strReceive); } socket.Close(); } return hourSalesList; }