Example #1
0
        //GET: AnyDMorBuy/OrderingDetail
        public ActionResult OrderingDetail(string OrderID)
        {
            if (String.IsNullOrEmpty(OrderID))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //先判斷訂單是否已經結束
            //如果結束則返回已讀訊息
            int orderid = Int32.Parse(OrderID);
            var check   = db.CreateBuyOrder_LeaderOrders.Find(orderid);

            if (check.CanOrNotOrder == 1 || check.CanOrNotOrder == 2)
            {
                //將訂單已讀
                var Mail = Helper.GetUserMail();
                var UID  = AnyDMorBuy.GetUserID_UseEmail(Mail);
                var qu   = db.SendMessageViews.Where(m => m.OrderID == orderid && m.UserID == UID);
                foreach (var item in qu)
                {
                    item.ReadOrNot = true;
                }
                db.SaveChanges();
                TempData["message"] = "這筆訂單已經結束訂購囉!";
                return(RedirectToAction("MessageView_Read", "Home"));
            }

            var result = Models.AnyDMorBuy.GetOrderingDetail_UseOrderID(OrderID);

            ViewBag.OrderID = OrderID;
            return(View(result));
        }
Example #2
0
        //寄信團員選擇視圖
        public ActionResult _ChangeSendMemberPartial(ChangeMem MyMember)
        {
            //取得團員,但不顯示自己及管理者
            var MyID = Helper.GetUserMail();
            var Myid = AnyDMorBuy.GetUserID_UseEmail(MyID);

            var Member = db.Users.Where(m => m.ID != Myid && m.Identity != 1);

            if (MyMember.Member != null)
            {
                //文字不見了要補上
                foreach (var item in MyMember.Member)
                {
                    int Num = Int32.Parse(item.Value);
                    foreach (var userN in Member)
                    {
                        if (userN.ID == Num)
                        {
                            item.Text = userN.Name;
                            break;
                        }
                    }
                }

                ChangeMem Check2 = MyMember;
                return(PartialView("_ChangeSendMemberPartial", Check2));
            }


            var result = new List <SelectListItem>();

            foreach (var item in Member)
            {
                result.Add(
                    new SelectListItem {
                    Text = item.Name, Value = item.ID.ToString(), Selected = true
                }
                    );
            }

            var Check = new ChangeMem()
            {
                Member = result
            };

            return(PartialView("_ChangeSendMemberPartial", Check));
        }