public HttpResponseMessage isDeleteProductOnSales(DeleteProductOnSales productOnSales) { //string result = ""; BooleanMessage bm = new BooleanMessage(); Business business = new Business(); try { bm = business.isDeleteProductOnSales(productOnSales); } catch (Exception ex) { business.addErrorLog("WebApi", "isCreateProductOnSales", ex.Message); //Utility.ErrorMessageToLogFile(ex); //throw; } string result = JsonConvert.SerializeObject(bm); return(new HttpResponseMessage() { Content = new StringContent(result) }); }
public async Task <ActionResult> UpdateProduct(string updateProductCustomizeID = "", string productTypeID = "", string productCustomizeID = "", string productName = "", string productUnitName = "", string updateMemberID = "") { BooleanMessage bm = new BooleanMessage(); try { UpdateProduct updateProduct = new UpdateProduct(); updateProduct.UpdateProductCustomizeID = updateProductCustomizeID; updateProduct.ProductTypeID = productTypeID; updateProduct.ProductCustomizeID = productCustomizeID; updateProduct.ProductName = productName; updateProduct.ProductUnitName = productUnitName; updateProduct.UpdateMemberID = updateMemberID; bm = await isUpdateProduct(updateProduct); } catch (Exception ex) { bm.Message = ex.Message; } if (bm.Result == true) { return(RedirectToAction("Index")); } else { return(HttpNotFound()); } }
private IEnumerator HandleRegisterAccountRequest(NetworkMessage x) { var msg = x.ReadMessage <RegisterAccountRequestData>(); Result <bool> r = RegisterAccount(msg.userName, msg.passwordHash, msg.data); yield return(r.WaitUntilDone()); var success = r.Value; BooleanMessage resp = new BooleanMessage(); resp.value = success; x.conn.Send((short)CustomMessageTypes.RegisterAccountResponse, resp); yield break; }
public IEnumerator HandleLogoutRequestLogout(NetworkConnection con) { BooleanMessage resp = new BooleanMessage(); var user = GetAccountByConnection(con); if (user != null) { var success = Logout(user.userID); resp.value = success; con.Send((short)CustomMessageTypes.LogoutResponse, resp); yield break; } resp.value = false; con.Send((short)CustomMessageTypes.LogoutResponse, resp); }
public void PutBool(string key, bool value) { if (ws == null || ws.ReadyState != WebSocketState.Open) { // TODO: queue up any writes return; } Debug.Log(key + " " + value); var msg = new BooleanMessage(); Debug.Log(msg); msg.k = key; msg.v = value; //string json = msg.ToJson (); //Debug.Log ("Sending: "+ json); //ws.SendAsync(json, null); }
private IEnumerator HandleAcceptInvitationRequest(NetworkMessage x) { BooleanMessage resp = new BooleanMessage(); var user = GetAccountByConnection(x.conn); var invID = x.ReadMessage <StringMessage>(); if (user != null) { Result <bool> r = AcceptInviation(user.userID, invID.value); yield return(r.WaitUntilDone()); resp.value = r.Value; } else { resp.value = false; } x.conn.Send((short)CustomMessageTypes.AcceptInvitationResponse, resp); yield break; }
public async Task <BooleanMessage> isCreateProduct(CreateProduct createProduct) { BooleanMessage bm = new BooleanMessage(); try { HttpClient client = new HttpClient(); client.BaseAddress = new Uri(Properties.Settings.Default.ApiHost); var result = await client.PostAsJsonAsync("/api/WebApi/isCreateProduct", createProduct); string resultJson = await result.Content.ReadAsStringAsync(); bm = (BooleanMessage)JsonConvert.DeserializeObject(resultJson, typeof(BooleanMessage)); } catch (Exception ex) { bm.Message = ex.Message; } return(bm); }
public async Task <ActionResult> DeleteProduct(string deleteProductCustomizeID = "") { BooleanMessage bm = new BooleanMessage(); try { DeleteProduct deleteProduct = new DeleteProduct(); deleteProduct.DeleteProductCustomizeID = deleteProductCustomizeID; bm = await isDeleteProduct(deleteProduct); } catch (Exception ex) { bm.Message = ex.Message; } if (bm.Result == true) { return(RedirectToAction("Index")); } else { return(HttpNotFound()); } }
private IEnumerator HandleInviteFriendRequest(NetworkMessage x) { var user = GetAccountByConnection(x.conn); Result <AccountInfo> rr = GetAccountByUserName(x.ReadMessage <StringMessage>().value); yield return(rr.WaitUntilDone()); var invitee = rr.Value; BooleanMessage resp = new BooleanMessage(); if (user != null && invitee != null) { Result <bool> r = InviteFriend(user.userID, invitee.userID); yield return(r.WaitUntilDone()); resp.value = r.Value; } else { resp.value = false; } x.conn.Send((short)CustomMessageTypes.InviteFriendResponse, resp); yield break; }
private void button_Click(object sender, RoutedEventArgs e) { BooleanMessage bm = new BooleanMessage(); Business b = new Business(); //b.getProductChildType(); b.getProductTypePaging(); b.getFavoriteProduct("3"); b.getProductByProductTypeName("水果"); return; CreateProduct cp = new CreateProduct(); cp.DepartmentID = "1"; cp.ProductCustomizeID = "0009"; cp.ProductName = "3斤袋"; cp.ProductTypeID = "7"; cp.UpdateMemberID = "1"; bm = b.isCreateProduct(cp); UpdateProduct up = new UpdateProduct(); up.UpdateProductCustomizeID = "00044"; up.DepartmentID = "1"; up.ProductCustomizeID = "000456"; up.ProductName = "高山高麗菜"; up.ProductTypeID = "7"; up.UpdateMemberID = "1"; bm = b.isUpdateProduct(up); return; b.getProductPaging(1, currentPage: 2); var x = b.isLogin("buyer", LibraryTradeMarket.Utility.getSecretCode("1")); if (x != null) { MessageBox.Show(x.Account); } else { MessageBox.Show("error"); } return; DeleteProductOnSales dons = new DeleteProductOnSales(); dons.DepartmentID = "2"; dons.ProductCustomizeID = "00011"; b.isDeleteProductOnSales(dons); CreateProductOnSales ons = new CreateProductOnSales(); ons.ProductCustomizeID = "00011"; ons.UpdateMemberID = "2"; ons.DepartmentID = "2"; b.isCreateProductOnSales(ons); CreateCartOrder cco = new CreateCartOrder(); cco.BuyerID = "1"; cco.BuyerName = "neil"; cco.Contact = "qq"; cco.ContactAddressCityO = "taipei"; cco.ContactAddressAreaO = "dai an"; cco.ContactAddressStreetO = "rose"; cco.ContactAddressO = "236 5-4 1F"; cco.ContactAddressZipNoO = "116"; cco.ContactTel = "0911222333"; cco.DeliveryDate = "2017/5/20"; cco.SellerID = "83"; cco.SellerName = "mount"; cco.InvoiceNo = "23443322"; cco.InvoiceTitle = "Ntu"; cco.InvoiceType = "a"; cco.ShipmentType = "ubike"; cco.TempOrderID = "8c586bc7821c42f48b8c02af21cdd783"; b.isTempOrderToCartOrder(cco); return; CreateTempCart ctc = new CreateTempCart(); ctc.TempOrderID = "0515"; ctc.ProductCustomizeID = "0001"; ctc.ProductName = "白菜"; ctc.Quantity = "5"; ctc.Price = "18"; ctc.ProductUnitName = "PCS"; b.isCreateTempCart(ctc); UpdateTempCart utc = new UpdateTempCart(); utc.ProductCustomizeID = "0002"; utc.ProductName = "白菜2"; utc.Quantity = "50"; utc.Price = "180"; utc.ProductUnitName = "單位"; utc.UpdateID = "55"; b.isUpdateTempCart(utc); return; b.getProduct(1); CreateProductType cpt = new CreateProductType(); cpt.ProductTypeName = "進口類"; bm = b.isCreateProductType(cpt); UpdateProductType upt = new UpdateProductType(); //test upt.UpdateID = "5"; upt.ProductTypeName = "進口"; bm = b.isUpdateProductType(upt); //bm = b.isUpdateProduct("0001", "00011", "特級香蕉", ""); DeleteProductType dpt = new DeleteProductType(); dpt.DeleteProductTypeID = "6"; bm = b.isDeleteProductType(dpt); //bm = b.isUpdateProduct("0001", "00011", "特級香蕉", ""); DeleteProduct del = new DeleteProduct(); del.DeleteProductCustomizeID = "000111"; bm = b.isDeleteProduct(del); ProductViewModel p = new ProductViewModel(); p = b.getOneProduct("0001"); List <ProductViewModel> lp = new List <ProductViewModel>(); //lp = b.getProduct(1, "00", "", "菜", 0); b.getTempCart("fd0531a65184448fabd22d4881bb58e6"); b.addCart("q234", "0001", "bb", "10", "0", "PCS"); return; //ClassSqlclient cdb = new ClassSqlclient(); //cdb.ConnectionString = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=TradeMarket;Persist Security Info=True;User ID=rd;Password=allone"; //cdb.isOpen(); if (x != null) { MessageBox.Show(x.Account); } else { MessageBox.Show("error"); } //List<ProductTypeViewModel> l = new List<ProductTypeViewModel>(); //l = b.getProductType(); //List<ProductViewModel> lp = new List<ProductViewModel>(); //lp = b.getProductByType("水果"); //lp = b.getProductByKeyword("蕉"); }