public async Task <IActionResult> Create(Sell sell)
        {
            if (sell == null)
            {
                RedirectToAction(nameof(Error));
            }

            await _sellService.Create(sell);

            return(View());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("s_code,p_name,SellDate,s_amount,Price,Rating")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sell);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["p_name"] = new SelectList(_context.Product, "p_name", "p_name", sell.p_name);
            return(View(sell));
        }
Exemplo n.º 3
0
        public void DeleteAllOrdersByMarketMaker(string marketMakerId, bool deleteAllBuy, bool deleteAllSell)
        {
            if (deleteAllBuy)
            {
                Buy.DeleteAllOrdersByMarketMaker(marketMakerId);
            }

            if (deleteAllSell)
            {
                Sell.DeleteAllOrdersByMarketMaker(marketMakerId);
            }
        }
Exemplo n.º 4
0
 public static SellDto Create(Sell x, int price)
 {
     return(new SellDto
     {
         Id = x.id,
         Ts = x.Ts,
         Money = (uint)x.Sum,
         Fill = (uint)x.Volume,
         Price = (uint)price,
         IsCleaning = x.isCleaning
     });
 }
Exemplo n.º 5
0
        public async Task <IActionResult> PostSell([FromBody] Sell sell)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Sells.Add(sell);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSell", new { id = sell.ID }, sell));
        }
Exemplo n.º 6
0
        public IHttpActionResult PostSell(Sell sell)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Sells.Add(sell);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = sell.SellId }, sell));
        }
