// GET: 客戶資料/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 ClientData = repoClientInfo.Find(id.Value);

            if (ClientData == null)
            {
                return(HttpNotFound());
            }
            return(View(ClientData));
        }
Exemplo n.º 2
0
        // GET: 客戶資料/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = repo.Find(id.Value);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 3
0
        // GET: 客戶資料/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = db.客戶資料.Find(id);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 4
0
        public ActionResult Create(客戶資料 newData)
        {
            if (ModelState.IsValid)
            {
                db.客戶資料.Add(newData);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(newData));
            }
        }
 public ActionResult UpdatePwd(int Id, String pwd)
 {
     if (!String.IsNullOrEmpty(pwd))
     {
         客戶資料 entity = _客戶資料Service.Read(Id);
         entity.密碼 = CryptographyUtils.SHA256Cryp(pwd);
         _客戶資料Service.Update(Id, entity);
         return(RedirectToAction("Index"));
     }
     else
     {
     }
     return(View());
 }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "Id,客戶名稱,客戶分類,統一編號,電話,傳真,地址,Email")] 客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                //db.客戶資料.Add(客戶資料);
                //db.SaveChanges();

                customerRepo.Add(客戶資料);
                customerRepo.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(客戶資料));
        }
Exemplo n.º 7
0
        public ActionResult Create(客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                //db.客戶資料.Add(客戶資料);
                //db.SaveChanges();
                客戶資料repo.Add(客戶資料);
                客戶資料repo.UnitOfWork.Commit();

                return(RedirectToAction("Index"));
            }

            return(View(客戶資料));
        }
        //// GET: Customer/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(Json(new { code = HttpStatusCode.BadRequest, result = false, message = "id不得為空值" }, JsonRequestBehavior.AllowGet));
            }
            客戶資料 客戶資料 = _CustomerRepository.Find(id.Value);

            if (客戶資料 == null)
            {
                return(Json(new { code = HttpStatusCode.BadRequest, result = false, message = "找不到客戶資料" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { code = HttpStatusCode.OK, result = true, data = JsonConvert.SerializeObject(客戶資料) }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        // GET: Customers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 result = customer.GetSingle(x => x.Id == id);

            if (result == null)
            {
                return(HttpNotFound());
            }
            return(View(result));
        }
Exemplo n.º 10
0
        public ActionResult EditProfile(int id, FormCollection form)
        {
            客戶資料 客戶資料 = repo.find(id);

            if (TryUpdateModel(客戶資料, null
                               , new string[] { "電話", "傳真", "地址", "Email", "password" }
                               ))
            {
                客戶資料.password = SHA256(form["password"]);
                repo.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }
            return(View(客戶資料));
        }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email")] 客戶資料 客戶資料)
        {
            ViewBag.message = webTitle;

            if (ModelState.IsValid)
            {
                客戶資料.是否已刪除 = true;
                db.客戶資料.Add(客戶資料);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(客戶資料));
        }
Exemplo n.º 12
0
        // GET: CustomerDatas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 customerData = customerdatasRepo.Find(id.Value);

            if (customerData == null)
            {
                return(HttpNotFound());
            }
            return(View(customerData));
        }
Exemplo n.º 13
0
        public ActionResult DeleteConfirmed(int id)
        {
            //客戶資料 客戶資料 = db.客戶資料.Find(id);
            客戶資料 客戶資料 = 客戶repo.Find(id);

            //db.客戶資料.Remove(客戶資料);
            //客戶資料.是否已刪除 = true;
            //db.SaveChanges();
            客戶repo.Delete(客戶資料);
            客戶repo.UnitOfWork.Commit();

            ViewBag.clientType = 客戶repo.Get客戶分類List();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        public IHttpActionResult Delete客戶資料(int id)
        {
            客戶資料 客戶資料 = db.客戶資料.Find(id);

            if (客戶資料 == null)
            {
                return(NotFound());
            }

            db.客戶資料.Remove(客戶資料);
            db.SaveChanges();

            return(Ok(客戶資料));
        }
Exemplo n.º 15
0
        public ActionResult EditProfile(string account)
        {
            account = string.IsNullOrEmpty(account) ? User.Identity.GetUserName() : account;

            客戶資料 客戶資料 = db.客戶資料.Include(客 => 客.客戶分類).
                        Where(客 => 客.是否刪除 == false && 客.帳號 == account).FirstOrDefault();

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            TempData["PassWord"] = 客戶資料.密碼;
            return(View(客戶資料));
        }
        public ActionResult Create(客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                //客戶資料.密碼 = FormsAuthentication.HashPasswordForStoringInConfigFile(客戶資料.密碼, "SHA1");
                repo.Add(客戶資料);
                repo.UnitOfWork.Commit();
                //db.客戶資料.Add(客戶資料);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(客戶資料));
        }
Exemplo n.º 17
0
 public ActionResult Create([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email")] 客戶資料 客戶資料)
 {
     if (ModelState.IsValid)
     {
         repo.Add(客戶資料);
         repo.UnitOfWork.Commit();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(ModelState.ToString()));
     }
     //  return View(客戶資料);
 }
Exemplo n.º 18
0
        // GET: 客戶資料/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = oRepository.Find(id);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 19
0
        public ActionResult Edit(客戶資料 客資)
        {
            var 客戶資料 = _客戶資料Repository.Find(客資.Id);

            if (TryUpdateModel(客戶資料, new string[] { "Id", "客戶名稱", "統一編號", "電話", "傳真", "地址", "Email", "客戶類別", "帳號" }))
            {
                _客戶資料Repository.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }


            ViewBag.客戶類別 = new SelectList(_客戶資料Repository.所有客戶類別(), "Key", "Value", 客資.客戶類別);
            return(View(客資));
        }
Exemplo n.º 20
0
 public ActionResult Edit([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email,客戶分類")] 客戶資料 客戶資料)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(客戶資料).State = EntityState.Modified;
         //db.SaveChanges();
         repo.UnitOfWork.Context.Entry(客戶資料).State = EntityState.Modified;
         repo.UnitOfWork.Commit();
         return(RedirectToAction("Index"));
     }
     //ViewBag.客戶分類 = new SelectList(repo.客戶分類ItemList(), 客戶資料.客戶分類);
     ViewBag.客戶分類 = repo.客戶分類ItemList(客戶資料.客戶分類);
     return(View(客戶資料));
 }
Exemplo n.º 21
0
        public ActionResult Create([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email,Account,Password")] 客戶資料 客戶資料)
        {
            客戶資料.Password = repo客戶資料.HashPassword(客戶資料.Account, 客戶資料.Password);

            if (ModelState.IsValid)
            {
                repo客戶資料.Add(客戶資料);
                repo客戶資料.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            ViewBag.客戶分類Id = new SelectList(repo客戶分類.All(), "Id", "客戶分類名稱", 客戶資料.客戶分類Id);
            return(View(客戶資料));
        }
Exemplo n.º 22
0
        public void Delete(int id)
        {
            客戶資料 dbEntity = Read(id);

            if (null != dbEntity)
            {
                _客戶資料Repository.Delete(dbEntity);
                _客戶資料Repository.SaveChanges();
            }
            else
            {
                //TODO:丟出錯誤訊息
            }
        }
Exemplo n.º 23
0
        // GET: 客戶資料/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = _客戶資料Service.Read(id.Value);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 24
0
        // GET: 客戶資料/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 data = repo.Find(id.Value);

            if (data == null)
            {
                return(HttpNotFound());
            }
            return(View(data));
        }
Exemplo n.º 25
0
        // GET: Customer/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = db.客戶資料.Where(i => i.IsValid == true && i.Id == id).FirstOrDefault();

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 26
0
        public ActionResult 客戶資料Create([Bind(Include = "Id,帳號,密碼,客戶名稱,統一編號,電話,傳真,地址,Email,客戶分類Id")] 客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                客戶資料.是否刪除 = false;
                客戶資料.密碼   = HashPassword(客戶資料.密碼);
                custRepo.Add(客戶資料);
                custRepo.UnitOfWork.Commit();
                return(RedirectToAction("客戶資料Index"));
            }

            ViewBag.客戶分類Id = new SelectList(db.客戶分類, "Id", "分類", 客戶資料.客戶分類Id);
            return(View(客戶資料));
        }
Exemplo n.º 27
0
        public ActionResult Edit([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email,客戶分類Id,帳號,密碼")] 客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                repo.Update(客戶資料);
                var db = repo.UnitOfWork.Context;
                db.Entry(客戶資料).State = EntityState.Modified;
                db.SaveChanges();;
                return(RedirectToAction("Index"));
            }
            ViewBag.客戶分類Id = new SelectList(categoryRepo.All(), "分類Id", "客戶分類", 客戶資料.客戶分類Id);

            return(View(客戶資料));
        }
Exemplo n.º 28
0
        // GET: Customer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = repo.Get單筆資料ById(id);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶資料));
        }
Exemplo n.º 29
0
        public ActionResult Edit(int id, 客戶資料 客戶資料)
        {
            if (ModelState.IsValid)
            {
                var item = repo.GetOne客戶資料(id);

                item.InjectFrom(客戶資料);

                repo.UnitOfWork.Commit();

                return(RedirectToAction("Index"));
            }
            return(View(客戶資料));
        }
Exemplo n.º 30
0
        // GET: Customer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶資料 客戶資料 = repoCustomer.Find(id.Value);

            if (客戶資料 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.客戶分類 = repoCustomer.GetCusType(客戶資料);
            return(View(客戶資料));
        }