예제 #1
0
    void Start()
    {
        topics = GameObject.Find("Topic").GetComponent <Topic>();
        coin   = GameObject.Find("currency").GetComponent <currency>();

        SetColorHex();
    }
예제 #2
0
        public override TransactionResponse CommitTransaction(TransactionRequest request)
        {
            try
            {
                MerchantWebServiceClient client = new MerchantWebServiceClient("MerchantWebServicePort");

                currency currencyEnum = currency.USD;
                Enum.TryParse(CurrencyCode, out currencyEnum);

                sendMoneyRequest req = new sendMoneyRequest();
                req.amount            = request.Payment.ToDecimal();
                req.currency          = currencyEnum;
                req.email             = request.PayeeId.Replace(" ", "");
                req.note              = request.Note;
                req.amountSpecified   = true;
                req.currencySpecified = true;

                var response = client.sendMoney(getAuthDTO(), req);
                return(new AdvCashTransactionResponse(this, response));
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
                return(new AdvCashTransactionResponse(this, ex));
            }
        }
        public async Task <IActionResult> Putcurrency(int id, currency currency)
        {
            if (id != currency.id)
            {
                return(BadRequest());
            }

            _context.Entry(currency).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!currencyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public IHttpActionResult post([FromBody] currency currencies)
 {
     try
     {
         if (string.IsNullOrEmpty(currencies.name))
         {
             ModelState.AddModelError("name", "Name is Required");
         }
         if (ModelState.IsValid)
         {
             using (Count10_DevEntities entities = new Count10_DevEntities())
             {
                 currencies.active     = currencies.active.HasValue ? currencies.active : true;
                 currencies.archived   = currencies.archived.HasValue ? currencies.archived : false;
                 currencies.created_by = currencies.created_by.HasValue ? currencies.created_by : 1;
                 currencies.updated_by = currencies.updated_by.HasValue ? currencies.updated_by : 1;
                 currencies.created_at = DateTime.Now;
                 currencies.updated_at = DateTime.Now;
                 entities.currencies.Add(currencies);
                 entities.SaveChanges();
                 var message = Request.CreateResponse(HttpStatusCode.Created, currencies);
             }
             return(Ok(currencies));
         }
         return(BadRequest(ModelState));
     }
     catch (Exception)
     {
         return(BadRequest(ModelState));
     }
 }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,record_date,name,exchange")] currency currency)
        {
            if (id != currency.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(currency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!currencyExists(currency.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(currency));
        }
예제 #6
0
        public async Task <ActionResult> Edit([Bind(Include = "currencyID,currency1,isActive")] currency currency)
        {
            try
            {
                var s = repo.Single(currency.currencyID);

                if (s == null)
                {
                    return(HttpNotFound());
                }
                s.currency1     = currency.currency1;
                s.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                s.isActive      = currency.isActive;
                s.isSelected    = currency.isSelected;
                s.modifiedBy    = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));

                if (ModelState.IsValid)
                {
                    repo.Update(s);
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
            }
            return(View(currency));
        }
예제 #7
0
 public ActionResult CurrencyCreateEdit(currency currency)
 {
     result              = currencyUtil.CreateEditCurrency(currency);
     ViewBag.Title       = currency == null ? "Currency Create" : "Currency Edit";
     ViewBag.action_name = STUtil.GetListAllActionByController("");
     return(Json(result));
 }
예제 #8
0
        private void AddRates()
        {
            DataAccess           da    = new DataAccess();
            List <currency_rate> rates = new List <currency_rate>();

            // USD
            currency      c1 = da.GetCurrency("USD");
            currency_rate r1 = new currency_rate();

            r1.currency  = c1;
            r1.rate      = decimal.Parse(edtUSD.Text);
            r1.rate_date = edtDate.SelectedDate.Value;

            // EURO
            currency      c2 = da.GetCurrency("EUR");
            currency_rate r2 = new currency_rate();

            r2.currency  = c2;
            r2.rate      = decimal.Parse(edtEURO.Text);
            r2.rate_date = edtDate.SelectedDate.Value;

            // RUR
            currency      c3 = da.GetCurrency("RUR");
            currency_rate r3 = new currency_rate();

            r3.currency  = c3;
            r3.rate      = decimal.Parse(edtRUR.Text) / 100;
            r3.rate_date = edtDate.SelectedDate.Value;

            rates.Add(r1);
            rates.Add(r2);
            rates.Add(r3);
            da.CurrencyRatesCreate(rates);
        }
 public HttpResponseMessage put(int id, [FromBody] currency currencies)
 {
     try
     {
         using (Count10_DevEntities entities = new Count10_DevEntities())
         {
             var entity = entities.currencies.FirstOrDefault(e => e.id == id);
             if (entity == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Currency with Id = " + id.ToString() + " not found to edit"));
             }
             else
             {
                 entity.name             = currencies.name;
                 entity.alt_name         = currencies.alt_name;
                 entity.iso_code         = currencies.iso_code;
                 entity.iso_number       = currencies.iso_number;
                 entity.fractionals      = currencies.fractionals;
                 entity.fractionals_name = currencies.fractionals_name;
                 entity.display_name     = currencies.display_name;
                 entity.placement        = currencies.placement;
                 entity.notes            = currencies.notes;
                 entities.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, entity));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
예제 #10
0
        public async Task <ActionResult <currency> > Postcurrency(currency currency)
        {
            _context.currencies.Add(currency);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getcurrency", new { id = currency.id }, currency));
        }
예제 #11
0
        public currency GetCurrency()
        {
            currency dbItem = new currency {
                id = this.Id, currency1 = Currency, value = Value
            };

            return(dbItem);
        }
예제 #12
0
// Use this for initialization
    void Start()
    {
        //find the Experience script and set it to be referenced as xp in this script
        xp = (Experience)GameObject.FindObjectOfType(typeof(Experience));
        //find the currency script and set it to be referenced as coins in this script
        coins = (currency)GameObject.FindObjectOfType(typeof(currency));
        //
        Perf = (Performance)GameObject.FindObjectOfType(typeof(Performance));
    }
        public void Currency_GivenValuesWithEnumRateAndConvertedToXDocument_PersistsValues()
        {
            var currency = new currency(CurrencyEnum.EUR, RateEnum.CBRF);

            var xCurrency = new YmlSerializer().ToXDocument(currency).Root;

            xCurrency.Should().NotBeNull();
            xCurrency.Should().HaveAttribute("id", CurrencyEnum.EUR.ToString());
            xCurrency.Should().HaveAttribute("rate", RateEnum.CBRF.ToString());
        }
예제 #14
0
        private currency getItemFromFields()
        {
            currency item = new currency();

            item.id         = _id;
            item.name       = edtName.Text;
            item.code       = edtCode.Text;
            item.short_name = edtShortName.Text;
            item.is_basic   = edtBasic.IsChecked.HasValue ? (edtBasic.IsChecked.Value ? 1 : 0) : 0;
            return(item);
        }
예제 #15
0
        public Account CreateAccount(User.User user, currency cur)
        {
            Account account = new Account();

            account.CreateDate = DateTime.Now.AddMonths(rnd.Next(1, 12) * -1);
            account.Number     = cur.ToString().ToUpper() + rnd.Next();
            account.Balance    = 0;
            account.UserId     = user.Id;
            account.Currency   = cur;
            return(account);
        }
예제 #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                currency   curr   = new currency();
                CurrencyDB currDB = new CurrencyDB();

                curr.CurrencyID = txtID.Text;
                curr.name       = txtName.Text;
                curr.symbol     = txtSymbol.Text;
                curr.status     = ComboFIll.getStatusCode(cmbStatus.SelectedItem.ToString());
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;


                if (currDB.validateCurrency(curr))
                {
                    if (btnText.Equals("Update"))
                    {
                        if (currDB.updateCurrency(curr))
                        {
                            MessageBox.Show("Currency updated");
                            closeAllPanels();
                            ListCurrency();
                        }
                        else
                        {
                            MessageBox.Show("Failed to update Currency");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        if (currDB.insertCurrency(curr))
                        {
                            MessageBox.Show("Currency Added");
                            closeAllPanels();
                            ListCurrency();
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert Currency");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Currency Data Validation failed");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing Currency");
            }
        }
예제 #17
0
        public async Task <IActionResult> Create([Bind("ID,record_date,name,exchange")] currency currency)
        {
            if (ModelState.IsValid)
            {
                _context.Add(currency);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(currency));
        }
예제 #18
0
 void Start()
 {
     if (_currency == null)
     {
         _currency = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #19
0
        //#region Contact Title
        //public ActionResult ContactTitleIndex(string id)
        //{
        //    ViewBag.Title = "Contact Title List";
        //    contact_title c = new contact_title();
        //    if (id != null && id != "")
        //    {
        //        c = db.contact_title.Find(Convert.ToInt32(id));
        //    }

        //    return View(c);
        //}
        //public ActionResult ContactTitleList(int id)
        //{
        //    var list = db.contact_title.AsEnumerable().ToList();
        //    var data = (from li in list
        //                select new
        //                {
        //                    contact_title_name = li.contact_title_name,
        //                    contact_title_id = li.contact_title_id,
        //                    is_active = li.is_active,
        //                }).ToList();
        //    return Json(data);
        //}
        //// GET: /Country/Create
        //public ActionResult ContactTitleEdit(string id)
        //{
        //    var data = (from c in db.contact_title.AsEnumerable()
        //                where c.contact_title_id == Convert.ToInt32(id)
        //                select new
        //                {
        //                    contact_title_id = c.contact_title_id,
        //                    contact_title_name = c.contact_title_name,
        //                    is_active = c.is_active,
        //                }).FirstOrDefault();

        //    return Json(data);
        //}
        //// POST: /Country/Create
        //[HttpPost]
        //public ActionResult ContactTitleCreateEdit(contact_title contact_title)
        //{
        //    result = contactTitleUtil.CreateEditContactTitle(contact_title);
        //    ViewBag.Title = contact_title == null ? "ContactTitle Create" : "ContactTitle Edit";
        //    ViewBag.action_name = STUtil.GetListAllActionByController("");
        //    return Json(result);
        //}
        //#endregion

        #region Currency
        public ActionResult CurrencyIndex(string id)
        {
            STUtil.SetSessionValue(UserInfo.pageTitle.ToString(), "Currency");
            currency c = new currency();

            if (id != null && id != "")
            {
                c = db.currencies.Find(Convert.ToInt32(id));
            }

            return(View(c));
        }
예제 #20
0
    currency currency;              //reference the currency script and give it a name in this script

    // Use this for initialization
    void Start()
    {
        //find the currency script and set it to be referenced as currency in this script
        currency = (currency)GameObject.FindObjectOfType(typeof(currency));
        if (ActivateSound != null)
        {
            AudioSource.PlayClipAtPoint(ActivateSound, transform.position);//Play the audio at myself
        }
        else
        {
            Debug.LogError("Activate Sound is not assigned ");//type out an error message to the Console
        }
    }
예제 #21
0
        public IActionResult Post([FromBody]currency value)
        {
            var currency = new currency();

            currency.name = value.name;
            currency.isActive = true;

            _context.currency.Add(currency);
            _context.SaveChanges();

            var send = _context.currency.Where(c => c.currencyId == currency.currencyId).FirstOrDefault<currency>();

            return Ok(send);
        }
예제 #22
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            currency = await _context.currency.FirstOrDefaultAsync(m => m.ID == id);

            if (currency == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #23
0
        public bool EditCurrency(currency currency)
        {
            try
            {
                currency emp = _entities.currencies.Find(currency.currency_id);
                emp.currency_name = currency.currency_name;
                _entities.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
예제 #24
0
        public bool DeleteCurrency(long currency_id)
        {
            try
            {
                currency oCurrency = _entities.currencies.FirstOrDefault(c => c.currency_id == currency_id);
                _entities.currencies.Attach(oCurrency);
                _entities.currencies.Remove(oCurrency);
                _entities.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public JsonResult Delete(int id)
        {
            currency      dbItem   = RepoCurrency.FindByPk(id);
            ResponseModel response = new ResponseModel(true);
            string        message;

            //if (!RepoCurrency.IsAllowDelete(dbItem))
            //{
            //    message = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "DeleteFailedForeignKey").ToString();
            //    response.SetFail(message);
            //}
            //else
            //    RepoCurrency.Delete(dbItem);

            return(Json(response));
        }
예제 #26
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            currency = await _context.currency.FindAsync(id);

            if (currency != null)
            {
                _context.currency.Remove(currency);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #27
0
        public IActionResult deactivate(int id, [FromBody]currency value)
        {
            var currency = _context.currency.Where(c => c.currencyId == id).FirstOrDefault<currency>();

            if (currency != null)
            {
                currency.isActive = false;

                _context.SaveChanges();

                return Ok(currency);
            }
            else
            {
                return NotFound();
            }

        }
예제 #28
0
        public decimal getRate(DateTime date, currency currency)
        {
            if (currency == currency.RUR)
            {
                return(1);
            }
            DailyInfo cbrClient = new DailyInfo();

            cbrClient.Proxy = new WebProxy("http://msk01-wsncls02.uralsibins.ru:8080")
            {
                Credentials = new NetworkCredential(@"uralsibins\svcTinkoff", "USER4tinkoff"),
            };
            XmlNode       resultXml  = cbrClient.GetCursOnDateXML(date);
            XmlSerializer serializer = new XmlSerializer(typeof(ValuteData));
            ValuteData    result     = (ValuteData)serializer.Deserialize(new StringReader(resultXml.OuterXml));

            return(result.ValuteCursOnDate.Single(A => A.VchCode, currency.ToString()).Vcurs);
        }
예제 #29
0
 public long AddCurrency(currency currency)
 {
     try
     {
         currency insert_currency = new currency
         {
             currency_name = currency.currency_name
         };
         _entities.currencies.Add(insert_currency);
         _entities.SaveChanges();
         long last_insert_id = insert_currency.currency_id;
         return(last_insert_id);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
예제 #30
0
        public async Task <ActionResult> Create([Bind(Include = "currencyID,currency1,isActive")] currency currency)
        {
            try
            {
                currency.dataIsCreated = BaseUtil.GetCurrentDateTime();
                currency.dataIsUpdated = BaseUtil.GetCurrentDateTime();

                if (ModelState.IsValid)
                {
                    repo.Insert(currency);
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
            }
            return(View(currency));
        }