Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public Spend Add(Spend spend)
        {
            _context.Spends.Add(spend);
            _context.SaveChanges();

            return(spend);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
    //
    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);
    }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        // 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);
        }
Ejemplo n.º 7
0
 public void Move(int x, int y)
 {
     cat.Clear();
     cat.x = x;
     cat.y = y;
     cat.Draw();
     Spend.Invoke($"За ход вы потратили {step_energy} энергии, всего осталось {this.Energy}", i++);
 }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
    //------------
    //学习(升级)门派心法相关 五行属性
    //------------
    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);
    }
Ejemplo n.º 10
0
 public IList <Mst_Spend> Get_Picker_List()
 {
     using (var db = new MyContext())
     {
         Spend spend = new Spend(db);
         var   r     = spend.Get_MasterSpend();
         return(r);
     }
 }
Ejemplo n.º 11
0
        /// <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);
        }
Ejemplo n.º 12
0
        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.用途;
        }
Ejemplo n.º 13
0
        public Spend CreateSpend(SpendRequest Spend)
        {
            var entityToInsert = new Spend()
            {
            };

            MergeSpend(entityToInsert, Spend);
            SpendRepository.Insert(entityToInsert);
            return(entityToInsert);
        }
Ejemplo n.º 14
0
 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;
 }
Ejemplo n.º 15
0
            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);
            }
Ejemplo n.º 16
0
        // 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);
        }
Ejemplo n.º 17
0
        // 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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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));
        }
Ejemplo n.º 20
0
 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));
 }
Ejemplo n.º 21
0
        public IActionResult Create([Bind] Spend spend)
        {
            if (ModelState.IsValid)
            {
                spend.UserId = GetUserId();
                _spendService.Add(spend);

                return(RedirectToAction("Index"));
            }


            return(View(spend));
        }
Ejemplo n.º 22
0
        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));
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        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));
        }
Ejemplo n.º 25
0
        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));
        }
Ejemplo n.º 26
0
        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的提示");
                }
            }
        }
Ejemplo n.º 27
0
        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>());
        }
Ejemplo n.º 28
0
        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);
        }
Ejemplo n.º 29
0
        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);
        }
Ejemplo n.º 30
0
        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("客户编号不存在!", "错误提示");
                }
            }
        }