Beispiel #1
0
 public BusinessCustomer(IUnityOfWork uow, IRepositoryCustomer repositoryCustomer, IRepositoryAddress repositoryAddress, IRepositoryUser repUser)
     : base(uow)
 {
     _repAddress  = repositoryAddress;
     _repCustomer = repositoryCustomer;
     _repUser     = repUser;
 }
        // GET: Customer
        public ActionResult CustomerList()
        {
            _repositorycustomer = new RepositoryCustomer();
            var list = _repositorycustomer.GetListcustomer();

            return(View(list));
        }
 public LoginController(IRepositoryCustomer <Customer1> repo,
                        IRepositoryOrders <Order1> orderRepo,
                        IRepositoryStore <Store1> store)
 {
     _repo  = repo;
     _order = orderRepo;
     _store = store;
 }
Beispiel #4
0
        public CreateCustomerCommandValidator(IRepositoryCustomer repositoryCustomer)
        {
            _repositoryCustomer = repositoryCustomer;

            RuleFor(x => x.Name)
            .NotEmpty().WithMessage("Name is required")
            .Must(NotExists).WithMessage("This name already exists!");
        }
Beispiel #5
0
        private void loadCustomer()
        {
            _repositoryCustomer = new RepositoryCustomer();
            var listcustomer = _repositoryCustomer.GetListcustomer();

            listcustomer.Add(new Customer {
                CustomerId = -1, CustomerName = "ALL"
            });
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName", -1);
        }
Beispiel #6
0
        public ActionResult CreateProject()
        {
            _repositoryCustomer = new RepositoryCustomer();
            _repositoryStaff    = new RepositoryStaff();
            var listcustomer = _repositoryCustomer.GetListcustomer();

            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName");

            loadStaf();

            return(View());
        }
Beispiel #7
0
        public void Initialize()
        {
            _context            = new DbContextDapper();
            _repositoryCustomer = new RepositoryCustomerDapper(_context);
            _repositoryUsers    = new CRUDDapper <Users>(_context);
            _repositorySupply   = new RepositorySupplyDapper(_context);
            _repositoryAddress  = new CRUDDapper <Address>(_context);

            //_context = new DbContextEF();
            //_repositoryCustomer = new RepositoryCustomerEF(_context);
            //_repositoryUsers = new CRUDEF<Users,UserQuery>(_context);
            //_repositorySupply = new RepositorySupplyEF(_context);
            //_repositoryAddress = new CRUDEF<Address, AddressQuery>(_context);
        }
Beispiel #8
0
        public ActionResult Edit(int id)
        {
            _repositoryCustomer = new RepositoryCustomer();
            _repositoryProject  = new RepositoryProject();
            _repositoryStaff    = new RepositoryStaff();

            var project = _repositoryProject.GetProjectByProjectId(id, p => p.ProjectStaffs);



            var listcustomer = _repositoryCustomer.GetListcustomer();

            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName", project.CustomerId);

            loadStafEdit(project);
            return(View(project));
        }
        public ActionResult CustomerCreate(Customer customer)
        {
            if (ModelState.IsValid)
            {
                _repositorycustomer = new RepositoryCustomer();
                OperationStatus ops = _repositorycustomer.SaveCustomer(customer);
                if (ops.Status)
                {
                    return(RedirectToAction("CustomerList"));
                }
                else
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                    return(View());
                }
            }

            return(View());
        }
Beispiel #10
0
        public ActionResult Edit(Project project, string CMStaff, string PMStaff, string PDEStaff, string SEStaff, string QEStaff, string DRStaff)
        {
            _repositoryProject  = new RepositoryProject();
            _repositoryCustomer = new RepositoryCustomer();
            int projectoldid = Convert.ToInt32(ViewBag.projectidold);

            var projectedit = _repositoryProject.GetProjectByProjectId(project.ProjectID, p => p.ProjectStaffs);

            projectedit.ProjectStaffs.CMStaff  = CMStaff;
            projectedit.ProjectStaffs.PMStaff  = PMStaff;
            projectedit.ProjectStaffs.PDEStaff = PDEStaff;
            projectedit.ProjectStaffs.SEStaff  = SEStaff;
            projectedit.ProjectStaffs.QEStaff  = QEStaff;
            projectedit.ProjectStaffs.DRStaff  = DRStaff;
            projectedit.ProjectID  = project.ProjectID;
            projectedit.Status     = project.Status;
            projectedit.CustomerId = project.CustomerId;

            projectedit.ProjectStatus = Status.Modify;



            if (ModelState.IsValid)
            {
                projectedit.ProjectStatus = Status.Modify;
                OperationStatus ops = _repositoryProject.SaveProject(projectedit);
                if (ops.Status)
                {
                    return(RedirectToAction("ProjectList", new { PMStaff = PMStaff }));
                }
                else
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                }
            }
            var listcustomer = _repositoryCustomer.GetListcustomer();

            _repositoryStaff = new RepositoryStaff();
            loadStaf();
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName");

            return(View());
        }
