Exemple #1
0
        public ActionResult EstimateForm(Guid id, Guid?enquiryID)
        {
            EstimateViewModel estimateVM = null;
            AppUA             appUA      = Session["AppUA"] as AppUA;

            try
            {
                if (id != Guid.Empty)
                {
                    estimateVM                   = Mapper.Map <Estimate, EstimateViewModel>(_estimateBusiness.GetEstimate(id));
                    estimateVM.IsUpdate          = true;
                    estimateVM.IsDocLocked       = estimateVM.DocumentOwners.Contains(appUA.UserName);
                    estimateVM.EnquirySelectList = _enquiryBusiness.GetEnquiryForSelectList(enquiryID);
                    estimateVM.Currency          = new CurrencyViewModel();
                }
                else if (id == Guid.Empty && enquiryID == null)
                {
                    estimateVM                            = new EstimateViewModel();
                    estimateVM.IsUpdate                   = false;
                    estimateVM.ID                         = Guid.Empty;
                    estimateVM.EnquiryID                  = null;
                    estimateVM.EnquirySelectList          = new List <SelectListItem>();
                    estimateVM.DocumentStatus             = new DocumentStatusViewModel();
                    estimateVM.DocumentStatus.Description = "-";
                    estimateVM.Branch                     = new BranchViewModel();
                    estimateVM.Branch.Description         = "-";
                    //estimateVM.Customer = new CustomerViewModel();
                    //estimateVM.Customer.CompanyName = "-";
                    estimateVM.IsDocLocked  = false;
                    estimateVM.CurrencyCode = "INR";
                    estimateVM.CurrencyRate = 1;
                    estimateVM.Currency     = new CurrencyViewModel()
                    {
                        CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList())
                    };
                }
                else if (id == Guid.Empty && enquiryID != null)
                {
                    EnquiryViewModel enquiryVM = Mapper.Map <Enquiry, EnquiryViewModel>(_enquiryBusiness.GetEnquiry((Guid)enquiryID));
                    estimateVM                            = new EstimateViewModel();
                    estimateVM.IsUpdate                   = false;
                    estimateVM.ID                         = Guid.Empty;
                    estimateVM.CustomerID                 = enquiryVM.CustomerID;
                    estimateVM.EnquirySelectList          = _enquiryBusiness.GetEnquiryForSelectList(enquiryID);
                    estimateVM.EnquiryID                  = enquiryID;
                    estimateVM.DocumentStatus             = new DocumentStatusViewModel();
                    estimateVM.DocumentStatus.Description = "-";
                    estimateVM.Branch                     = new BranchViewModel();
                    estimateVM.Branch.Description         = "-";
                    estimateVM.Customer                   = enquiryVM.Customer;
                    estimateVM.IsDocLocked                = false;
                    estimateVM.CurrencyCode               = enquiryVM.CurrencyCode;
                    estimateVM.CurrencyRate               = enquiryVM.CurrencyRate;
                    estimateVM.Currency                   = new CurrencyViewModel()
                    {
                        CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList())
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Permission _permission = _pSASysCommon.GetSecurityCode(appUA.UserName, "CostPrice");
            string     p           = _permission.AccessCode;

            if ((p.Contains("R") || p.Contains("W")))
            {
                estimateVM.CostPriceHasAccess = true;
            }
            else
            {
                estimateVM.CostPriceHasAccess = false;
            }
            return(PartialView("_EstimateForm", estimateVM));
        }
        public ActionResult EnquiryForm(Guid id)
        {
            EnquiryViewModel enquiryVM = null;

            try
            {
                if (id != Guid.Empty)
                {
                    enquiryVM          = Mapper.Map <Enquiry, EnquiryViewModel>(_enquiryBusiness.GetEnquiry(id));
                    enquiryVM.IsUpdate = true;
                    AppUA appUA = Session["AppUA"] as AppUA;
                    enquiryVM.IsDocLocked = enquiryVM.DocumentOwners.Contains(appUA.UserName);
                    enquiryVM.Customer    = new CustomerViewModel
                    {
                        CompanyName = enquiryVM.Customer.CompanyName,
                        Titles      = new TitlesViewModel()
                        {
                            TitlesSelectList = _customerBusiness.GetTitleSelectList(),
                        },
                    };
                    enquiryVM.Currency = new CurrencyViewModel();
                }
                else
                {
                    enquiryVM                            = new EnquiryViewModel();
                    enquiryVM.IsUpdate                   = false;
                    enquiryVM.ID                         = Guid.Empty;
                    enquiryVM.DocumentStatus             = new DocumentStatusViewModel();
                    enquiryVM.DocumentStatus.Description = "-";
                    enquiryVM.Branch                     = new BranchViewModel();
                    enquiryVM.Branch.Description         = "-";
                    enquiryVM.IsDocLocked                = false;
                    enquiryVM.CurrencyRate               = 1;
                    enquiryVM.CurrencyCode               = "INR";
                    enquiryVM.Customer                   = new CustomerViewModel
                    {
                        //CompanyName = "-",
                        Titles = new TitlesViewModel()
                        {
                            TitlesSelectList = _customerBusiness.GetTitleSelectList(),
                        },
                    };
                }

                enquiryVM.EnquiryGrade = new EnquiryGradeViewModel()
                {
                    EnquiryGradeSelectList = _enquiryGradeBusiness.GetEnquiryGradeSelectList()
                };
                enquiryVM.Currency = new CurrencyViewModel()
                {
                    CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList())
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PartialView("_EnquiryForm", enquiryVM));
        }
Exemple #3
0
        public ActionResult ServiceCallForm(Guid id)
        {
            ServiceCallViewModel serviceCallVM = null;

            try
            {
                if (id != Guid.Empty)
                {
                    serviceCallVM          = Mapper.Map <ServiceCall, ServiceCallViewModel>(_serviceCallBusiness.GetServiceCall(id));
                    serviceCallVM.IsUpdate = true;
                    AppUA appUA = Session["AppUA"] as AppUA;
                    serviceCallVM.IsDocLocked = serviceCallVM.DocumentOwners.Contains(appUA.UserName);
                    serviceCallVM.Customer    = new CustomerViewModel()
                    {
                        CompanyName = serviceCallVM.Customer.CompanyName,
                        Titles      = new TitlesViewModel()
                        {
                            TitlesSelectList = _customerBusiness.GetTitleSelectList(),
                        },
                    };
                    serviceCallVM.Currency = new CurrencyViewModel();
                }
                else //(id == Guid.Empty)
                {
                    serviceCallVM                            = new ServiceCallViewModel();
                    serviceCallVM.IsUpdate                   = false;
                    serviceCallVM.ID                         = Guid.Empty;
                    serviceCallVM.DocumentStatus             = new DocumentStatusViewModel();
                    serviceCallVM.DocumentStatus.Description = "-";
                    serviceCallVM.Branch                     = new BranchViewModel();
                    serviceCallVM.Branch.Description         = "-";
                    serviceCallVM.Customer                   = new CustomerViewModel
                    {
                        //CompanyName = serviceCallVM.Customer.CompanyName,
                        Titles = new TitlesViewModel()
                        {
                            TitlesSelectList = _customerBusiness.GetTitleSelectList(),
                        },
                    };
                    serviceCallVM.CurrencyCode = "INR";
                    serviceCallVM.CurrencyRate = 1;
                    serviceCallVM.Currency     = new CurrencyViewModel()
                    {
                        CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList())
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PartialView("_ServiceCallForm", serviceCallVM));
        }
Exemple #4
0
        public ActionResult CurrencySelectList(string required, bool?disabled)
        {
            ViewBag.IsRequired       = required;
            ViewBag.IsDisabled       = disabled;
            ViewBag.HasAddPermission = false;
            ViewBag.propertydisable  = disabled == null ? false : disabled;
            CurrencyViewModel currencyVM = new CurrencyViewModel();

            currencyVM.CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList());
            return(PartialView("_CurrencySelectList", currencyVM));
        }