public async Task GetChipsAsync(long amount = 0) { if (amount < 0) { await Context.Channel.SendMessageAsync($"> 👁️ You can't specify a **negative** value.\n> *\"I know what you were trying to do.\"*"); return; } if (amount == 0) { // $"> ⚠️ You need to specify a positive amount of **Orite** to convert. await Context.Channel.SendMessageAsync(CommandDetailsViewer.WriteGetChips()); return; } if (amount > Context.Account.Balance) { await Context.Channel.SendMessageAsync($"> ⚠️ You don't have enough **Orite** to convert this amount."); return; } var chips = MoneyConvert.ToChips(amount); Context.Account.Take(amount); Context.Account.ChipBalance += chips; await Context.Channel.SendMessageAsync($"> You have traded in **💸 {amount:##,0}** in exchange for **🧩 {chips:##,0}**."); }
public static void Main() { Console.WriteLine("This is a currency converter for USD,INR,FRANC,EURO!!!\n"); MoneyConvert m = new MoneyConvert(); while (true) { Console.WriteLine("Enter type:"); Console.WriteLine("Enter 1.INR:"); Console.WriteLine("Enter 2.USD:"); Console.WriteLine("Enter 3.FRANC:"); Console.WriteLine("Enter 4.EURO:"); Console.WriteLine("Enter 5.EXIT:"); Console.WriteLine("Enter source currency:"); int src = int.Parse(Console.ReadLine()); if (src == 5) { break; } Console.WriteLine("Enter destination currency:"); int dst = int.Parse(Console.ReadLine()); if (dst == 5) { break; } Console.WriteLine("Enter Amount:"); double amt = double.Parse(Console.ReadLine()); amt = m.change(src, dst, amt); Console.WriteLine(" Answer is = " + amt); } }
public async Task CashOutAsync(long amount = 0) { if (amount < 0) { await Context.Channel.SendMessageAsync($"> 👁️ You can't specify a **negative** value.\n> *\"I know what you were trying to do.\"*"); return; } if (amount == 0) { // $"> ⚠️ You need to specify a positive amount of **Orite** to convert. await Context.Channel.SendMessageAsync(CommandDetailsViewer.WriteCashOut()); return; } if (amount > Context.Account.TokenBalance) { await Context.Channel.SendMessageAsync($"> ⚠️ You don't have enough **Tokens** to convert this amount."); return; } long money = MoneyConvert.TokensToMoney(amount); Context.Account.Take(amount, CurrencyType.Tokens); Context.Account.Give(money, CurrencyType.Money); await Context.Channel.SendMessageAsync($"> You have traded in **{Icons.Tokens} {amount:##,0}** in exchange for **{Icons.Balance} {money:##,0}**."); }
protected void Page_Load(object sender, EventArgs e) { int recordID = Convert.ToInt32(Request["RecordID"]); int applyID = Convert.ToInt32(Request["ApplyID"]); bool rejected = Convert.ToBoolean(Request["rejected"]); Apply ap = Apply.GetApplyByID(applyID); OfficeSupplyApply oi = OfficeSupplyApply.GetOfficeSupplyApplyByID(recordID); staffName.Text = oi.StaffName; department.Text = oi.Department; reason.Text = oi.Reason; applyDate.Text = oi.ApplyDate.ToShortDateString(); processShow.Text = oi.ApproveProcess; double money = 0.0; supplyList.Text = transResult(oi.OfficeList, ref money); allExpensive.Text = money.ToString(); allExpensiveUpper.Text = MoneyConvert.convertToCapital(money.ToString()); //用户权限相关显示功能 Users usr = (Users)Session["Identify"]; BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID); if (!rejected && ap.NextApprover == oi.StaffName) { agreeButton.Visible = false; disagreeButton.Visible = false; whyDisagree.Visible = false; //可打印状态 proManager.Text = "已签字"; depManager.Text = "已签字"; counter.Text = "已签字"; cashier.Text = "已签字"; company.Text = "已签字"; } else if (info.StaffName.Trim() == oi.StaffName.Trim()) { agreeButton.Visible = false; disagreeButton.Visible = false; if (info.Position.Trim() != "出纳") { whyDisagree.Visible = false; } } //测试阶段保持处理流程可见,运行阶段记得去掉 processShow.Visible = true; }
protected void addRow_Click(object sender, EventArgs e) { addNewRow(); ViewState["count"] = Convert.ToInt16(ViewState["count"]) + 1; this.UpdatePanel1.Update(); //一定要加这句, 调用完函数后进行局部更新. double all = 0.0; List <OfficeSupplySingle> supplyList = getSupplyList(ref all); allExpensive.Text = all.ToString(); allExpensiveUpper.Text = MoneyConvert.convertToCapital(all.ToString()); this.UpdatePanel2.Update(); this.UpdatePanel3.Update(); }
protected void Page_Load(object sender, EventArgs e) { int recordID = Convert.ToInt32(Request["RecordID"]); int applyID = Convert.ToInt32(Request["ApplyID"]); bool rejected = Convert.ToBoolean(Request["rejected"]); Apply ap = Apply.GetApplyByID(applyID); Reimbursement ri = Reimbursement.GetReimbursementByID(recordID); if (!IsPostBack) { DataSet allPro = ProjectInfo.GetAllProjects(); accountList.DataSource = allPro.Tables[0].DefaultView; accountList.DataTextField = "ProjectAccount"; accountList.DataValueField = "ProjectAccount"; accountList.DataBind(); staffName.Text = ri.StaffName; department.Text = ri.Department; manager.Text = ri.Manager; payee.Text = ri.Payee; projectCode.Text = ri.ProjectCode; accountList.SelectedValue = ri.ProjectAccount; happenDate.Text = ri.HappenDate.ToShortDateString(); reimburseDate.Text = ri.ReimburestDate.ToShortDateString(); payeeDate.Text = ri.PayeeDate.ToShortDateString(); bill.Text = ri.Bill.ToString(); allExpense.Text = ri.AllExpense.ToString(); expense.Text = ri.Expense.ToString(); capital.Text = MoneyConvert.convertToCapital(ri.AllExpense.ToString()); remark.Text = ri.Remark; note.Text = ri.Note; processShow.Text = ri.ApproveProcess; } // //用户权限相关显示功能 Users usr = (Users)Session["Identify"]; BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID); if (!rejected && ap.NextApprover == ri.StaffName) { agreeButton.Visible = false; disagreeButton.Visible = false; cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; accountList.Enabled = false; //可打印状态 proManager.Text = "已签字"; depManager.Text = "已签字"; financial.Text = "已签字"; company.Text = "已签字"; } else if (info.StaffName.Trim() == ri.StaffName.Trim() || info.Position.Trim() == "出纳") { agreeButton.Visible = false; disagreeButton.Visible = false; accountList.Enabled = false; if (info.Position.Trim() != "出纳") { cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; } } else if (info.Position.Trim() == "会计") { accountList.Enabled = true; cashierButton.Visible = false; rejectButton.Visible = false; } else { accountList.Enabled = false; cashierButton.Visible = false; rejectButton.Visible = false; } //测试阶段保持处理流程可见,运行阶段记得去掉 processShow.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { int recordID = Convert.ToInt32(Request["RecordID"]); int applyID = Convert.ToInt32(Request["ApplyID"]); bool rejected = Convert.ToBoolean(Request["rejected"]); Apply ap = Apply.GetApplyByID(applyID); MoneyApply mi = MoneyApply.GetMoneyApplyByID(recordID); DataSet allPro = ProjectInfo.GetAllProjects(); accountList.DataSource = allPro.Tables[0].DefaultView; accountList.DataTextField = "ProjectAccount"; accountList.DataValueField = "ProjectAccount"; accountList.DataBind(); staffName.Text = mi.StaffName; department.Text = mi.Department; telephone.Text = mi.Telephone; payee.Text = mi.Payee; projectCode.Text = mi.ProjectCode; usage.Text = mi.Usage; plan.Text = mi.Plan; money.Text = mi.Money.ToString(); capital.Text = MoneyConvert.convertToCapital(mi.Money.ToString()); payDate.Text = mi.PayDate.ToShortDateString(); processShow.Text = mi.ApproveProcess; //用户权限相关显示功能 Users usr = (Users)Session["Identify"]; BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID); if (!rejected && ap.NextApprover.Trim() == mi.StaffName.Trim()) { agreeButton.Visible = false; disagreeButton.Visible = false; cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; accountList.Enabled = false; //可打印状态 proManager.Text = "已签字"; depManager.Text = "已签字"; financial.Text = "已签字"; company.Text = "已签字"; guanwei.Text = "已签字"; } else if (info.StaffName.Trim() == mi.StaffName.Trim() || info.Position.Trim() == "出纳") { agreeButton.Visible = false; disagreeButton.Visible = false; accountList.Enabled = false; if (info.Position.Trim() != "出纳") { cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; } } else if (info.Position.Trim() == "会计") { accountList.Enabled = true; cashierButton.Visible = false; rejectButton.Visible = false; } else { accountList.Enabled = false; cashierButton.Visible = false; rejectButton.Visible = false; } //测试阶段保持处理流程可见,运行阶段记得去掉 processShow.Visible = true; }
protected void money_TextChanged(object sender, EventArgs e) { capital.Text = MoneyConvert.convertToCapital(money.Text); this.capitalShow.Update(); }