//private 客戶資料Entities db = new 客戶資料Entities();

        // GET: 客戶銀行資訊
        public ActionResult Index(int?page)
        {
            var pageNumber = page ?? 1;
            var data       = repo.All().OrderBy(x => x.Id).ToPagedList(pageNumber, 1);

            return(View(data));
        }
Exemple #2
0
        // GET: BankInfo
        public ActionResult Index()
        {
            //var 客戶銀行資訊 = db.客戶銀行資訊.Include(客 => 客.客戶資料).Where(c => c.是否已刪除 == false);
            var 客戶銀行資訊 = repo.All();

            return(View(客戶銀行資訊.ToList()));
        }
        //新增客戶清單列表
        public ActionResult CustomerList()
        {
            var contact = contactRepo.All();
            var bank    = bankRepo.All();
            var data    = customerRepo.GetContactBankCount(contact, bank);

            return(View("CustomerList", data));
        }
Exemple #4
0
        public ActionResult Index(string searchString)
        {
            var datas = repo.All();

            if (!String.IsNullOrEmpty(searchString))
            {
                datas = datas.Where(p => p.銀行名稱.Contains(searchString));
            }
            return(View(datas));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index()
        {
            var model = new CustomerBankInfoListViewModel
            {
                SearchParameter = new SearchParameterViewModel(),
                //CustomerBankInfo = db.客戶銀行資訊.Include(客 => 客.客戶資料).Where(c => c.是否已刪除 == false).OrderBy(x => x.銀行名稱)
                CustomerBankInfo = customerBankInfoRepo.All()
            };

            return(View(model));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index(string bankName = "", int page = 1)
        {
            var data = repo.All().Where(p => !p.客戶資料.Is刪除);;

            if (!string.IsNullOrEmpty(bankName))
            {
                data = data.Where(p => p.銀行名稱.Contains(bankName));
            }
            data             = data.OrderBy(p => p.Id);
            ViewBag.bankName = bankName;
            return(View(data.ToPagedList(page, pageSize)));
        }
Exemple #7
0
        // GET: 客戶銀行資訊
        public ActionResult Index()
        {
            //var 客戶銀行資訊 = db.客戶銀行資訊.Include(客 => 客.客戶資料);
            var 客戶銀行資訊 = repo.All().Include(p => p.客戶資料);

            return(View(客戶銀行資訊.ToList()));
        }
Exemple #8
0
        public ActionResult Index(string 查詢條件_名稱)
        {
            var data = repo.All(查詢條件_名稱);

            ViewData.Model = data;
            return(View());
        }
Exemple #9
0
        // GET: 客戶銀行資訊
        public ActionResult Index()
        {
            //var 客戶銀行資訊 = db.客戶銀行資訊.Where(p => false == p.是否已刪除).Include(客 => 客.客戶資料);
            var 客戶銀行資訊 = repo.All();

            return(View(客戶銀行資訊.ToList()));
        }
        /// <summary>
        /// EXCEL 輸出客戶銀行資料;
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportCustomerBankDatasExcel()
        {
            using (XLWorkbook wb = new XLWorkbook())
            {
                var data = customerBankDatasRepo.All().Select(c => new
                {
                    c.客戶資料.客戶名稱,
                    c.銀行代碼,
                    c.分行代碼,
                    c.銀行名稱,
                    c.帳戶名稱,
                    c.帳戶號碼,
                }).ToList();

                var ws = wb.Worksheets.Add("cusBankdata", 1);
                ws.Cell(1, 1).InsertData(data);

                using (MemoryStream memoryStream = new MemoryStream())
                {
                    wb.SaveAs(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);
                    // application/vnd.ms-excel
                    return(this.File(memoryStream.ToArray(), "application/vnd.ms-excel", "客戶銀行資料.xlsx"));
                }
            }
        }
        public ActionResult 客戶銀行資訊Excel()
        {
            客戶銀行資訊Repository repo  = RepositoryHelper.Get客戶銀行資訊Repository();
            List <客戶銀行資訊>    items = repo.All().ToList();
            var dt = ConvertToDataTable(items);

            ExportExcel(dt, "客戶銀行資訊");
            return(RedirectToAction("客戶銀行資訊Excel", "File"));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index()
        {
            var vm = new 客戶銀行資訊VM()
            {
                客戶銀行資訊s = Repo.All().Include(客 => 客.客戶資料).ToList()
            };

            return(View(vm));
        }
Exemple #13
0
        // GET: 客戶銀行資訊
        public ActionResult Index(string keyword)
        {
            var data = repo客戶銀行資訊.All();

            if (!string.IsNullOrEmpty(keyword))
            {
                data = data.Where(p => p.帳戶名稱.Contains(keyword));
            }
            return(View(data));
        }
Exemple #14
0
        public ActionResult ExcelOutput()
        {
            var       repodata     = repo.All();
            var       data         = from s1 in repodata select new { s1.銀行名稱, s1.銀行代碼, s1.分行代碼, s1.帳戶名稱, s1.帳戶號碼, s1.客戶資料.客戶名稱 };
            var       l_ExcelClass = new ExcelClass();
            DataTable l_datatable  = l_ExcelClass.ToDataTable(data);
            string    OutputPath   = l_ExcelClass.ExcelOutput(l_datatable, "CustomerAccount");

            return(File(Server.MapPath(OutputPath), "application/vnd.ms-excel"));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index(string keyword)
        {
            var 客戶銀行資訊 = repo.All().Include(客 => 客.客戶資料);

            客戶銀行資訊 = 客戶銀行資訊.Where(w => w.IsDelete != true);
            if (!String.IsNullOrEmpty(keyword))
            {
                客戶銀行資訊 = 客戶銀行資訊.Where(w => w.銀行名稱.Contains(keyword));
            }
            return(View(客戶銀行資訊.ToList()));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index(string keyword)
        {
            var data = repo.All().AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                data = data.Where(bank => bank.客戶資料.客戶名稱.Contains(keyword));
            }
            ViewBag.keyword = keyword;
            return(View(data.ToList()));
        }
Exemple #17
0
        // GET: 客戶銀行資訊
        public ActionResult Index(string searchString)
        {
            var 客戶銀行資訊 = repoBank.All();

            if (!String.IsNullOrEmpty(searchString))
            {
                客戶銀行資訊 = repoBank.Get關鍵字(searchString);
            }

            return(View(客戶銀行資訊));
        }
        //private 客戶資料Entities db = new 客戶資料Entities();

        // GET: customerbank
        public ActionResult Index(string qname)
        {
            if (string.IsNullOrWhiteSpace(qname))
            {
                return(View("Index", repo.All().ToList()));
            }
            else
            {
                return(View("Index", repo.搜尋名稱(qname)));
            }
        }
Exemple #19
0
        // GET: 客戶銀行資訊
        public ActionResult Index(string search)
        {
            //var 客戶銀行資訊 = db.客戶銀行資訊.Include(客 => 客.客戶資料).Where(客 => 客.是否已刪除 != true);
            var 客戶銀行資訊 = repo.All().Include(客 => 客.客戶資料).Where(客 => 客.是否已刪除 != true);

            if (!string.IsNullOrEmpty(search))
            {
                客戶銀行資訊 = 客戶銀行資訊.Where(客 => 客.帳戶名稱.Contains(search) || 客.帳戶號碼.Contains(search) || 客.銀行名稱.Contains(search));
            }
            return(View(客戶銀行資訊.ToList()));
        }
Exemple #20
0
 // GET: Bank
 public ActionResult Index(string search)
 {
     if (string.IsNullOrWhiteSpace(search))
     {
         return(View(repo.All().Include(客 => 客.客戶資料)));
     }
     else
     {
         return(View(repo.Get客戶銀行資訊ListBy帳戶名稱(search).Include(p => p.客戶資料)));
     }
 }
        public ActionResult Index(客戶銀行資訊ViewModel 客戶銀行資訊)
        {
            var client = repo.All().Include(x => x.客戶資料);

            if (!string.IsNullOrEmpty(客戶銀行資訊.搜尋銀行名稱))
            {
                client = repo.FindName(客戶銀行資訊.搜尋銀行名稱, client);
            }

            if (!string.IsNullOrEmpty(客戶銀行資訊.sort_col))
            {
                bool sort = 客戶銀行資訊.isSort;
                if (sort == false)
                {
                    if (客戶銀行資訊.sort_col == "客戶名稱")
                    {
                        client = (from o in client
                                  orderby o.客戶資料.客戶名稱
                                  select o);
                    }
                    else
                    {
                        client = client.OrderByField(客戶銀行資訊.sort_col, true);
                    }
                }
                else
                {
                    if (客戶銀行資訊.sort_col == "客戶名稱")
                    {
                        client = (from o in client
                                  orderby o.客戶資料.客戶名稱 descending
                                  select o);
                    }
                    else
                    {
                        client = client.OrderByField(客戶銀行資訊.sort_col, false);
                    }
                }
                if (ViewBag.isSort != sort)
                {
                    ViewBag.isSort = sort;
                }
            }
            else
            {
                client         = client.OrderBy(c => c.Id);
                ViewBag.isSort = true;
            }
            var orderClient = client.ToPagedList(客戶銀行資訊.page == 0 ? 1 : 客戶銀行資訊.page, pageSize);

            ViewBag.currentPage = 客戶銀行資訊.page == 0 ? 1 : 客戶銀行資訊.page;
            ViewBag.搜尋銀行名稱      = 客戶銀行資訊.搜尋銀行名稱;
            return(View(orderClient));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index(string keyword = "")
        {
            var 客戶銀行資訊 = bankRepo.All();

            if (string.IsNullOrEmpty(keyword))
            {
                客戶銀行資訊 = 客戶銀行資訊.Where(b => b.銀行名稱.Contains(keyword) || b.客戶資料.客戶名稱.Contains(keyword))
                         .Include(客 => 客.客戶資料);
            }
            return(View(客戶銀行資訊.ToList()));
        }
Exemple #23
0
        // GET: Ajax
        public ActionResult bankCount(int?cid)
        {
            客戶銀行資訊Repository repo = RepositoryHelper.Get客戶銀行資訊Repository();
            var 銀行資訊 = repo.All();

            銀行資訊 = 銀行資訊.Where(r => r.客戶Id == cid);

            return(Json(new
            {
                isOK = true, count = 銀行資訊.Count()
            }, JsonRequestBehavior.AllowGet));
        }
        // GET: 客戶銀行資訊
        public ActionResult Index(string name)
        {
            ////var 客戶銀行資訊 = db.客戶銀行資訊.Include(客 => 客.客戶資料).Where(x => !x.是否被刪除);
            //var data = db.客戶銀行資訊.Where(c => !c.是否被刪除).AsQueryable();
            var data = repo.All();

            if (!string.IsNullOrEmpty(name))
            {
                data = data.Where(c => c.帳戶名稱.Contains(name));
            }
            //return View(客戶銀行資訊.ToList());
            return(View(data.ToList()));
        }
Exemple #25
0
        // GET: Bank
        public ActionResult Index(string sCustName, string sSortby, int pageNo = 1)
        {
            //var 客戶銀行資訊 = db.客戶銀行資訊.Include(客 => 客.客戶資料);
            //return View(客戶銀行資訊.ToList());

            var data = custBankRepo.All(sCustName, sSortby);

            ViewBag.sCustName = sCustName;
            ViewBag.sSortby   = sSortby;
            ViewBag.pageNo    = pageNo;

            return(View(data.ToPagedList(pageNo, 5)));
        }
Exemple #26
0
        // GET: Banks
        public ActionResult Index(string search)
        {
            if (string.IsNullOrEmpty(search))
            {
                return(View(repo.All().ToList()));
            }

            var banks   = repo.All().Where(b => b.銀行名稱.Contains(search));
            var vwbanks = repo.All().Where(b => b.客戶資料.客戶名稱.Contains(search));

            if (banks.Count() == 0 && vwbanks.Count() == 0)
            {
                ViewBag.Message = "No Banks Information!";
                return(View());
            }
            else if (banks.Count() == 0 && vwbanks.Count() > 0)
            {
                return(View(vwbanks));
            }
            else
            {
                return(View(banks));
            }
        }
Exemple #27
0
        public void Initialize()
        {
            banks = new List <客戶銀行資訊>
            {
                new 客戶銀行資訊 {
                    Id = 0, 銀行名稱 = "testBank0", 是否已刪除 = false, 客戶資料 = new 客戶資料 {
                        Id = 0, 客戶名稱 = "test0", Email = "*****@*****.**", 是否已刪除 = false
                    }
                },
                new 客戶銀行資訊 {
                    Id = 1, 銀行名稱 = "testBank0", 是否已刪除 = false, 客戶資料 = new 客戶資料 {
                        Id = 1, 客戶名稱 = "test1", Email = "*****@*****.**", 是否已刪除 = false
                    }
                },
                new 客戶銀行資訊 {
                    Id = 2, 銀行名稱 = "testBank0", 是否已刪除 = false, 客戶資料 = new 客戶資料 {
                        Id = 2, 客戶名稱 = "test2", Email = "*****@*****.**", 是否已刪除 = false
                    }
                },
                new 客戶銀行資訊 {
                    Id = 3, 銀行名稱 = "testBank0", 是否已刪除 = false, 客戶資料 = new 客戶資料 {
                        Id = 3, 客戶名稱 = "test3", Email = "*****@*****.**", 是否已刪除 = false
                    }
                }
            }.AsQueryable();

            mockDbSet = Substitute.For <DbSet <客戶銀行資訊>, IDbSet <客戶銀行資訊> >();
            mockDbSet.Provider.Returns(banks.Provider);
            mockDbSet.Expression.Returns(banks.Expression);
            mockDbSet.ElementType.Returns(banks.ElementType);
            mockDbSet.GetEnumerator().Returns(banks.GetEnumerator());

            mockDbSet.Find(Arg.Any <int>()).Returns(
                callinfo =>
            {
                object[] idValues = callinfo.Arg <object[]>();
                int id            = (int)idValues[0];
                return(banks.SingleOrDefault(b => b.Id == id));
            });


            mockDbContext = Substitute.For <客戶資料DBEntities>();
            mockDbContext.客戶銀行資訊.Returns(mockDbSet);

            mockRepo = Substitute.For <客戶銀行資訊Repository>();
            mockRepo.All().Returns(banks.Where(b => b.是否已刪除 == false));
            mockRepo.UnitOfWork = Substitute.For <IUnitOfWork>();
        }
        public ActionResult DownloadXlsx()
        {
            var data = repoClientBankInfo.All().Select(x => new { x.客戶Id, x.銀行名稱, x.銀行代碼, x.帳戶號碼, x.帳戶名稱, x.分行代碼 });

            if (!data.Any())
            {
                return(View("Index", repoClientBankInfo.SelectData()));
            }
            var table = CommonMethod.CreateDataTable(data);

            System.IO.MemoryStream stream  = CommonMethod.ExportExcelFromDataTable(table, "客戶銀行資訊");
            FileContentResult      fResult = new FileContentResult(stream.ToArray(), "application/x-xlsx");

            fResult.FileDownloadName = "客戶銀行資訊.xlsx";
            return(fResult);
        }
        public ActionResult Export()
        {
            using (XLWorkbook wb = new XLWorkbook())
            {
                var data = repo.All().Select(c => new { c.客戶Id, c.銀行名稱, c.銀行代碼, c.分行代碼, c.帳戶名稱, c.帳戶號碼 });

                var ws = wb.Worksheets.Add("sheet1", 1);
                ws.Cell(1, 1).InsertData(data);

                using (MemoryStream memoryStream = new MemoryStream())
                {
                    wb.SaveAs(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);
                    return(this.File(memoryStream.ToArray(), "application/vnd.ms-excel", "客戶銀行資訊.xlsx"));
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            //客戶資料 客戶資料 = db.客戶資料.Find(id);
            //客戶資料.是否已刪除 = true;
            ////db.客戶資料.Remove(客戶資料);
            //db.SaveChanges();

            客戶聯絡人Repository repoC = new 客戶聯絡人Repository();
            repoC.DeleteRange(repoC.All().Where(c => c.客戶Id == id));
            repoC.UnitOfWork.Commit();

            客戶銀行資訊Repository repoB = new 客戶銀行資訊Repository();
            repoB.DeleteRange(repoB.All().Where(c => c.客戶Id == id));
            repoB.UnitOfWork.Commit();

            repo.Delete(repo.Find(id));
            repo.UnitOfWork.Commit();
            return RedirectToAction("Index");
        }
        public ActionResult Index(BankViewModel model)
        {
            if (ModelState.IsValid)
            {
                var query = bankrepo.All().AsQueryable();

                if (!string.IsNullOrWhiteSpace(model.banksearch.AccountName))
                {
                    query = query.Where(p => p.帳戶名稱.Contains(model.banksearch.AccountName));
                }

                var result = new BankViewModel();
                result.banksearch = model.banksearch;
                result.bank       = query;

                return(View(result));
            }

            return(View());
        }