public async Task <IActionResult> Edit(int id, [Bind("Id,Sum,Type,SubType,Date,Comment")] Spend spend) { if (id != spend.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(spend); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpendExists(spend.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(spend)); }
public Spend Add(Spend spend) { _context.Spends.Add(spend); _context.SaveChanges(); return(spend); }
private void ClickOnElementXAML(object sender, System.EventArgs e) { int index = profile.Spends.IndexOf((Spend)spendsList.SelectedItem); spend = (Spend)spendsList.SelectedItem; Navigation.PushAsync(new EditPurchase(spend, index)); }
// public bool isCanUplevel_deplete(int nID, int nLevel, out string error) { error = null; //// 获得升级心法需要的金钱 Spend needSpend = GetUplevelXinfaSpend(nID, nLevel /*nXinFaLevel + HaveUPLevelSkill*/); // 获得升级心法需要的经验 [10/13/2011 Ivan edit] int myExp = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Exp(); if (needSpend.dwSpendExperience > myExp) { //CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "Not enough Exp"); error = "#{Exp_Not_Enough}"; return(false); } ////使用客户端的数据来判断升级的金钱和经验是否够升级 int nCurMoney = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money(); if (needSpend.dwSpendMoney != -1) { if (needSpend.dwSpendMoney > nCurMoney) { error = "#{Money_Not_Enough}"; return(false); } } return(true); }
private void ClickOnElement(object sender, System.EventArgs e) { int index = names.IndexOf(purchases.SelectedItem.ToString()); spend = profile.Spends[names.IndexOf(purchases.SelectedItem.ToString())]; Navigation.PushAsync(new EditPurchase(spend, index)); }
// lấy lịch sử chi tiêu theo ngày public static List <Spend> loadSpend(DateTime date) { string query = string.Format("EXEC sp_GET_SPEND '{0}', '{1}'", Config.Username, date.ToString("yyyy-MM-dd")); DataTable result = DatabaseDAO.Instance.getDataExec(query); if (result != null && result.Rows.Count >= 0) { List <Spend> listSpend = new List <Spend>(); DataRowCollection rows = result.Rows; foreach (DataRow row in rows) { Spend spend = new Spend(); if (spend == null) { return(null); } spend.Name = row.ItemArray[1].ToString(); spend.Money = Convert.ToInt32(row.ItemArray[2]); spend.Date = Convert.ToDateTime(row.ItemArray[3].ToString()); listSpend.Add(spend); } return(listSpend); } return(null); }
public void Move(int x, int y) { cat.Clear(); cat.x = x; cat.y = y; cat.Draw(); Spend.Invoke($"За ход вы потратили {step_energy} энергии, всего осталось {this.Energy}", i++); }
private void MapWasteProductViewToModel(Spend spend, Command request, string categoryId) { spend.Price = request.Price; spend.Month = request.Month; spend.Year = request.Year; spend.OrderDay = request.OrderDay; spend.CategoryId = categoryId; }
//------------ //学习(升级)门派心法相关 五行属性 //------------ public void SendStudySkillEvent(int nSkillIDandLEVEL, int NPCID, int HaveUPLevelSkill) { int nXinfaID = nSkillIDandLEVEL; SCLIENT_SKILLCLASS pXinFa = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(nXinfaID); int nXinFaLevel = pXinFa.m_nLevel; int nSelfLevel = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Level(); CObject_Character pMySelf = CObjectManager.Instance.getPlayerMySelf(); // 判断人物等级是否达到 if (!isUpLevelXinfaRequirement(nXinfaID, nXinFaLevel + HaveUPLevelSkill)) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "Role levle Low"); return; } //// 获得升级心法需要的金钱 Spend needSpend = GetUplevelXinfaSpend(nXinfaID, nXinFaLevel + HaveUPLevelSkill); // 获得升级心法需要的经验 [10/13/2011 Ivan edit] int myExp = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Exp(); if (needSpend.dwSpendExperience > myExp) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "Not enough Exp"); return; } ////使用客户端的数据来判断升级的金钱和经验是否够升级 int nCurMoney = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money(); if (needSpend.dwSpendMoney != -1) { if (needSpend.dwSpendMoney > nCurMoney) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "Not enough money"); //ADDTALKMSG("升级需要的金钱不足"); return; } } if (GetUpLevelXinfaCDTime() > 0) { CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "CD Time"); return; } _STUDYXINFA_INFO studyInfo; CGAskStudyXinfa msg = (CGAskStudyXinfa)NetManager.GetNetManager().CreatePacket((int)PACKET_DEFINE.PACKET_CG_ASKSTUDYXINFA); studyInfo.m_idXinfa = (short)nXinfaID; //技能ID studyInfo.m_NowLevel = (short)nXinFaLevel; //技能等级 studyInfo.m_idMenpai = (short)NPCID; //师父ID msg.UplevelInfo = studyInfo; NetManager.GetNetManager().SendPacket(msg); }
public IList <Mst_Spend> Get_Picker_List() { using (var db = new MyContext()) { Spend spend = new Spend(db); var r = spend.Get_MasterSpend(); return(r); } }
/// <summary> /// 添加消费信息 /// </summary> /// <param name="s"></param> /// <returns></returns> public static int InsertSpendInfo(Spend s) { int n = 0; string sql = "insert CUSTOSPEND values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')"; sql = string.Format(sql, s.RoomNo, s.CustoNo, s.SpendName, s.SpendAmount, s.SpendPrice, s.SpendMoney, s.SpendTime, s.MoneyState); n = DBHelper.ExecuteNonQuery(sql); return(n); }
private void frmEditSpend_Load(object sender, EventArgs e) { //显示原来的数据 orgSpend = new Spend(); orgSpend = spendManage.SearchById(ID); dtDate.Text = orgSpend.日期.ToShortDateString(); txtMoney.Text = orgSpend.金额.ToString(); txtComefrom.Text = orgSpend.用途; }
public Spend CreateSpend(SpendRequest Spend) { var entityToInsert = new Spend() { }; MergeSpend(entityToInsert, Spend); SpendRepository.Insert(entityToInsert); return(entityToInsert); }
private void MergeSpend(Spend originalSpend, SpendRequest Spend) { originalSpend.Bill = this.BillRepository.GetById(Spend.BillId); originalSpend.Consortium = this.ConsortiumRepository.GetById(Spend.ConsortiumId); originalSpend.Type = this.SpendTypeRepository.GetById(Spend.SpendTypeId); originalSpend.SpendClass = this.SpendClassRepository.GetById(Spend.SpendClassId); originalSpend.Task = Spend.TaskId.HasValue ? this.TaskRepository.GetById(Spend.TaskId.Value) : null; originalSpend.Description = Spend.Description; originalSpend.PaymentDate = Spend.PaymentDate; }
private Spend MapWasteProductViewToModel(Command command, string categoryId) { var res = new Spend(); res.Month = command.Month; res.Price = command.Price; res.Year = command.Year; res.OrderDay = command.OrderDay; res.CategoryId = categoryId; return(res); }
// xóa một chi tiêu public static bool deleteSpend(Spend spend) { string query = string.Format("DELETE [CHITIEU] WHERE USERNAME = '******' AND NGAYGIO = '{1}'", Config.Username, spend.Date.ToString("yyyy-MM-DD HH:mm:ss")); int rows = DatabaseDAO.Instance.setDataExec(query); if (rows != -1) { return(true); } return(false); }
// thêm chi tiêu vào database public static bool addSpend(Spend spend) { string query = string.Format("INSERT INTO [CHITIEU] (USERNAME, TENCT, SOTIEN, NGAYGIO) VALUES ('{0}', N'{1}', {2}, '{3}')", Config.Username, spend.Name, spend.Money.ToString(), spend.Date.ToString("yyyy-MM-dd HH:mm:ss")); int row = DatabaseDAO.Instance.setDataExec(query); if (row != -1) { return(true); } return(false); }
public static Spend Map(SpendNewViewModel model) { var spend = new Spend(); spend.Sum = model.Sum; spend.Comment = model.Comment; spend.VectorId = model.VectorId; spend.CategoryId = model.CategoryId; spend.Date = model.Date; spend.BillId = model.BillId; return(spend); }
public bool AddSpend(Spend newSpend) { string sqlStr = "insert into Spend values(@money,@date,@usefor)"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@money", newSpend.金额), new SqlParameter("@date", newSpend.日期), new SqlParameter("@usefor", newSpend.用途) }; return(DBHelper.ExcuteCommand(sqlStr, param)); }
public async Task <Spend> AddSpend(Spend spend, string userID) { if (string.IsNullOrEmpty(spend.WalletId.ToString())) { spend.WalletId = WalletService.GetByName("default", userID).Id; } if (spend.Date == null) { throw new Exception("Spend need a date"); } return(await Repository.CreateAsync(spend)); }
public IActionResult Create([Bind] Spend spend) { if (ModelState.IsValid) { spend.UserId = GetUserId(); _spendService.Add(spend); return(RedirectToAction("Index")); } return(View(spend)); }
public ActionResult <Spend> Post([FromBody] Spend spend) { spend.UserId = GetUserId(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _spendService.Add(spend); return(CreatedAtAction("GetItem", new { id = spend.Id }, spend)); }
public Spend SearchById(int id) { string sqlstr = string.Format("select * from Spend where id={0}", id); DataTable dt = DBHelper.GetDataTable(sqlstr); Spend spend = new Spend(); DataRow r = dt.Rows[0]; spend.编号 = int.Parse(r["id"].ToString()); spend.金额 = float.Parse(r["money"].ToString()); spend.日期 = DateTime.Parse(r["date"].ToString()); spend.用途 = r["usefor"].ToString(); return(spend); }
public bool SaveEdit(Spend spend) { string sqlstr = "update Spend set money=@money,date=@date,usefor=@usefor where id=@id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@money", spend.金额), new SqlParameter("@date", spend.日期), new SqlParameter("@usefor", spend.用途), new SqlParameter("@id", spend.编号) }; return(DBHelper.ExcuteCommand(sqlstr, param)); }
public async Task <IActionResult> Create([Bind("Id,Sum,Type,SubType,Date,Comment")] Spend spend) { spend.Date = DateTime.Now; if (ModelState.IsValid) { _context.Add(spend); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(spend)); }
private void btnCheckIn_Click(object sender, EventArgs e) { if (CheckInupt()) { #region 获取添加消费信息所需的信息 Spend s = new Spend(); s.RoomNo = txtRoomNo.Text; s.CustoNo = txtCustoNo.Text; s.SpendName = "住房"; s.SpendAmount = Convert.ToInt32(txtCheckNum.Text); s.SpendPrice = Convert.ToDecimal(txtMoney.Text); s.SpendMoney = Convert.ToDecimal(Convert.ToDouble(txtMoney.Text)); s.SpendTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); s.MoneyState = "未结算"; #endregion if (CustoManager.SelectCustoByCustoNo(txtCustoNo.Text) != null) { Room r = new Room(); r.CheckTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); r.CustoNo = txtCustoNo.Text; r.PersonNum = txtPersonNum.Text; r.RoomStateId = 1; r.RoomNo = txtRoomNo.Text; int n = RoomManager.UpdateRoomInfo(r); if (n > 0) { MessageBox.Show("登记入住成功!", "登记提示"); SpendManager.InsertSpendInfo(s); txtCustoNo.Text = ""; this.Close(); #region 获取添加操作日志所需的信息 Operation o = new Operation(); o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss")); o.Operationlog = LoginInfo.WorkerClub + LoginInfo.WorkerPosition + LoginInfo.WorkerName + "于" + DateTime.Now + "帮助" + r.CustoNo + "进行了入住操作!"; o.OperationAccount = LoginInfo.WorkerClub + LoginInfo.WorkerPosition + LoginInfo.WorkerName; #endregion OperationManager.InsertOperationLog(o); } else { MessageBox.Show("登记入住失败!", "登记提示"); } } else { MessageBox.Show("客户编号不存在!", "来自小T的提示"); } } }
public async Task <ApiResult <bool> > Create(RequestCreate request) { var spend = new Spend() { Name = request.Name, Description = request.Description, Img = request.Img, Status = true, }; _context.Spends.Add(spend); await _context.SaveChangesAsync(); return(new ApiSuccessResult <bool>()); }
public static SpendLastAddViewModel Map2LastAddViewModel(Spend spend) { var model = new SpendLastAddViewModel(); model.Id = spend.Id; model.Sum = spend.Sum; model.SpendCategoryName = spend.SpendCategory.Name; model.SpendVectorName = spend.SpendVector.Name; model.SpendVectorBgColorClass = spend.SpendVector.BgColorClass; model.SpendVectorIconName = spend.SpendVector.IconName; model.SpendVectorSysName = spend.SpendVector.SysName; model.Date = spend.Date; model.BillName = spend.SpendBills != null ? spend.SpendBills.Name:"Счет не указан"; return(model); }
public static SpendTopViewModel Map2TopViewModel(Spend spend) { var model = new SpendTopViewModel(); model.Sum = spend.Sum; model.SpendCategoryName = spend.SpendCategory.Name; model.SpendVectorName = spend.SpendVector.Name; model.SpendCategoryId = spend.CategoryId; model.SpendVectorId = spend.VectorId; model.SpendVectorSysName = spend.SpendVector.SysName; model.SpendVectorBgColorClass = spend.SpendVector.BgColorClass; model.SpendVectorIconName = spend.SpendVector.IconName; model.Date = spend.Date; return(model); }
private void btnCheckIn_Click(object sender, EventArgs e) { if (CheckInupt()) { #region 获取添加消费信息所需的信息 Spend s = new Spend(); s.RoomNo = txtRoomNo.Text; s.CustoNo = txtCustoNo.Text; s.RoomName = txtType.Text; s.SpendPrice = Convert.ToDecimal(txtMoney.Text); s.SpendMoney = Convert.ToDecimal(Convert.ToDouble(txtMoney.Text) * Convert.ToDouble(txtCheckNum.Text)); s.SpendTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); s.MoneyState = "未结算"; #endregion if (BLL.CustoService.SelectCustoByCustoNo(txtCustoNo.Text) != null) { Room r = new Room(); r.CheckTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); r.CustoNo = txtCustoNo.Text; r.PersonNum = txtPersonNum.Text; r.RoomType = 1; r.RoomStateId = 1; r.RoomNo = txtRoomNo.Text; int n = BLL.RoomService.UpdateRoomInfo(r); if (n > 0) { MessageBox.Show("登记入住成功!", "登记提示"); int m = BLL.SpendService.InsertSpendInfo(s); if (m <= 0) { MessageBox.Show("错误"); } txtCustoNo.Text = ""; this.Close(); } else { MessageBox.Show("登记入住失败!", "登记提示"); } } else { MessageBox.Show("客户编号不存在!", "错误提示"); } } }