Esempio n. 1
0
        public void EstimateFeeTest()
        {
            // p2sh-p2wpkh
            UtxoData[] utxos    = GetBitcoinBnbUtxoList(CfdNetworkType.Mainnet);
            ExtPubkey  key      = new ExtPubkey("xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy");
            Address    setAddr1 = new Address(key.DerivePubkey(11).GetPubkey(), CfdAddressType.P2wpkh, CfdNetworkType.Mainnet);
            Address    setAddr2 = new Address(key.DerivePubkey(12).GetPubkey(), CfdAddressType.P2wpkh, CfdNetworkType.Mainnet);

            // amount = 85062500 + 39062500 = 124125000
            long        amount    = utxos[1].GetAmount() + utxos[2].GetAmount();
            long        feeAmount = 5000;
            long        amount1   = 100000000;
            long        amount2   = amount - amount1 - feeAmount;
            Transaction tx        = new Transaction(2, 0, new[] {
                new TxIn(utxos[1].GetOutPoint()),
                new TxIn(utxos[2].GetOutPoint()),
            }, new[] {
                new TxOut(amount1, setAddr1.GetLockingScript()),
                new TxOut(amount2, setAddr2.GetLockingScript()),
            });

            output.WriteLine("tx:\n" + tx.ToHexString());
            Assert.Equal("02000000020a9a33750a810cd384ca5d93b09513f1eb5d93c669091b29eef710d2391ff7300000000000ffffffff0a9bf51e0ac499391efd9426e2c909901edd74a97d2378b49c8832c491ad1e9e0000000000ffffffff0200e1f505000000001600144352a1a6e86311f22274f7ebb2746de21b09b15dc00a7001000000001600148beaaac4654cf4ebd8e46ca5062b0e7fb3e7470c00000000",
                         tx.ToHexString());

            FeeData feeData = tx.EstimateFee(new[] { utxos[1], utxos[2] }, 10.0);

            Assert.Equal(720, feeData.TxOutFee);
            Assert.Equal(1800, feeData.UtxoFee);
        }
Esempio n. 2
0
 /// <summary>
 /// 생성자(데이터 메모리 할당)
 /// </summary>
 public VehicleData()
 {
     AUTOHUB_CAR_STATE = string.Format(""); //0713추가
     AUTOHUB_ID        = string.Format(""); //0712 추가
     SeasonVehicleInfo = new string[(int)(AJEnums.DataLength.SeasonVehicleInfo)] {
         "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
     };
     EnteranceData = new string[(int)(AJEnums.DataLength.EnteranceData)] {
         "", "", "", "", "", ""
     };
     ExceptionInfo = new string[(int)(AJEnums.DataLength.ExceptionData)] {
         "", "", "", "", "", ""
     };
     VisitInfo = new string[(int)(AJEnums.DataLength.VisitData)] {
         "", ""
     };
     BlackListInfo = new string[(int)(AJEnums.DataLength.BlackList)] {
         ""
     };
     PrepaymentInfo = new string[(int)(AJEnums.DataLength.Prepayment)] {
         "", "", "", ""
     };
     Fee = new FeeData();
     arUsedDiscountData = new ArrayList();
 }
Esempio n. 3
0
        public ActionResult Edit(string id)
        {
            ViewBag.Status = StatusData.ListAll();
            Fee fee = FeeData.GetById(id);

            return(View(fee));
        }
Esempio n. 4
0
        public string GetFeeDetail(string callType, string xmlMessage)
        {
            string result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                            "<" + callType + ">" +
                            "<Result>False</Result>" +
                            "<Description></Description></" + callType + ">";

            string logID = Guid.NewGuid().ToString();

            try
            {
                FileLogger.WriteLog(logID + "|Start:" + xmlMessage, 1, "", callType);

                if (Helper.CheckAuthCode(callType, xmlMessage))//数据校验通过
                {
                    FeeData fee = new FeeData();

                    result = fee.GetFeeDetail(xmlMessage);
                }
            }
            catch (Exception err)
            {
                result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                         "<" + callType + ">" +
                         "<Result>False</Result>" +
                         "<Description>" + err.Message + "</Description></" + callType + ">";
            }
            FileLogger.WriteLog(logID + "|End:" + result, 1, "", callType);
            return(result);
        }
Esempio n. 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            FeeData feeData = db.FeeDatas.Find(id);

            db.FeeDatas.Remove(feeData);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
        // GET: Fee
        public ActionResult Index()
        {
            ViewBag.status = StatusData.ListAll();
            List <Fee> model = new List <Fee>();

            model = FeeData.ListAll();
            return(View(model));
        }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "FeeDataId,Particular,Amount")] FeeData feeData)
 {
     if (ModelState.IsValid)
     {
         db.Entry(feeData).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(feeData));
 }
