Example #1
0
        public ActionResult AddFeedbackrecord(Feedbackrecord feedbackrecord)
        {
            Members member = membersService.GetByID(feedbackrecord.Memberid);

            if (feedbackrecord.Ishdz == 0)
            {
                if (TryUpdateModel(feedbackrecord, new string[] { "Ishdz", "Money", "Status", "Hdzaccount", "Remark" }) && ModelState.IsValid)
                {
                    feedbackrecord.Feedbackid = Guid.NewGuid();
                    feedbackrecord.Createdate = DateTime.Now;
                    feedbackrecord.Updatedate = DateTime.Now;
                    feedbackrecord.Remains    = member.Feedbackmoney - feedbackrecord.Money;
                    feedbackrecordService.Create(feedbackrecord);
                    feedbackrecordService.SaveChanges();
                }
            }
            else
            {
                if (TryUpdateModel(feedbackrecord, new string[] { "Ishdz", "Money", "Status", "Bankaccount", "Remark" }) && ModelState.IsValid)
                {
                    feedbackrecord.Feedbackid = Guid.NewGuid();
                    feedbackrecord.Createdate = DateTime.Now;
                    feedbackrecord.Updatedate = DateTime.Now;
                    feedbackrecord.Cash       = feedbackrecord.Money / 2;
                    feedbackrecord.Remains    = member.Feedbackmoney - feedbackrecord.Money;
                    feedbackrecordService.Create(feedbackrecord);
                    feedbackrecordService.SaveChanges();
                }
            }
            member.Feedbackmoney -= feedbackrecord.Money;
            membersService.SpecificUpdate(member, new string[] { "Feedbackmoney" });
            membersService.SaveChanges();
            return(RedirectToAction("Feedbackrecord"));
        }
Example #2
0
        public ActionResult Feedbacksuccess(Feedbackrecord feedbackrecord)
        {
            Guid    Memberid = Guid.Parse((Session["Memberid"]).ToString());
            Members Member   = membersService.GetByID(Session["Memberid"]);

            feedbackrecord.Feedbackid = Guid.NewGuid();
            feedbackrecord.Memberid   = Memberid;
            feedbackrecord.Hdzaccount = (Session["hdz_account"]).ToString();
            feedbackrecord.Money      = Convert.ToInt32(Session["Money"]);
            feedbackrecord.Remains    = Member.Feedbackmoney - Convert.ToInt32(Session["Money"]);
            feedbackrecord.Createdate = DateTime.Now;
            feedbackrecord.Updatedate = DateTime.Now;
            feedbackrecordService.Create(feedbackrecord);
            feedbackrecordService.SaveChanges();

            /*** 更新會員回饋金 ****/
            Member.Feedbackmoney -= Convert.ToInt32(Session["Money"]);
            membersService.SpecificUpdate(Member, new string[] { "Feedbackmoney" });
            membersService.SaveChanges();
            return(View());
        }