Example #1
0
        /// <summary>
        /// Get InvoiceCustomer List based on companyId
        /// </summary>
        /// <param name="companyId">company Id</param>
        /// <returns>Invoice customer List based on company Id</returns>
        public JsonResult GetInvoiceCustomerList(int companyId)
        {
            try
            {
                List <InvoiceCustomerVO> invoiceCustomerVOList = null;

                if (companyId != -1)
                {
                    InvoiceCustomerService invoiceCustomerService = new InvoiceCustomerService();
                    invoiceCustomerVOList = invoiceCustomerService.GetInvoiceCustomerList(companyId);

                    List <InvoiceCustomer> invoiceCustomers = new List <InvoiceCustomer>();
                    foreach (var invoiceCustomer in invoiceCustomerVOList)
                    {
                        invoiceCustomers.Add(new InvoiceCustomer(invoiceCustomer));
                    }
                }

                var jsonResult = Json(invoiceCustomerVOList, JsonRequestBehavior.AllowGet);
                jsonResult.MaxJsonLength = Int32.MaxValue;

                return(jsonResult);
            }
            catch (Exception e)
            {
                return(Json(new ApplicationException(e.Message)));
            }
        }
 /// <summary>
 /// Get InvoiceCustomer List based on companyId
 /// </summary>
 /// <param name="companyId">company Id</param>
 /// <returns>Invoice customer List based on company Id</returns>
 public JsonResult GetInvoiceCustomerListByCompany(int companyId)
 {
     try
     {
         InvoiceCustomerService   invoiceCustomerService = new InvoiceCustomerService();
         List <InvoiceCustomerVO> invoiceCustomerVOList  = invoiceCustomerService.GetInvoiceCustomerList(companyId);
         return(Json(invoiceCustomerVOList));
     }
     catch (Exception e)
     {
         return(Json(new ApplicationException()));
     }
 }
        /// <summary>
        /// Get End User List
        /// </summary>
        /// <param name="companyId">The company id</param>
        /// <returns>List of end users</returns>
        //public JsonResult GetEndUserList(int? companyId)
        //{
        //    try
        //    {
        //        EndUserService endUserService = new EndUserService();
        //        List<EndUserVO> endUserVOList = endUserService.GetEndUserList(companyId.Value);
        //        return Json(endUserVOList);
        //    }
        //    catch (Exception e)
        //    {
        //        return Json(new ApplicationException());

        //    }
        //}

        /// <summary>
        ///  Gets List of Invoice Customers based on CompanyID
        /// </summary>
        /// <param name="companyId">The company id</param>
        /// <returns>List of invoice customers</returns>
        public List <InvoiceCustomerVO> GetInvoiceCustomerListByCompanyID(int?companyId)
        {
            try
            {
                InvoiceCustomerService   invoiceCustomerService = new InvoiceCustomerService();
                List <InvoiceCustomerVO> invoiceCustomerVOList  = invoiceCustomerService.GetInvoiceCustomerList(companyId.Value);
                return(invoiceCustomerVOList);
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
        /// <summary>
        /// Gets the list of Invoice customer based on Company Id
        /// </summary>
        /// <param name="companyId">Company Id</param>
        /// <returns>Invoice Customer List</returns>
        private List <MODEL.InvoiceCustomer> GetInvoiceCustomerListForContract(int companyId)
        {
            MODEL.Contract contract = new MODEL.Contract();

            //Get all invoice customers associated with the company
            InvoiceCustomerService   invoiceCustomerService = new InvoiceCustomerService();
            List <InvoiceCustomerVO> invoiceCustomerVOList  = invoiceCustomerService.GetInvoiceCustomerList(companyId);

            foreach (var item in invoiceCustomerVOList)
            {
                contract.InvoiceCustomerList.Add(new MODEL.InvoiceCustomer(item));
            }
            return(contract.InvoiceCustomerList);
        }
        /// <summary>
        /// Gets the list of Contracts
        /// </summary>
        /// <param name="companyId">company id</param>
        /// <param name="invoiceCustomerId">invoice customer id</param>
        /// <returns>List of contracts</returns>
        public ActionResult ContractIndex(int?companyId, int?invoiceCustomerId)
        {
            MODEL.Contract contract = new MODEL.Contract();
            try
            {
                //Get user id
                int?userId = Session.GetUserId();
                if (userId.HasValue)
                {
                    contract.OAcompanyList = Session.GetUserAssociatedCompanyList();

                    //Company id and invoice Customer id will be available if we are coming from contract details page.
                    //We will select the company for which record is inserted/edited.
                    if (companyId.HasValue)
                    {
                        ViewBag.companyId        = companyId;
                        ViewBag.invoiceCutomerId = invoiceCustomerId;

                        //Get all invoice customers associated with the company
                        var invoiceCustomerService = new InvoiceCustomerService();
                        List <InvoiceCustomerVO> invoiceCustomerVOList = invoiceCustomerService.GetInvoiceCustomerList(ViewBag.companyId);
                        foreach (var item in invoiceCustomerVOList)
                        {
                            contract.InvoiceCustomerList.Add(new MODEL.InvoiceCustomer(item));
                        }
                    }
                    else
                    {
                        //ViewBag.companyId = -1;
                        ViewBag.companyId = Session.GetDefaultCompanyId();

                        //Get all invoice customers associated with the company
                        var invoiceCustomerService = new InvoiceCustomerService();
                        List <InvoiceCustomerVO> invoiceCustomerVOList = invoiceCustomerService.GetInvoiceCustomerList(ViewBag.companyId);
                        foreach (var item in invoiceCustomerVOList)
                        {
                            contract.InvoiceCustomerList.Add(new MODEL.InvoiceCustomer(item));
                        }
                    }
                }
                else
                {
                    return(RedirectToAction("Logout", "Login"));
                }
            }
            catch (Exception)
            {
            }
            return(View(contract));
        }
Example #6
0
        /// GET: /ContractController.ApproveMaintenance/
        /// <summary>
        /// Gets approve maintenance view
        /// </summary>
        /// <returns></returns>
        public ActionResult ApproveMaintenanceIndex()
        {
            var approveMaintenance = new ApproveMaintenance();

            try
            {
                approveMaintenance.OAcompanyList = Session.GetUserAssociatedCompanyList();

                approveMaintenance.CompanyId = Session.GetDefaultCompanyId();

                //Get all active divisions associated with the company
                var divisionService = new DivisionService();
                List <DivisionVO> divisionListVO = divisionService.GetDivisionListByCompany(approveMaintenance.CompanyId);

                foreach (var division in divisionListVO)
                {
                    approveMaintenance.DivisionList.Add(new Division(division));
                }

                //Get all invoice customers associated with the company
                var invoiceCustomerService = new InvoiceCustomerService();
                List <InvoiceCustomerVO> invoiceCustomerVOList = invoiceCustomerService.GetInvoiceCustomerList(approveMaintenance.CompanyId.Value);
                foreach (var item in invoiceCustomerVOList)
                {
                    approveMaintenance.InvoiceCustomerList.Add(new InvoiceCustomer(item));
                }

                var milestoneStatusService = new MilestoneStatusService();
                List <MilestoneStatusVO> milestoneStatusVOList = milestoneStatusService.GetMilestoneStatusList();
                foreach (var item in milestoneStatusVOList)
                {
                    approveMaintenance.MilestoneStatusList.Add(new MilestoneStatus(item));
                }
                approveMaintenance.MilestoneStatusId = 9;
            }
            catch (Exception)
            {
                //throw;
            }
            return(View(approveMaintenance));
        }