Esempio n. 8
0
    public void GetValueEnquiry()
    {
        FeeData fdata = new FeeData();
        DataSet ds    = fdata.getFeeData("Select * from enquiry where id=" + Enquiryid);

        txtName.Text             = ds.Tables[0].Rows[0]["name"].ToString();
        txtmobile.Text           = ds.Tables[0].Rows[0]["mobile"].ToString();
        txtxEmail.Text           = ds.Tables[0].Rows[0]["email"].ToString();
        ddlCourses.SelectedValue = ds.Tables[0].Rows[0]["courses"].ToString();
    }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "FeeDataId,Particular,Amount")] FeeData feeData)
        {
            if (ModelState.IsValid)
            {
                db.FeeDatas.Add(feeData);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(feeData));
        }
Esempio n. 10
0
        public ActionResult Delete(Fee fee)
        {
            bool result = FeeData.Delete(fee.UniqueId.ToString());

            if (result)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
Esempio n. 11
0
        public ActionResult Edit(Fee fee)
        {
            bool result = FeeData.Edit(fee);

            if (result)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
Esempio n. 12
0
        // GET: FeeDatas/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FeeData feeData = db.FeeDatas.Find(id);

            if (feeData == null)
            {
                return(HttpNotFound());
            }
            return(View(feeData));
        }
Esempio n. 13
0
        public void FundRawTransactionExistTxInTest()
        {
            // p2sh-p2wpkh
            UtxoData[] utxos    = GetBitcoinBnbUtxoList(CfdNetworkType.Mainnet);
            ExtPubkey  key      = new ExtPubkey("xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy");
            Address    setAddr1 = new Address(key.DerivePubkey(11).GetPubkey(), CfdAddressType.P2wpkh, CfdNetworkType.Mainnet);
            Address    setAddr2 = new Address(key.DerivePubkey(12).GetPubkey(), CfdAddressType.P2wpkh, CfdNetworkType.Mainnet);

            // amount = 85062500 + 39062500 = 124125000
            long        amount1 = 100000000;
            long        amount2 = 100000000;
            Transaction tx      = new Transaction(2, 0, new[] {
                new TxIn(utxos[1].GetOutPoint()),
                new TxIn(utxos[2].GetOutPoint()),
            }, new[] {
                new TxOut(amount1, setAddr1.GetLockingScript()),
                new TxOut(amount2, setAddr2.GetLockingScript()),
            });

            output.WriteLine("tx:\n" + tx.ToHexString());
            Assert.Equal("02000000020a9a33750a810cd384ca5d93b09513f1eb5d93c669091b29eef710d2391ff7300000000000ffffffff0a9bf51e0ac499391efd9426e2c909901edd74a97d2378b49c8832c491ad1e9e0000000000ffffffff0200e1f505000000001600144352a1a6e86311f22274f7ebb2746de21b09b15d00e1f505000000001600148beaaac4654cf4ebd8e46ca5062b0e7fb3e7470c00000000",
                         tx.ToHexString());

            UtxoData[] inputUtxos = new[] {
                utxos[1],
                utxos[2],
            };
            Address addr1    = new Address(key.DerivePubkey(1).GetPubkey(), CfdAddressType.P2wpkh, CfdNetworkType.Mainnet);
            double  feeRate  = 20.0;
            string  usedAddr = tx.FundRawTransaction(inputUtxos, utxos, addr1.ToAddressString(), feeRate);

            output.WriteLine("tx: " + tx.ToHexString());

            Assert.Equal("02000000030a9a33750a810cd384ca5d93b09513f1eb5d93c669091b29eef710d2391ff7300000000000ffffffff0a9bf51e0ac499391efd9426e2c909901edd74a97d2378b49c8832c491ad1e9e0000000000ffffffff0a503dbd4f8f2b064c70e048b21f93fe4584174478abf5f44747932cd21da87c0000000000ffffffff0300e1f505000000001600144352a1a6e86311f22274f7ebb2746de21b09b15d00e1f505000000001600148beaaac4654cf4ebd8e46ca5062b0e7fb3e7470c0831b8040000000016001478eb9fc2c9e1cdf633ecb646858ba862b21384ab00000000",
                         tx.ToHexString());
            output.WriteLine(Transaction.DecodeRawTransaction(tx));
            Assert.Equal(addr1.ToAddressString(), usedAddr);
            Assert.Equal(7460, tx.GetLastTxFee());

            UtxoData[] feeUtxos = new[] {
                utxos[1],
                utxos[2],
                utxos[0],
            };
            FeeData feeData = tx.EstimateFee(feeUtxos, feeRate);

            Assert.Equal(7460, feeData.TxOutFee + feeData.UtxoFee);
            Assert.Equal(2060, feeData.TxOutFee);
            Assert.Equal(5400, feeData.UtxoFee);
        }
Esempio n. 14
0
 /// <summary>
 /// 데이터 메모리 릴리즈
 /// </summary>
 public void Dispose()
 {
     AUTOHUB_CAR_STATE = null;   //0713 추가
     AUTOHUB_ID        = null;   //0712 추가
     SeasonVehicleInfo = null;
     EnteranceData     = null;
     ExceptionInfo     = null;
     VisitInfo         = null;
     BlackListInfo     = null;
     PrepaymentInfo    = null;
     Fee.Dispose();
     Fee = null;
     arUsedDiscountData.Clear();
     arUsedDiscountData = null;
 }
Esempio n. 15
0
        public string SubmitFeeData(string callType, string xmlMessage)
        {
            string result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                            "<" + callType + ">" +
                            "<Result>False</Result>" +
                            "<Description></Description></" + callType + ">";

            string logID = Guid.NewGuid().ToString();

            try
            {
                FileLogger.WriteLog(logID + "|Start:" + xmlMessage, 1, "", callType);

                if (Helper.CheckAuthCode("UpdateFeeData", xmlMessage))//数据校验通过
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xmlMessage);
                    XmlNode pNode = doc.SelectSingleNode("UpdateFeeData");
                    XmlNode cNode = doc.CreateElement("Status");
                    cNode.InnerText = "0";
                    pNode.AppendChild(cNode);
                    xmlMessage = doc.OuterXml;

                    FeeData fee = new FeeData();

                    result = fee.Update(xmlMessage);
                    if (result != "-1")
                    {
                        result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                                 "<" + callType + ">" +
                                 "<Result>True</Result>" +
                                 "<ID>" + result + "</ID>" +
                                 "<Description></Description></" + callType + ">";
                    }
                }
            }
            catch (Exception err)
            {
                result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                         "<" + callType + ">" +
                         "<Result>False</Result>" +
                         "<Description>" + err.Message + "</Description></" + callType + ">";
            }
            FileLogger.WriteLog(logID + "|End:" + result, 1, "", callType);
            return(result);
        }
