public bool UpdateProduct(Customer activeCustomer) { Console.Clear(); Console.WriteLine("Type a product id and press enter..."); // Generate Product Menu // var customerProduct = new GetProductList(); var products = customerProduct.GetProducts(activeCustomer.CustomerID); foreach (var product in products) { Console.WriteLine($"{product.ProductID}. {product.Name}: {product.Price}"); } Console.WriteLine("\nPress [0] to return to the main menu"); // Read Input and Remove Product by ID // var id = int.Parse(Console.ReadLine()); if (id == 0) { return(true); } if (ChangeProduct.ProductUpdater(id)) { Console.WriteLine("Product updated. Press Enter to Continue"); Console.ReadLine(); return(true); } else { Console.WriteLine("Product did not update"); return(false); } }
//displays a border with the vending options inside it private void AsciiArt() { getProductList = new GetProductList(fileRepo); updateVendingRepo = new UpdateVendingRepo(fileRepo); Dictionary <string, VendingItem> products = getProductList.GetProducts(); string a1ItemName = MessageProductName(products, "A1"); string a2ItemName = MessageProductName(products, "A2"); string a3ItemName = MessageProductName(products, "A3"); string b1ItemName = MessageProductName(products, "B1"); string b2ItemName = MessageProductName(products, "B2"); string b3ItemName = MessageProductName(products, "B3"); string a1Price = MessageProductPrice(products, "A1"); string a2Price = MessageProductPrice(products, "A2"); string a3Price = MessageProductPrice(products, "A3"); string b1Price = MessageProductPrice(products, "B1"); string b2Price = MessageProductPrice(products, "B2"); string b3Price = MessageProductPrice(products, "B3"); Console.WriteLine("(_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_)"); Console.Write("##"); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" {0,-10}{1,-10}{2,-10}", "A1", "A2", "A3"); Console.ResetColor(); Console.WriteLine("## {0,-12}{1,-10}{2}", a1ItemName, a2ItemName, a3ItemName); Console.WriteLine("## {0,-11}{1,-10}{2}", a1Price, a2Price, a3Price); Console.WriteLine("##"); Console.WriteLine("##"); Console.Write("##"); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" {0,-10}{1,-10}{2,-10}", "B1", "B2", "B3"); Console.ResetColor(); Console.WriteLine("## {0,-11}{1,-10}{2}", b1ItemName, b2ItemName, b3ItemName); Console.WriteLine("## {0,-11}{1,-11}{2}", b1Price, b2Price, b3Price); Console.WriteLine("(_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_)"); }
public async Task <PageResult <ProductListItem> > Handle(GetProductList request, CancellationToken cancellationToken) { var parameters = new { searchText = $"%{request.SearchText}%", skip = (request.PageNo - 1) * request.PageSize, take = request.PageSize }; var addSearch = !string.IsNullOrEmpty(request.SearchText) ? SearchClause : string.Empty; var addDates = GetDateFilter(request.TimeFilter); using (IDbConnection db = new SqlConnection(_connectionString)) { var countQuery = string.Format(CountQuery, addSearch, addDates); var pageQuery = string.Format(PageQuery, addSearch, addDates); var total = await db.ExecuteScalarAsync <int>(countQuery, parameters); var page = await db.QueryAsync <ProductListItem>(pageQuery, parameters); return(new PageResult <ProductListItem>(page, total)); } }
public void Test19() { GetProductList getProductList = new GetProductList(); getProductList.SearchSelectedProductByName("Goldway G40E"); var product = GetProductList.productSelected; Assert.NotNull(product); }
private void QualityManagement_Load(object sender, EventArgs e) { #region 添加应用程序 if (this.sMain.gUserInfo.rolecaption == "系统开发员") { IList <IDictionary <string, object> > lsfunls = new List <IDictionary <string, object> >(); FrmBLL.publicfuntion.GetFromCtls(this, ref lsfunls); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("PROGID", this.Name); dic.Add("PROGNAME", this.Text); dic.Add("PROGDESC", this.Text); FrmBLL.publicfuntion.AddProgInfo(dic, lsfunls); } #endregion for (int i = 0; i < 24; i++) { combStime.Items.Add(i.ToString().PadLeft(2, '0') + ":30"); combEtime.Items.Add(i.ToString().PadLeft(2, '0') + ":30"); } combStime.SelectedIndex = 0; ////.Text = combStime.SelectedIndex; combEtime.SelectedIndex = 0; //.Text = combEtime.SelectedItem = -1; GetProduct = new GetProductList(GettProductList); GetProduct.BeginInvoke(null, null); GetwoId = new GetwoIdList(GettwoIdList); GetwoId.BeginInvoke(null, null); GetLine = new GetLineList(GettLineList); GetLine.BeginInvoke(null, null); GetCraft = new GetCraftList(GettCraftList); GetCraft.BeginInvoke(null, null); GetErrorCode = new GetErrorCodeList(GettErrorCode); GetErrorCode.BeginInvoke(null, null); GetReasonCode = new GetReasonCodeList(GettReasonCode); GetReasonCode.BeginInvoke(null, null); // panelEx4.Right = panelEx3.Width * (2 / 3); imbt_Checktime.Left = panelEx4.Width + 150; #region 单元格交替颜色 this.dgvYieldRate.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvYieldRate.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; this.dgvDefectAnalysis.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvDefectAnalysis.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; this.dgvRepairAnalysis.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvRepairAnalysis.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; #endregion }
public void Test20() { GetProductList getProductList = new GetProductList(); getProductList.SearchSelectedProductByName("ABC"); string product = JsonConvert.SerializeObject(GetProductList.productSelected); string nullProduct = JsonConvert.SerializeObject(new Products()); Assert.Equal(nullProduct, product); }
public bool DeleteProduct(Customer activeCustomer) { Console.Clear(); Console.WriteLine("1: Remove Product"); Console.WriteLine("2: Return to Main Menu"); var productSubSelection = Console.ReadKey(); var remove = true; while (remove) { switch (productSubSelection.KeyChar) { case '0': remove = false; break; case '1': Console.Clear(); Console.WriteLine("Type a product id and press enter..."); // Generate Product Menu // var customerProducts = new GetProductList(); var ProductData = customerProducts.GetProducts(activeCustomer.CustomerID); foreach (var product in ProductData) { Console.WriteLine($"{product.ProductID}. {product.Name}: {product.Price}"); } Console.WriteLine("\nPress [0] to return to the main menu"); // Read Input and Remove Product by ID // var selection = Console.ReadLine(); var productDelete = new RemoveProduct().DeleteProduct(int.Parse(selection)); if (int.Parse(selection) == 0) { remove = false; } else if (productDelete) { Console.WriteLine("Product deleted press enter to relaod list"); Console.ReadKey(); } else { Console.WriteLine("Product not deleted or does not exist"); } //Console.ReadKey(); break; case '2': remove = false; break; } } return(true); }
public void DisplayMenu() { getProductList = new GetProductList(fileRepo); updateVendingRepo = new UpdateVendingRepo(fileRepo); AsciiArt(); Console.WriteLine(); new CalculateChange(ConsoleIO.ReadDecimailInRange("How Much money do you want to put into the vending machine: ", 0, 100)); int selection = 0; do { Console.Clear(); Dictionary <string, VendingItem> products = getProductList.GetProducts(); AsciiArt(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Current Money: ${CalculateChange.Money}"); Console.ResetColor(); selection = ConsoleIO.SelectFromMenu(); switch (selection) { case 1: CalculateChange.AddMoney(); break; case 2: Console.Clear(); AsciiArt(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Current Money: ${CalculateChange.Money}"); Console.ResetColor(); updateVendingRepo.UpdateVending(); break; } } while (selection > 0 && selection < 3); Console.Clear(); Console.WriteLine("GOODBYE!"); Console.ReadKey(); }
public void GetProductListWithProtoBufServClt() { GetProductList request = new GetProductList(); ProductListResponse response = null; using (ProtoBufServiceClient client = new ProtoBufServiceClient(listenOnUrl)) { response = client.Get <ProductListResponse>(request); } if (response != null) { response.PrintDump(); } Console.WriteLine("成功获取所有产品。"); Console.ReadLine(); }
public async void QuestionAccordingToChoices() { if (GetQuestions.choicesMade == "Yes,") { GetProductList productList = new GetProductList(); await productList.GetProductsMatchingTheChoices(GetQuestions.question); QuestionBlock display = productList.GetQuestion(); panelForQuestion.Children.Add(display); count += 1; } else { GetQuestions getQuestions = new GetQuestions(); getQuestions.SetPreviousQuestion(); panelForQuestion.Children.RemoveAt(count); count -= 1; } }
public async void Test3() { GetProductList getProductList = new GetProductList(); RequestResponse choices = new RequestResponse() { Layer = "lastLayer", LayerMembers = new[] { "End" }, ChoiceDictionary = new Dictionary <string, string[]>() { { "startLayer", new[] { "" } }, { "Features", new[] { "" } }, { "Services", new[] { "" } }, { "DisplaySize", new[] { "" } } } }; await getProductList.GetProductsMatchingTheChoices(choices); var products = GetProductList.productListByChoices; Assert.Empty(products); }
public async Task <IHttpActionResult> Get([FromUri] GetProductList dto) { var resp = _productService.GetListAsync(dto); return(Ok(resp)); }
//获取产品列表: public ProductListResponse Get(GetProductList request) { ProductListResponse result = ProductRepository.GetProductList(); return(result); }
public Task <GetProductListResponse> GetListAsync(GetProductList dto) { return(Task.Run(() => { string sqlWhere = ""; switch (dto.type) { case Community.Contact.Enum.HotEnum.All: break; case Community.Contact.Enum.HotEnum.Hot: sqlWhere += string.Format(SELECT_PRODUCT_WHERE_HOT, 1); break; case Community.Contact.Enum.HotEnum.UnHot: sqlWhere += string.Format(SELECT_PRODUCT_WHERE_HOT, 0); break; default: break; } switch (dto.off_line) { case Community.Contact.Enum.OffLineEnum.All: break; case Community.Contact.Enum.OffLineEnum.OffLine: if (sqlWhere.Length < 1) { sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 1); } else { sqlWhere += " and "; sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 1); } break; case Community.Contact.Enum.OffLineEnum.UnOffLine: if (sqlWhere.Length < 1) { sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 0); } else { sqlWhere += " and "; sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 0); } break; default: break; } if (sqlWhere.Length > 1) { sqlWhere = " where " + sqlWhere; } if (!string.IsNullOrEmpty(dto.q)) { sqlWhere = sqlWhere + " and " + string.Format(SELECT_PRODUCT_WHERE_USER, dto.q); } List <SearchProductInfoModel> data = new List <SearchProductInfoModel>(); int count = 0; string sqlData = ""; string sqlCount = ""; if (string.IsNullOrEmpty(dto.category_id)) { sqlData = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_SELECT, sqlWhere, string.Format("LIMIT {0},{1}", dto.start, dto.length)); sqlCount = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_COUNT, sqlWhere, ""); } else { string[] typeidList = dto.category_id.Split(','); var builder = new StringBuilder(); for (int i = 0; i < typeidList.Length; i++) { builder.Append("category_id= " + typeidList[i]); if (i != typeidList.Length - 1) { builder.Append("||"); } } if (sqlWhere.Length > 0) { sqlWhere = sqlWhere + " and " + string.Format(SELECT_PRODUCT_WHERE_CAT, builder.ToString(), typeidList.Count() - 1); } else { sqlWhere = " where " + string.Format(SELECT_PRODUCT_WHERE_CAT, builder.ToString(), typeidList.Count() - 1); } sqlData = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_SELECT, sqlWhere, string.Format("LIMIT {0},{1}", dto.start, dto.length)); sqlCount = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_COUNT, sqlWhere, ""); } data = _dapperRepository.Query <SearchProductInfoModel>(sqlData).ToList(); if (data != null && data.Count() > 0) { count = _dapperRepository.QuerySingleOrDefault <int>(sqlCount); } GetProductListResponse resp = new GetProductListResponse(); resp.data = Mapper.Map <List <ProductInfo> >(data); resp.total = count; return resp; })); }
private void tabSelect_SelectedIndexChanged(object sender, EventArgs e) { switch (this.tabSelect.SelectedIndex) { case 0: tbesn.Focus(); tbesn.SelectAll(); if ((sMain.gUserInfo.rolecaption != "产品维修") && (sMain.gUserInfo.rolecaption != "系统开发员")) { MessageBox.Show(" 您当前的角色为: " + sMain.gUserInfo.rolecaption + "\r\n 非维修人员不能使用该页面功能 \r\n 自动跳转为查询界面"); tabSelect.SelectedIndex = 3; } break; case 1: tbsntorepair.Focus(); tbsntorepair.SelectAll(); btToRepair.Enabled = false; if ((sMain.gUserInfo.rolecaption != "产品维修") && (sMain.gUserInfo.rolecaption != "系统开发员")) { MessageBox.Show(" 您当前的角色为: " + sMain.gUserInfo.rolecaption + "\r\n 非维修人员不能使用该页面功能 \r\n 自动跳转为查询界面"); tabSelect.SelectedIndex = 3; } break; case 2: DataRow[] ArrDr = sMain.gUserInfo.userPopList.Select(string.Format("progid='FrmRepair' and funId='{0}'", "PD_Transfer".ToUpper())); if ((sMain.gUserInfo.rolecaption != "生产转账") && (sMain.gUserInfo.rolecaption != "系统开发员") && (ArrDr == null || ArrDr.Length < 1)) { MessageBox.Show(" 您当前的角色为: " + sMain.gUserInfo.rolecaption + "\r\n 非生产转账人员不能使用该页面功能 \r\n 自动跳转为查询界面"); tabSelect.SelectedIndex = 3; } tbRepairToLine.Focus(); tbRepairToLine.SelectAll(); break; case 3: tbesnselect.Focus(); tbesnselect.SelectAll(); break; case 5: GetProduct = new GetProductList(GettProductList); GetProduct.BeginInvoke(null, null); //// ThreadGetProduct = new Thread(new ThreadStart(GettProductList)); //ThreadGetProduct = new Thread((ThreadStart)(delegate() //{ //GettProductList(); //})); //ThreadGetProduct.Start(); break; } }