Exemplo n.º 7
0
 public int SaveItem(Sell item)
 {
     if (item.IdSaleTicket != 0)
     {
         db.Update(item);
         return(item.IdSaleTicket);
     }
     else
     {
         return(db.Insert(item));
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 销售单保存
 /// </summary>
 /// <param name="sell">销售单单实体</param>
 /// <param name="sd">销售明细实体</param>
 /// <param name="sp">销售流程实体</param>
 /// <param name="inStock">是否生成入库单</param>
 /// <returns></returns>
 public int SaveSellOdd(Sell sell, List <SellDetail> sd, SellProcess sp, bool inStock)
 {
     try
     {
         dal.SaveSellOdd(sell, sd, sp, inStock);
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 9
0
    private void OnMouseDown()
    {
        //panel.SetActive(true);

        upgr1.GetComponent <Button>().onClick.RemoveAllListeners();
        upgr2.GetComponent <Button>().onClick.RemoveAllListeners();
        Sell.GetComponent <Button>().onClick.RemoveAllListeners();

        InfoLabel.GetComponent <Text>().text = Name + "\nРадіус очищення " + Radius;

        Sell.GetComponent <Button>().onClick.AddListener(delegate { SellTree(); });
    }
Exemplo n.º 10
0
        public ActionResult Create([Bind(Include = "SellId,SellNumver,Date,BuyerName,BuyerDoc,PhoneNumber,TotalPrice")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                sell.Date = DateTime.Now;
                db.Sells.Add(sell);
                db.SaveChanges();
                return(RedirectToAction("Edit", new { id = sell.SellId }));
            }

            return(View(sell));
        }
Exemplo n.º 11
0
        public ActionResult DeleteSell(int id)
        {
            Sell    sell = db.Sells.Find(id);
            Sticker st   = sell.Sticker;

            st.Status = false;
            db.Sells.Remove(sell);
            db.Entry(st).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
        public Sell SelSellGatheringBySellCode(string Sell_Code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Sell_ID,Sell_Code,Sell_Type,Sell_Date,Sell_TransportType,Sell_Review,Sell_ChangeDate,Sell_Operation,Sell_Auditman,Sell_Remark,");
            strSql.Append("Sell_IsPay,Sell_IsPutSto,Sell_PayMathod,Sell_GetDate,Sell_Logistics,Sell_LogCode,Sell_LogPhone,Sell_OddMoney,Sell_AccountCode,Sell_InMoney,Sell_LastMoney,Sell_Address,");
            strSql.Append("Sell_ClientName,Sell_CliPhone,Sell_LinkMan,Sell_Salesman,Sell_OddStatus,Sell_jiajiState,Sell_zuiwanshijian,Sell_fukuanfangshi from T_Sell");
            strSql.Append(" where Sell_Code=@Sell_Code");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Sell_Code", SqlDbType.NVarChar, 512)
            };
            parameters[0].Value = XYEEncoding.strCodeHex(Sell_Code);
            SqlDataReader read = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters);

            while (read.Read())
            {
                Sell model = new Sell();
                model.Sell_ID            = Convert.ToInt32(read["Sell_ID"]);
                model.Sell_Code          = XYEEncoding.strHexDecode(read["Sell_Code"].ToString());
                model.Sell_Type          = XYEEncoding.strHexDecode(read["Sell_Type"].ToString());
                model.Sell_Date          = Convert.ToDateTime(read["Sell_Date"]);
                model.Sell_TransportType = XYEEncoding.strHexDecode(read["Sell_TransportType"].ToString());
                model.Sell_Review        = Convert.ToInt32(read["Sell_Review"]);
                model.Sell_ChangeDate    = Convert.ToDateTime(read["Sell_ChangeDate"]);
                model.Sell_Operation     = XYEEncoding.strHexDecode(read["Sell_Operation"].ToString());
                model.Sell_Auditman      = XYEEncoding.strHexDecode(read["Sell_Auditman"].ToString());
                model.Sell_Remark        = XYEEncoding.strHexDecode(read["Sell_Remark"].ToString());
                model.Sell_IsPay         = Convert.ToInt32(read["Sell_IsPay"]);
                model.Sell_IsPutSto      = Convert.ToInt32(read["Sell_IsPutSto"]);
                model.Sell_PayMathod     = Convert.ToInt32(read["Sell_PayMathod"]);
                model.Sell_GetDate       = Convert.ToDateTime(read["Sell_GetDate"]);
                model.Sell_Logistics     = XYEEncoding.strHexDecode(read["Sell_Logistics"].ToString());
                model.Sell_LogCode       = XYEEncoding.strHexDecode(read["Sell_LogCode"].ToString());
                model.Sell_LogPhone      = XYEEncoding.strHexDecode(read["Sell_LogPhone"].ToString());
                model.Sell_OddMoney      = read["Sell_OddMoney"].ToString();
                model.Sell_AccountCode   = XYEEncoding.strHexDecode(read["Sell_AccountCode"].ToString());
                model.Sell_InMoney       = read["Sell_InMoney"].ToString();
                model.Sell_LastMoney     = read["Sell_LastMoney"].ToString();
                model.Sell_Address       = XYEEncoding.strHexDecode(read["Sell_Address"].ToString());
                model.Sell_ClientName    = XYEEncoding.strHexDecode(read["Sell_ClientName"].ToString());
                model.Sell_CliPhone      = XYEEncoding.strHexDecode(read["Sell_CliPhone"].ToString());
                model.Sell_LinkMan       = XYEEncoding.strHexDecode(read["Sell_LinkMan"].ToString());
                model.Sell_Salesman      = XYEEncoding.strHexDecode(read["Sell_Salesman"].ToString());
                model.Sell_OddStatus     = Convert.ToInt32(read["Sell_OddStatus"]);
                model.Sell_jiajiState    = Convert.ToInt32(read["Sell_jiajiState"]);
                model.Sell_zuiwanshijian = Convert.ToDateTime(read["Sell_zuiwanshijian"]);
                model.Sell_fukuanfangshi = XYEEncoding.strHexDecode(read["Sell_fukuanfangshi"].ToString());
                return(model);
            }
            return(null);
        }
Exemplo n.º 13
0
    private void OnMouseDown()
    {
        //panel.SetActive(true);

        upgr1.GetComponent <Button>().onClick.RemoveAllListeners();
        upgr2.GetComponent <Button>().onClick.RemoveAllListeners();
        Sell.GetComponent <Button>().onClick.RemoveAllListeners();

        InfoLabel.GetComponent <Text>().text = Name + "\n" + "Покращення " + Upgrade + " го" + " рівня" + "\nРадіус враження " + Radius + "\nШтраф " + Shtraf;
        upgr1.GetComponent <Button>().onClick.AddListener(delegate { Upgr1(); });
        upgr2.GetComponent <Button>().onClick.AddListener(delegate { Upgr2(); });
        Sell.GetComponent <Button>().onClick.AddListener(delegate { SellUpgrade(); });
    }
Exemplo n.º 14
0
        public async Task CheckOutSellTestAsync()
        {
            string expectedResult = "Item Updated";
            string result         = String.Empty;
            string folio_Venta    = "b9ebd1a6-12a4-4834-8172-f26466bc60d9";

            Sell sell = new Sell(_sellRepository, _statusSellRepository, _productRepository);


            result = await sell.CheckOutSellAsync(folio_Venta, Guid.NewGuid().ToString());

            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 15
0
        public async Task <IActionResult> Create([Bind("Id,UserId,ProductId,Price,Units,Date")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sell);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Id", sell.ProductId);
            ViewData["UserId"]    = new SelectList(_context.Users2, "Id", "Id", sell.UserId);
            return(View(sell));
        }
Exemplo n.º 16
0
        public ActionResult DeleteCustomer(int customerId)
        {
            using (SalesEntities entities = new SalesEntities())
            {
                Sell Sale = (from c in entities.Sells
                             where c.CustomerId == customerId
                             select c).FirstOrDefault();
                entities.Sells.Remove(Sale);
                entities.SaveChanges();
            }

            return(new EmptyResult());
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Create([Bind("SellID,MedicineID,PharmacyID")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sell);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MedicineID"] = new SelectList(_context.Medicine, "MedicineID", "MedicineName", sell.MedicineID);
            ViewData["PharmacyID"] = new SelectList(_context.Pharmacy, "PharmacyID", "PharmacyName", sell.PharmacyID);
            return(View(sell));
        }
Exemplo n.º 18
0
        public ActionResult DeleteConfirmed(long id)
        {
            Sell sell = db.Sells.Find(id);

            // exclui todos os itens da venda primeiro
            db.SellItems
            .Where(i => i.SellId == id)
            .ToList()
            .ForEach(i => db.SellItems.Remove(i));
            db.Sells.Remove(sell);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IEnumerator ResetBatiment()
        {
            Controller.StopCoroutineWork(); //Stop coroutine => Sell All => Then restart Coroutine

            Debug.Log($"Ok ResetBatiment call ");

            var AllItemInStock   = Controller.GetStock().GetAllItemInStock();
            var list_itemRefSell = new List <Sell>();

            foreach (var it in AllItemInStock)
            {
                var BestShop  = Controller.GetShopHigherPriceForItem(it.ItemRef);
                var SellExist = list_itemRefSell.Find(x => x.Shop == BestShop);
                if (SellExist != null)
                {
                    SellExist.List_Item.Add(new ItemAmount(it.ItemRef, it.Amount));
                }
                else
                {
                    var v = new Sell()
                    {
                        IsMainAssignement  = false,
                        BatimentProduction = this,
                        TypeAssignement    = TypeAssignement.Sell,
                        Pos_Batiment       = Controller.transform.position,
                        Money = 0,
                        Shop  = BestShop
                    };
                    v.List_Item.Add(new ItemAmount(it.ItemRef, it.Amount));
                }
            }
            //Assign

            foreach (var sell in list_itemRefSell)
            {
                var emp = GetFreeNPCController();
                if (emp != null)
                {
                    emp.Assign(sell);
                }
                else
                {
                    AssignEnd(sell, false);
                }
            }
            yield return(new WaitForSeconds(15f));

            Controller.StartCoroutineWork();
            DateLastProduction = DateTime.Now;
            SecourEnCours      = false;
        }
Exemplo n.º 20
0
        public ActionResult ConfirmSell(string tradingAccountID, int buyID)
        {
            if (tradingAccountID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Portfolio       portfolio  = null;
            SailiRepository repository = new SailiRepository();

            portfolio = repository.GetPortfolio(tradingAccountID);

            if (portfolio == null)
            {
                return(HttpNotFound());
            }

            var buy = DefaultConnection.Buys.Find(buyID);

            if (!buy.PortfolioId.Equals(portfolio.PortfolioID))
            {
                DataSerializer <string> .SecurityPriorityNumberOne(User.Identity.GetUserId());

                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            Company         company  = new Company();
            List <Listings> listings = new List <Listings>();

            company = repository.GetCompany(company, buy.TickerSymbol);
            DataSerializer <string> .GetSingleListings(ref listings, company.Symbol);

            Sell sell = new Sell();

            sell.BuyID         = buy.BuyID;
            sell.TickerSymbol  = buy.TickerSymbol;
            sell.PurchasePrice = buy.PurchasePrice;

            foreach (var list in listings)
            {
                if (list.Symbol.Equals(sell.TickerSymbol))
                {
                    sell.SoldPrice = list.Close;
                }
            }

            TempData["ShareQuantity"] = buy.Quantity;
            TempData["CompanyName"]   = company.CompanyName;

            return(View(sell));
        }
Exemplo n.º 21
0
        public IActionResult Sell(Sell sellOrder)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            _dbContext.SellOrders.Add(sellOrder);
            _dbContext.SaveChanges();

            new Transaction(_dbContext).Try();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 22
0
        // GET: Sells/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sell sell = db.Sells.Find(id);

            if (sell == null)
            {
                return(HttpNotFound());
            }
            return(View(sell));
        }
Exemplo n.º 23
0
 public ActionResult Edit([Bind(Include = "SellID,CustomerID,ProductID,DateSell")] Sell sell)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sell).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", sell.CustomerID);
     ViewBag.SellID     = new SelectList(db.Empleyees, "EmpleyeeID", "Name", sell.SellID);
     ViewBag.SellID     = new SelectList(db.Orders, "OrderID", "Title", sell.SellID);
     ViewBag.ProductID  = new SelectList(db.Products, "ProductID", "Title", sell.ProductID);
     return(View(sell));
 }
Exemplo n.º 24
0
 public ActionResult sellProduct(Sell sell)
 {
     ViewBag.Customers = shop.GetsCustomers();
     ViewBag.Products  = shop.GetsproProducts();
     if (shop.SellProduct(sell) > 0)
     {
         ViewBag.Message = "Saved";
     }
     else
     {
         ViewBag.Message = "error";
     }
     return(View());
 }
Exemplo n.º 25
0
 private void Start()
 {
     sell   = FindObjectOfType <Sell>();
     shop   = FindObjectOfType <Shop>();
     battle = FindObjectOfType <Battle>();
     if (gameObject.transform.parent)
     {
         parentDeck = gameObject.transform.parent.GetComponent <Deck>();
     }
     else
     {
         Debug.Log("This Object has no parent");
     }
 }
Exemplo n.º 26
0
        public async Task <IActionResult> Create([Bind("id,ProductsId,CustomersId,StaffsId")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sell);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomersId"] = new SelectList(_context.Customers, "id", "id", sell.CustomersId);
            ViewData["ProductsId"]  = new SelectList(_context.Products, "Id", "Id", sell.ProductsId);
            ViewData["StaffsId"]    = new SelectList(_context.Set <Staffs>(), "Id", "Id", sell.StaffsId);
            return(View(sell));
        }
Exemplo n.º 27
0
    IEnumerator SendSell()
    {
        UnityWebRequest www = UnityWebRequest.Get("http://localhost:10000/sell");

        yield return(www.SendWebRequest());

        string json = www.downloadHandler.text;
        Sell   sell = JsonUtility.FromJson <Sell>(json);

        coin.text         = "코인 : " + sell.coin.ToString();
        context.text      = "판매 완료! 강화하시겠습니까? (" + sell.nowLevel.ToString() + "->" + (sell.nowLevel + 1).ToString() + ")";
        strengthText.text = "강화(" + sell.strengthCoin.ToString() + "코인)";
        sellText.text     = "판매(" + sell.sellCoin.ToString() + "코인)";
    }
Exemplo n.º 28
0
        public void CalculateTotal_HasItems_ReturnTotalAmount()
        {
            List <SoldItem> items = new List <SoldItem>
            {
                new SoldItem(1, 2, 1),
                new SoldItem(1, 2.50, 3)
            };

            Sell sell = new Sell(items);

            var result = sell.TotalAmount;

            Assert.That(result, Is.EqualTo(9.5));
        }
        /// <summary>
        /// 新增售房
        /// </summary>
        /// <returns></returns>
        public ActionResult AddSell(Sell sell, Selling selling, Transactions transactions)
        {
            int id = 0;
            int a  = bLL.SellsAdd(sell);

            //拿到  id
            if (a == 1)
            {
                id = bLL.Last()[0].SellID;
            }
            else
            {
                return(Content("<script>alert('该房屋已经上传');history.go(-1)</script>"));
            }

            int b = bLL.SellingAdd(selling, id);
            int c = bLL.TransactionsAdd(transactions, id);

            //添加商品图片
            if (Request.Files.Count > 0)
            {
                string[]      fileTypeStr = { "image/gif", "image/png", "image/jpeg", "image/jpg", "image/bmp" };
                List <string> strlist     = new List <string>();
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    if (fileTypeStr.Contains(Request.Files[i].ContentType))
                    {
                        string fileName = Path.GetFileName(Request.Files[i].FileName);
                        strlist.Add(fileName);
                    }
                }
                if (bLL.AddSImg(id, strlist))
                {
                    //保存文件
                    //应用程序需要有服务器UploadFile文件夹的读写权限
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        Request.Files[i].SaveAs(Server.MapPath("~/Content/Selling/" + Request.Files[i].FileName));
                    }
                }
            }
            if (b == 1 && c == 1)
            {
                return(Content("<script>alert('添加成功');history.go(-1)</script>"));
            }
            else
            {
                return(Content("<script>alert('添加失败');history.go(-1)</script>"));
            }
        }
Exemplo n.º 30
0
        public IHttpActionResult DeleteSell(int id)
        {
            Sell sell = db.Sells.Find(id);

            if (sell == null)
            {
                return(NotFound());
            }

            db.Sells.Remove(sell);
            db.SaveChanges();

            return(Ok(sell));
        }
Exemplo n.º 31
0
 public JsonMtGOX()
 {
     high = new High();
     low = new Low();
     avg = new Avg();
     vwap = new Vwap();
     vol = new Vol();
     lastlocal = new LastLocal();
     lastorig = new LastOrig();
     lastall = new LastAll();
     last = new Last();
     buy = new Buy();
     sell = new Sell();
     rootobject = new RootObject();
     returnObject = new Return();
 }
        public ProfitLoss CalculateProfitLoss(Buy buy, Sell sell)
        {
            double buyPrice = buy.Price * buy.Volume;
            double sellPrice = sell.Price * sell.Volume;
            double buyFees = feeCalc.CalculateFees(buy).Total;
            double sellFees = feeCalc.CalculateFees(sell).Total;
            double buyNet = buyPrice + buyFees;
            double sellNet = sellPrice - sellFees;

            ProfitLoss result = new ProfitLoss()
            {
                Amount = sellNet - buyNet,
                Ratio = (sellNet / buyNet) - 1.0
            };

            return result;
        }
        public Sell GetSellActionForTargetProfit(Buy buy, double targetProfit)
        {
            Sell sell = new Sell()
            {
                Price = buy.Price + targetProfit,
                Volume = buy.Volume
            };

            for (int i = 0; i < int.MaxValue; ++i)
            {
                ProfitLoss pl = CalculateProfitLoss(buy, sell);
                if (Math.Abs(pl.Amount - targetProfit) < config.epsilon)
                    break;
                if (targetProfit < pl.Ratio)
                    sell.Price -= config.epsilon;
                else
                    sell.Price += config.epsilon;
            }

            return sell;
        }