Esempio n. 16
0
    public string TestPayment()
    {
        string  Payment = "";
        DataSet ds      = null;

        try
        {
            FeeData brdata = new FeeData();
            ds = brdata.getFeeData("select remain_payment from fee");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string RemPayment = ds.Tables[0].Rows[i]["remain_payment"].ToString();
                Payment = RemPayment;
            }
        }
        catch (Exception ex) { }
        return(Payment);
    }
Esempio n. 17
0
        public ActionResult Index(FeeData model)
        {
            if (ModelState.IsValid)
            {
                var data = new AccountBook()
                {
                    Id         = Guid.NewGuid(),
                    Categoryyy = (int)model.FeeType,
                    Amounttt   = (int)model.Amount,
                    Dateee     = model.FeeDay,
                    Remarkkk   = model.Memo
                };

                db.AccountBook.Add(data);
                db.SaveChanges();
            }

            return(View());
        }
Esempio n. 18
0
        public FeeData[] LoadJson()
        {
            var path = "./feeData.json";

            if (System.IO.File.Exists(path))
            {
                var       text    = System.IO.File.ReadAllText(path);
                JArray    success = JArray.Parse(text);
                FeeData[] feeData = new FeeData[success.Count];

                for (var i = 0; i < success.Count; i++)
                {
                    feeData[i] = new FeeData();
                    feeData[i] = success[i].ToObject <FeeData>();
                }
                return(feeData);
            }

            return(null);
        }
Esempio n. 19
0
    protected void btnEnquirySubmit_Click(object sender, EventArgs e)
    {
        UsersData udata = new UsersData();

        udata.Name    = txtName.Text;
        udata.Email   = txtxEmail.Text;
        udata.Mobile  = txtmobile.Text;
        udata.Courses = ddlCourses.SelectedValue.ToString();
        udata.Save();
        DataSet ds        = udata.getUsersData("select max(id) from users");
        int     UserMaxid = int.Parse(ds.Tables[0].Rows[0][0].ToString());
        FeeData fdata     = new FeeData();

        fdata.Fee     = txtFee.Text;
        fdata.Userid  = int.Parse(ds.Tables[0].Rows[0][0].ToString());
        fdata.Payment = txtPayment.Text;
        int fee           = int.Parse(txtFee.Text);
        int payment       = int.Parse(txtPayment.Text);
        int remainpayment = int.Parse(txtFee.Text) - int.Parse(txtPayment.Text);

        fdata.Remain_payment = remainpayment.ToString();
        fdata.Save();
        Reset();
    }
 public NonBondStrategy(FeeData FeeData) : base(FeeData)
 {
 }
Esempio n. 21
0
        public ActionResult Delete(string id)
        {
            Fee fee = FeeData.GetById(id);

            return(View(fee));
        }
 public StrategyAccrContext(FeeData FeeData)
 {
     _FeeData = FeeData;
 }