public Users GetByIdOrUsername(string pIdOrUsername) { Users user = new Users(); DataSet dataset = new DataSet(); string queryStr = string.Format("SELECT `UserId`, `Pwd`, `Status`, `RoleId` FROM user WHERE UserId = '{0}'", pIdOrUsername); PosService.DataQuery(Username, Password, queryStr, ref dataset, "x", ref errorString); if (!string.IsNullOrEmpty(errorString)) { return(null); } if (dataset.Tables["x"].Rows.Count > 0) { user.UserId = dataset.Tables["x"].Rows[0][UserColumn.UserId].ToString(); user.Pwd = dataset.Tables["x"].Rows[0][UserColumn.Pwd].ToString(); //user.LastLogin = dataset.Tables["x"].Rows[0][UserColumn.LastLogin].ToString(); user.Status = dataset.Tables["x"].Rows[0][UserColumn.Status].ToString(); //user.CreatedBy = dataset.Tables["x"].Rows[0][UserColumn.CreatedBy].ToString(); //user.CreatedDate = dataset.Tables["x"].Rows[0][UserColumn.CreatedDate].ToString(); //user.ModifiedBy = dataset.Tables["x"].Rows[0][UserColumn.ModifiedBy].ToString(); //user.ModifiedDate = dataset.Tables["x"].Rows[0][UserColumn.ModifiedDate].ToString(); user.RoleId = dataset.Tables["x"].Rows[0][UserColumn.RoleId].ToString(); } else { user = null; } return(user); }
public void Process_WhenValidProductsListEntered() { double applePrice = 1.25; double biscuitPrice = 4.25; double cheesePrice = 1.00; double dairyMilkPrice = 0.75; _applePromoProcessor.Setup(p => p.Apply(3, applePrice)).Returns(3.00); _applePromoProcessor.Setup(p => p.Apply(1, applePrice)).Returns(1.25); _biscuitPromoProcessor.Setup(p => p.Apply(2, biscuitPrice)).Returns(8.50); _biscuitPromoProcessor.Setup(p => p.Apply(1, biscuitPrice)).Returns(4.25); _cheesePromoProcessor.Setup(p => p.Apply(1, cheesePrice)).Returns(1.00); _cheesePromoProcessor.Setup(p => p.Apply(7, cheesePrice)).Returns(6.00); _dairyMilkPromoProcessor.Setup(p => p.Apply(1, dairyMilkPrice)).Returns(0.75); var posService = new PosService(_portfolio, _applePromoProcessor.Object, _biscuitPromoProcessor.Object, _cheesePromoProcessor.Object, _dairyMilkPromoProcessor.Object); var totalPrice = posService.Process("ABCDABA"); Assert.Equal(13.25, totalPrice); totalPrice = posService.Process("CCCCCCC"); Assert.Equal(6.00, totalPrice); totalPrice = posService.Process("ABCD"); Assert.Equal(7.25, totalPrice); }
private void Query(int pageIndex) { try { var service = new PosService(); var querylist = service.SelectPosList(QueryCondition.Clone() as Hashtable , SplitPageControl1.PageSize , pageIndex * SplitPageControl1.PageSize); SplitPageControl1.RecoedCount = service.SelectPosListCount(QueryCondition.Clone() as Hashtable); SplitPageControl1.PageIndex = pageIndex; if (SplitPageControl1.PageIndex != pageIndex) { Query(SplitPageControl1.PageIndex); return; } else { gvTerminal.DataSource = querylist; gvTerminal.DataBind(); } } catch (Exception ex) { PageLog.Current.Write(ex); this.InfoBox.ShowPopError("加载数据出错!"); } }
public HttpResponseMessage GetPosDetailByCustomer() { LoggerFactory.LoggerInstance.LogDebug("Request Started for :GetPosDetailByCustomer"); HttpResponseMessage response = new HttpResponseMessage(); try { PosService objComService = new PosService(); var objResponse = objComService.GetPosDetailByCustomer(); if (objResponse != null && objResponse.ToString() != "") { response = Request.CreateResponse(HttpStatusCode.OK, objResponse); LoggerFactory.LoggerInstance.LogDebug("Request End for :GetPosDetailByCustomer"); } else { response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found for GetPosDetailByCustomer."); } } catch (Exception ex) { LoggerFactory.LoggerInstance.LogException(ex); response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting call GetPosDetailByCustomer"); } return(response); }
/// <summary> /// 更新终端的版本(程序版本和数据版本) /// </summary> /// <param name="customerID">客户ID</param> /// <param name="userID">用户ID</param> /// <param name="unitID">门店ID</param> /// <param name="appVersion">程序版本</param> /// <param name="dbVersion">数据版本</param> /// <returns></returns> public bool ModifyPosVersion(string customerID, string userID, string unitID, string SN, string appVersion, string dbVersion) { LoggingSessionInfo ls = new BaseInfouAuthService().GetLoggingSessionInfo(customerID, userID, unitID); PosService pos_service = new PosService(); return(pos_service.ModifyPosVersion(ls, SN, appVersion, dbVersion)); }
private void MoveRandom() { if (r == null) { r = new Random((int)DateTime.Now.Ticks); } var speed = r.Next(4); PosService service = new PosService(); foreach (TagPosition position in posList) { if (offlinePos.Contains(position.Tag)) { continue;//离线不更新 } position.DateTime = DateTime.Now; position.Time = DateTime.Now.ToStamp(); position.X += r.Next(speed); position.Y += (float)r.NextDouble(); position.Z += r.Next(speed); //service.Put(position); } service.PutRange(posList); }
public bool SetPosInfo(string posInfo, string customerID, int type) { this.log(LogLevel.DEBUG, "AuthBsWebServices", "SetPosInfo", "Params", "pos=" + posInfo); this.log(LogLevel.DEBUG, "AuthBsWebServices", "SetPosInfo", "Params", "customer_id=" + customerID); this.log(LogLevel.DEBUG, "AuthBsWebServices", "SetPosInfo", "Params", "type=" + type.ToString()); cPos.Service.PosService pos_service = new PosService(); if (string.IsNullOrEmpty(posInfo)) { throw new ArgumentNullException("posInfo"); } if (string.IsNullOrEmpty(customerID)) { throw new ArgumentNullException("customerID"); } if (type < 1 || type > 2) { throw new ArgumentOutOfRangeException("type"); } //todo:解密 string decrypt_pos_info = posInfo; PosInfo pos = (PosInfo)cPos.Service.cXMLService.Deserialize(decrypt_pos_info, typeof(PosInfo)); if (pos == null) { throw new ArgumentException("posInfo"); } if (string.IsNullOrEmpty(pos.ID)) { throw new ArgumentNullException("terminal_id"); } if (string.IsNullOrEmpty(pos.SN)) { throw new ArgumentNullException("terminal_sn"); } if (string.IsNullOrEmpty(pos.HoldType)) { throw new ArgumentNullException("terminal_hold_type"); } if (string.IsNullOrEmpty(pos.Type)) { throw new ArgumentNullException("terminal_type"); } switch (type) { case 1: return(pos_service.InsertPosFromAP(pos, customerID)); case 2: return(pos_service.ModifyPosFromAP(pos, customerID)); default: return(false); } }
private void ShowPersons() { if (currentArea == null) { return; } if (AreaCanvas1 == null) { return; } var service = new PersonService(); //var persons = service.GetListByArea(area.Id + ""); //if (persons == null) //{ // persons = service.GetListByArea(""); //} var persons = service.GetList(true); var posService = new PosService(); var posList = posService.GetList();//todo:实时数据以后从缓存中取 foreach (var item in persons) { var pos = posList.FirstOrDefault(i => i.Tag == item.Tag.Code); item.Pos = pos; } AreaCanvas1.ShowPersons(persons); }
private void Query(int pageIndex) { try { var service = new PosService(); PosUnitInfo pUi = new PosUnitInfo(new UnitInfo(), new PosInfo()); var querylist = service.SelectPosUnitList(loggingSessionInfo, QueryCondition); SplitPageControl1.RecoedCount = querylist.Count; SplitPageControl1.PageIndex = pageIndex; //验证查询当前页索引是否在记录总数范围内。 if (SplitPageControl1.PageIndex != pageIndex) { Query(SplitPageControl1.PageIndex); return; } else { gvTerminal_Unit.DataSource = querylist; gvTerminal_Unit.DataBind(); } } catch (Exception ex) { PageLog.Current.Write(ex); this.InfoBox.ShowPopError("加载数据出错!"); } }
public HttpResponseMessage GetItemGroupListByID([FromBody] clsposItems request) { LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.ItemID); HttpResponseMessage response = new HttpResponseMessage(); try { PosService objComService = new PosService(); var CustomerResponse = objComService.GetItemGroupListByID(request); if (CustomerResponse != null && CustomerResponse.ToString() != "") { response = Request.CreateResponse(HttpStatusCode.OK, CustomerResponse); LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.ItemID); } else { response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found for requested Customer by ID : " + request.ItemID + "."); } } catch (Exception ex) { LoggerFactory.LoggerInstance.LogException(ex); response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting Customer Detail by ID " + request.ItemID + "."); } return(response); }
/// <summary> /// 获取终端的编号 /// </summary> /// <param name="customerID">客户ID</param> /// <param name="userID">用户ID</param> /// <param name="unitID">门店ID</param> /// <param name="posSN">POS序列号</param> /// <returns></returns> public string GetPosCode(string customerID, string userID, string unitID, string posSN) { PosService pos_service = new PosService(); string pos_code = pos_service.GetPosNo(customerID, unitID, posSN); return(pos_code); }
public PosServiceTest() { pos1 = new Pos { Id = "1", Bandeira = Bandeira.VISA, CodigoSeguranca = "630", NumeroCartao = "4485489265338195", Validade = DateTime.Parse("09/11/2021"), CPF = "11659328063", Nome = "Monike", Transacao = TipoTransacao.Debito, TotalVezes = 0, Valor = 500, ValorLimite = 1500, Data = DateTime.Now }; var mockRepository = new Mock <IPosRepository>(); mockRepository.Setup(p => p.Get()).Returns(new List <Pos> { pos1 }); mockRepository.Setup(p => p.Create(pos1)).Returns(pos1); mockRepository.Setup(p => p.Remove(pos1)); var mockValitor = new Mock <IValidator <Pos> >(); mockValitor.Setup(x => x.Validate(It.IsAny <Pos>())) .Returns(new ValidationResult()); posService = new PosService(mockRepository.Object, mockValitor.Object); }
/// <summary> /// 查询仓库 /// </summary> public string GetWarehouseListData() { var form = Request("form").DeserializeJSONTo <WarehouseQueryEntity>(); var posService = new PosService(CurrentUserInfo); IList <WarehouseInfo> warehouseList; string content = string.Empty; Hashtable hashtable = new Hashtable(); hashtable.Add("Code", FormatParamValue(form.warehouse_code)); hashtable.Add("Name", FormatParamValue(form.warehouse_name)); hashtable.Add("Contacter", FormatParamValue(form.warehouse_contacter)); hashtable.Add("Tel", FormatParamValue(form.warehouse_tel)); hashtable.Add("Status", FormatParamValue(form.warehouse_status)); hashtable.Add("UnitName", FormatParamValue(form.unit_name)); int maxRowCount = PageSize; int startRowIndex = Utils.GetIntVal(Request("start")); warehouseList = posService.SelectWarehouseList(hashtable, maxRowCount, startRowIndex); var jsonData = new JsonData(); jsonData.totalCount = posService.SelectWarehouseListCount(hashtable).ToString(); jsonData.data = warehouseList; content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", jsonData.data.ToJSON(), jsonData.totalCount); return(content); }
private void RefreshData() { PosService service = new PosService(); posList = service.GetList(); DataGrid1.ItemsSource = posList; }
public HttpResponseMessage GetPosItemsDetailById([FromBody] clspos request) { LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.PosID + "POS ID :" + request.PosID); HttpResponseMessage response = new HttpResponseMessage(); try { PosService objComService = new PosService(); var objResponse = objComService.GetPosDetailById(request); if (objResponse != null && objResponse.ToString() != "") { response = Request.CreateResponse(HttpStatusCode.OK, objResponse); LoggerFactory.LoggerInstance.LogDebug("Request End for : " + request.PosID + " POS ID:" + request.PosID); } else { response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found for Pos Item ID : " + request.PosID + "."); } } catch (Exception ex) { LoggerFactory.LoggerInstance.LogException(ex); response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting Pos ITEM Id " + request.PosID + "."); } return(response); }
/// <summary> /// 根据组织标识获取仓库 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="User_Id">用户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="unitID">需要获取的组织标识</param> /// <returns></returns> public IList <WarehouseInfo> GetWarehouseByUnitIDPackaged(string Customer_Id, string User_Id, string Unit_Id, string unitID) { LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id); IList <WarehouseInfo> warehouseInfoList = new List <WarehouseInfo>(); PosService posServer = new PosService(); warehouseInfoList = posServer.GetWarehouseByUnitID(loggingSessionInfo, unitID); return(warehouseInfoList); }
public void ChangePassword(Users obj) { string[][] param = { new string[] { "p_UserId", obj.UserId }, new string[] { "p_Pwd", obj.Pwd }, }; PosService.DataStoreProcExecute(Username, Password, "spChangePassword_User", ref errorString, param, ref res); }
//加载仓库函数 在盘点单位选择后触发 private void initWarehouse() { var source = new PosService().GetWarehouseByUnitID(loggingSessionInfo, selUnit.SelectedValue); selWarehouse.DataValueField = "ID"; selWarehouse.DataTextField = "Name"; selWarehouse.DataSource = source; selWarehouse.DataBind(); }
/// <summary> /// Edit name /// </summary> /// <param name="obj"></param> public void Edit(Roles obj) { string queryStr = "UPDATE role SET"; queryStr += string.Format(" " + RoleColumn.RoleName + " = '{0}'", obj.RoleName); queryStr += string.Format(" WHERE " + RoleColumn.RoleId + " = '{0}'", obj.RoleId); PosService.DataExecute(Username, Password, queryStr, ref errorString); }
//加载终端基本数据 private void LoadBasicData() { try { var source = new PosService().GetPosByID(loggingSessionInfo, this.Request.Params["pos_id"]); if (source == null) { this.btnOK.Visible = false; } ViewState["code"] = source.Code; ViewState["SN"] = source.SN; this.tbType.SelectedValue = source.Type; tbHoldType.Text = source.HoldTypeDescription; tbBrand.Text = source.Brand ?? ""; tbModel.Text = source.Model ?? ""; tbCode.Text = source.Code ?? ""; tbSN.Text = source.SN ?? ""; //tbPurchaseDate.Text = (source.PurchaseDate ?? "").ToString(); tbPurchaseDate.Value = (source.PurchaseDate ?? "").ToString(); tbInsuranceDate.Value = (source.InsuranceDate ?? "").ToString(); // tbInsuranceDate.Text = (source.InsuranceDate ?? "").ToString(); tbSoftwareVersion.Text = source.SoftwareVersion ?? ""; tbDBVersion.Text = source.DBVersion ?? ""; tbWS.Text = source.WS ?? ""; tbWS2.Text = source.WS2 ?? ""; tbRemark.Text = source.Remark ?? ""; chkCashBox.Checked = source.HaveCashbox == 1; tbCashNo.Text = source.CashboxNo ?? ""; chkPrinter.Checked = source.HavePrinter == 1; tbPrinterNo.Text = source.PrinterNo ?? ""; chkClientDisplay.Checked = source.HaveClientDisplay == 1; tbClientDisplayNo.Text = source.ClientDisplayNo ?? ""; chkScanner.Checked = source.HaveScanner == 1; tbScannerNo.Text = source.ScannerNo ?? ""; chkEcard.Checked = source.HaveEcard == 1; tbEcardNo.Text = source.EcardNo ?? ""; chkHolder.Checked = source.HaveHolder == 1; tbHolderNo.Text = source.HolderNo ?? ""; chkOtherDevice.Checked = source.HaveOtherDevice == 1; tbOtherDeviceNo.Text = source.OtherDeviceNo ?? ""; tbCreater.Text = source.CreateUserName ?? ""; tbCreateTime.Text = (source.CreateTime == null ? "" : source.CreateTime.ToString("yyyy-MM-dd HH:mm:ss.fff")); tbEditor.Text = source.ModifyUserName ?? ""; tbEditTime.Text = (source.ModifyTime == null ? "" : source.ModifyTime.ToString("yyyy-MM-dd HH:mm:ss.fff")); //tbSysModifyTime.Text = (source.SystemModifyStamp == null ? "" : source.SystemModifyStamp.ToString("yyyy-MM-dd HH:mm:ss.fff")); } catch (Exception ex) { PageLog.Current.Write(ex); this.InfoBox.ShowPopError("加载数据出错!"); } }
public bool CheckLogin(string pIdOrUsername, string pPassword) { bool ok = PosService.IsUser(pIdOrUsername, pPassword, ref errorString); if (ok == true) { Username = pIdOrUsername; Password = pPassword; users = GetByIdOrUsername(pIdOrUsername); } return(ok); }
private void InitPosServices(IReactiveDeliveryClient reactiveDeliveryClient, Action showWnd, IShellContainerVm vm, ConnectionInfoResponse response) { try { PosService.DeletePosFoldersDataAndNewDataIfPosIsDown(); SyncPosFiles.GetUnsyncFiles(reactiveDeliveryClient, showWnd, vm, response); } catch (Exception ex) { Log.Error("Error al iniciar los servicios de POS: ", ex); } }
private async Task <Unit> OnReloadPos() { await Task.Run(() => { if (!PosService.DeletePosFoldersDataAndNewDataIfPosIsDown()) { ShowPosApp(); return; } ReloadPosAction.SafeExecuteAction(); }); return(new Unit()); }
public void Edit(Users obj) { string queryStr = "UPDATE user SET"; queryStr += string.Format(" Pwd = '{0}'", obj.Pwd); queryStr += string.Format(" ,LastLogin = '******'", obj.LastLogin); queryStr += string.Format(" ,Status = '{0}'", obj.Status); queryStr += string.Format(" ,ModifiedBy = '{0}'", obj.ModifiedBy); queryStr += " ,ModifiedBy = NOW()"; queryStr += string.Format(" ,ModifiedBy = '{0}'", obj.ModifiedBy); queryStr += string.Format(", '{0})'", obj.RoleId); queryStr += string.Format(" WHERE UserId = '{0}'", obj.UserId); PosService.DataExecute(Username, Password, queryStr, ref errorString); }
private async Task <Unit> OnRestartPos() { await Task.Run(() => { ProcessExt.ForceKillProcess(SettingsData.AlohaIber.Replace(SettingsData.Constants.EXTENSION_EXE, String.Empty)); if (!PosService.DeletePosFoldersDataAndNewDataIfPosIsDown()) { ShowPosApp(); return; } ReloadPosAction.SafeExecuteAction(); }); return(new Unit()); }
public DataTable GetRoleOfUser(string roleId) { string queryStr = String.Format("SELECT * FROM role WHERE " + RoleColumn.RoleId + " = '{0}'", roleId); DataSet dataset = new DataSet(); PosService.DataQuery(Username, Password, queryStr, ref dataset, "x", ref errorString); if (string.IsNullOrEmpty(errorString)) { return(dataset.Tables["x"]); } else { return(null); } }
//加载仓库函数 在盘点单位选择后触发 private void initWarehouse() { try { var source = new PosService().GetWarehouseByUnitID(loggingSessionInfo, selUnit.SelectedValue); selWarehouse.DataValueField = "ID"; selWarehouse.DataTextField = "Name"; selWarehouse.DataSource = source; selWarehouse.DataBind(); } catch (Exception ex) { PageLog.Current.Write(ex); this.InfoBox.ShowPopError("加载数据出错!"); } }
private void SimulateOnTheSpot() { PosService service = new PosService(); foreach (TagPosition position in posList) { if (offlinePos.Contains(position.Tag)) { continue;//离线不更新 } position.DateTime = DateTime.Now; position.Time = DateTime.Now.ToStamp(); //service.Put(position); } service.PutRange(posList); }
public DataTable GetRoles() { DataTable res = new DataTable(); DataSet ds = new DataSet(); string queryStr = "UPDATE role SET"; PosService.DataQuery(Username, Password, queryStr, ref ds, "roles", ref errorString); if (string.IsNullOrEmpty(errorString)) { res = ds.Tables[0]; } else { res = null; } return(res); }
/// <summary> /// Get all Users /// </summary> /// <returns></returns> public DataTable GetUsers(Users user) { DataTable dtUsers = new DataTable(); DataSet dataset = new DataSet(); string queryStr = "SELECT * FROM user"; PosService.DataQuery(user.UserId, user.Pwd.ToString(), queryStr, ref dataset, "x", ref errorString); if (!string.IsNullOrEmpty(errorString)) { return(null); } if (dataset.Tables["x"].Rows.Count > 0) { dtUsers = dataset.Tables["x"]; } return(dtUsers); }