Beispiel #11
0
        public ActionResult CreateProject(Project project, string CMStaff, string PMStaff, string PDEStaff, string SEStaff, string QEStaff, string DRStaff)
        {
            _repositoryProject    = new RepositoryProject();
            _repositoryCustomer   = new RepositoryCustomer();
            project.ProjectStaffs = new ProjectStaff();

            //int projectid = project.ProjectID;

            project.ProjectStaffs.CMStaff  = CMStaff;
            project.ProjectStaffs.PMStaff  = PMStaff;
            project.ProjectStaffs.PDEStaff = PDEStaff;
            project.ProjectStaffs.SEStaff  = SEStaff;
            project.ProjectStaffs.QEStaff  = QEStaff;
            project.ProjectStaffs.DRStaff  = DRStaff;
            //project.ProjectStaffs.ProjectId = projectid;

            project.Create = DateTime.Now;

            var listcustomer = _repositoryCustomer.GetListcustomer();


            if (ModelState.IsValid)
            {
                project.ProjectStatus = Status.Add;
                OperationStatus ops = _repositoryProject.SaveProject(project);
                if (ops.Status)
                {
                    return(RedirectToAction("ProjectList"));
                }
                else
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                }
            }

            _repositoryStaff = new RepositoryStaff();
            loadStaf();
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName");

            return(View());
        }
Beispiel #12
0
 public CustomerService(IRepositoryCustomer repository)
     : base(repository)
 {
     Check.ArgumentIsNull(repository, REPOSITORY_ERR_MSG);
     _repository = repository;
 }
Beispiel #13
0
        public ActionResult Index(string sortparam, string PMStaff, string Status, string customeridpage, string pMStaffpage, string statuspage, int?page, int customerid = -1)
        {
            _repositoryProject  = new RepositoryProject();
            _repositoryCustomer = new RepositoryCustomer();

            loadCustomer();
            loadPMStaff();

            ViewBag.Customeridpage = customeridpage ?? customerid.ToString();
            ViewBag.PMStaffpage    = pMStaffpage ?? PMStaff;
            ViewBag.sortCode       = string.IsNullOrEmpty(sortparam) ? "ProjectID" : "";
            ViewBag.CustomerName   = string.IsNullOrEmpty(sortparam) ? "CustomerName" : "";

            var statuspaged = Status ?? "A";

            ViewBag.Statuspage    = statuspage ?? statuspaged;
            ViewBag.CurrentFilter = sortparam;

            var pagednumber = page ?? 1;

            if (string.IsNullOrEmpty(PMStaff) && string.IsNullOrEmpty(pMStaffpage))
            {
                var list = _repositoryProject.GetListProject(sortparam, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                return(View(list));
            }
            else
            {
                if (customerid != -1)
                {
                    if (!PMStaff.Equals("ALL"))
                    {
                        customerid = customerid != -1? customerid : int.Parse(customeridpage);
                        PMStaff    = pMStaffpage;
                        Status     = statuspage;

                        var list = _repositoryProject.GetListProjectByCustomerId(sortparam, customerid, PMStaff, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);

                        return(View(list));
                    }
                    else
                    {
                        customerid = customerid != -1 ? customerid : int.Parse(customeridpage);
                        Status     = statuspage;
                        var list = _repositoryProject.GetListProjectByCustomerId(sortparam, customerid, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                        return(View(list));
                    }
                }

                PMStaff = pMStaffpage ?? PMStaff;
                if (PMStaff.Equals("ALL"))
                {
                    Status = statuspage;
                    var list = _repositoryProject.GetListProject(sortparam, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                    return(View(list));
                }
                else
                {
                    Status = statuspage;
                    var list = _repositoryProject.GetListProjectByPM(sortparam, PMStaff, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                    return(View(list));
                }
            }

            return(View());
        }
 public CustomerController(IRepositoryCustomer <Customer1> repo, CustomerViewModel cust, IRepositoryOrders <Order1> ord)
 {
     _repo = repo;
     _Cust = cust;
     _ord  = ord;
 }
Beispiel #15
0
 public CustomerService(IRepositoryCustomer repository)
 {
     _repository = repository;
 }
Beispiel #16
0
 public RepositoryCustomerBL(IRepositoryCustomer repositoryCustomer)
 {
     iRepositoryCustomer = repositoryCustomer;
     mapCustomers        = new Mapper <Tbl_Customers, Customers>();
 }
Beispiel #17
0
 public CustomerService(IRepositoryCustomer repositoryCustomer, IMapper mapper)
 {
     _repositoryCustomer = repositoryCustomer;
     _mapper             = mapper;
 }