// GET: BackStage public ActionResult Index() { if (!string.IsNullOrEmpty(User.Identity.Name)) { var data = repo客戶資料.Find(Convert.ToInt32(User.Identity.Name)); var model = new BackStageDataVM(); if (User.Identity.Name != "0") { model.傳真 = data.傳真; model.地址 = data.地址; model.密碼 = data.密碼; model.電話 = data.電話; model.Email = data.Email; model.密碼 = ""; } return(View(model)); } else { return(Redirect("/Home/Index/")); } }
public ActionResult Delete(int Id) { var item = repo.Find(Id); item.是否刪除 = true; repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); }
public ActionResult Details(int id) { var item = repo.Find(id); if (item == null) { return(RedirectToAction("Index")); } return(View(item)); }
// GET: 客戶專區 public ActionResult Index() { var data = repo客戶資料.Find(Convert.ToInt32(User.Identity.Name)); Mapper.Initialize(cfg => cfg.CreateMap <客戶資料, 客戶專區_資料修改VM>()); 客戶專區_資料修改VM model = Mapper.Map <客戶專區_資料修改VM>(data); model.密碼 = ""; return(View(model)); }
// 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)); }
// 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(客戶資料)); }
// 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)); }
// GET: Customers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var customer = repo.Find(id.Value); if (customer == null) { return(HttpNotFound()); } return(View(customer)); }
public ActionResult GetContactEmails(string customerName) { string errMsg = ""; try { var customer = customerRepo.Find(customerName); if (customer != null) { var contactEmails = customerContactRepo.FindContactEmailsByCustomerId(customer.Id).ToList(); if (contactEmails.Count() > 0) { return(Json( contactEmails, JsonRequestBehavior.AllowGet)); } else { errMsg = "No contacts!"; } } else { errMsg = "This customer" + customerName + "not exist!"; } } catch (Exception ex) { errMsg = ex.Message; } return(Json(new{ err = errMsg }, JsonRequestBehavior.AllowGet)); }
// GET: 客戶資料/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶資料 客戶資料 = Repo.Find(id); if (客戶資料 == null) { return(HttpNotFound()); } ViewBag.客戶聯絡人s = Repo.Get客戶聯絡人by客戶資料ID(id); return(View(客戶資料)); }
public ActionResult SettingAccount(int id) { if (!User.Identity.IsAuthenticated) { return(Content("未登入")); } return(PartialView(repo.Find(id))); }
// GET: 客戶資料/Details/5 public ActionResult Details(int?id) { if (id == null) { //return new HttpStatusCodeResult(HttpStatusCode.BadRequest); throw new ArgumentException("id 不存在或為空值"); } 客戶資料 客戶資料 = repo.Find(id); if (客戶資料 == null) { return(HttpNotFound()); } return(View(客戶資料)); }
public ActionResult CreateAccPwd(int?id) { var data = rep.Find(id.Value); data.帳號 = "qweerty0322"; var sha256 = new System.Security.Cryptography.SHA256CryptoServiceProvider(); //建立一個SHA256 byte[] source = System.Text.Encoding.Default.GetBytes("123456"); //將字串轉為Byte[] byte[] crypto = sha256.ComputeHash(source); //進行SHA256加密 string result = Convert.ToBase64String(crypto); //把加密後的字串從Byte[]轉為字串 data.密碼 = result; rep.UnitOfWork.Commit(); return(RedirectToAction("Index", "Home")); }
public ActionResult normalUserEdit(客戶資料normalVM 客戶資料) { 客戶資料 client = repo.Find(客戶資料.Id); if (ModelState.IsValid) { client.電話 = 客戶資料.電話; client.傳真 = 客戶資料.傳真; client.地址 = 客戶資料.地址; client.Email = 客戶資料.Email; if (!string.IsNullOrEmpty(客戶資料.密碼)) { string pd = LoginViewModel.Encrypt(客戶資料.密碼); client.密碼 = pd; } repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } ViewData.Model = client; return(View("Index")); }
public ActionResult Export() { XSSFWorkbook workbook = new XSSFWorkbook(); MemoryStream ms = new MemoryStream(); // 新增試算表 ISheet sheet = workbook.CreateSheet("客戶聯絡人"); #region Header 職稱、姓名、Email、手機、電話、客戶名稱 sheet.CreateRow(1).CreateCell(0).SetCellValue("職稱"); sheet.GetRow(1).CreateCell(1).SetCellValue("姓名"); sheet.GetRow(1).CreateCell(2).SetCellValue("Email"); sheet.GetRow(1).CreateCell(3).SetCellValue("手機"); sheet.GetRow(1).CreateCell(4).SetCellValue("電話"); sheet.GetRow(1).CreateCell(5).SetCellValue("客戶名稱"); #endregion List <客戶聯絡人> list = new List <客戶聯絡人>(); list = repo客戶聯絡人.All().ToList(); for (int i = 0; i < list.Count(); i++) { sheet.CreateRow(i + 2).CreateCell(0).SetCellValue(list[i].職稱); sheet.GetRow(i + 2).CreateCell(1).SetCellValue(list[i].姓名); sheet.GetRow(i + 2).CreateCell(2).SetCellValue(list[i].Email.ToString()); sheet.GetRow(i + 2).CreateCell(3).SetCellValue(list[i].手機); sheet.GetRow(i + 2).CreateCell(4).SetCellValue(list[i].電話); var CustName = repo客戶資料.Find(list[i].客戶Id).客戶名稱.ToString(); sheet.GetRow(i + 2).CreateCell(5).SetCellValue(CustName); } workbook.Write(ms); workbook = null; ms.Close(); ms.Dispose(); return(File(ms.ToArray(), "application/vnd.ms-excel", "客戶聯絡人.xls")); }
public ActionResult Export() { XSSFWorkbook workbook = new XSSFWorkbook(); MemoryStream ms = new MemoryStream(); // 新增試算表 ISheet sheet = workbook.CreateSheet("客戶銀行資訊"); #region Header 銀行名稱、銀行代碼、分行代碼、帳戶名稱、帳戶號碼、客戶名稱 sheet.CreateRow(1).CreateCell(0).SetCellValue("銀行名稱"); sheet.GetRow(1).CreateCell(1).SetCellValue("銀行代碼"); sheet.GetRow(1).CreateCell(2).SetCellValue("分行代碼"); sheet.GetRow(1).CreateCell(3).SetCellValue("帳戶名稱"); sheet.GetRow(1).CreateCell(4).SetCellValue("帳戶號碼"); sheet.GetRow(1).CreateCell(5).SetCellValue("客戶名稱"); #endregion List <客戶銀行資訊> list = new List <客戶銀行資訊>(); list = repo客戶銀行資訊.All().ToList(); for (int i = 0; i < list.Count(); i++) { sheet.CreateRow(i + 2).CreateCell(0).SetCellValue(list[i].銀行名稱); sheet.GetRow(i + 2).CreateCell(1).SetCellValue(list[i].銀行代碼); sheet.GetRow(i + 2).CreateCell(2).SetCellValue(list[i].分行代碼.ToString()); sheet.GetRow(i + 2).CreateCell(3).SetCellValue(list[i].帳戶名稱); sheet.GetRow(i + 2).CreateCell(4).SetCellValue(list[i].帳戶號碼); var CustName = repo客戶資料.Find(list[i].客戶Id).客戶名稱.ToString(); sheet.GetRow(i + 2).CreateCell(5).SetCellValue(CustName); } workbook.Write(ms); workbook = null; ms.Close(); ms.Dispose(); return(File(ms.ToArray(), "application/vnd.ms-excel", "客戶銀行資訊.xls")); }
public ActionResult Details_聯絡人清單(int id) { ViewData.Model = repo.Find(id).客戶聯絡人.ToList(); return(PartialView("Details_聯絡人清單")); }