Esempio n. 1
0
        public ActionResult OfferPrepForm(int CustomerId)
        {
            OfferPrepFormModel        OfferPrepFormModel     = new Web.Models.OfferPrepFormModel();
            List <ChattelsTypesModel> ChattelsTypesModelList = new List <ChattelsTypesModel>();
            List <ClausesTypeModel>   ClausesTypeModelList   = new List <ClausesTypeModel>();
            var ChattelsTypesServices = _ChattelsTypesServices.GetChattelsTypes();
            var ClauseTypeServices    = _ClauseTypeServices.GetClauseTypes();

            Mapper.CreateMap <CommunicationApp.Entity.ChattelsTypes, CommunicationApp.Web.Models.ChattelsTypesModel>();
            foreach (var ChattelsTypesService in ChattelsTypesServices)
            {
                var _model = Mapper.Map <CommunicationApp.Entity.ChattelsTypes, CommunicationApp.Web.Models.ChattelsTypesModel>(ChattelsTypesService);
                ChattelsTypesModelList.Add(_model);
            }
            Mapper.CreateMap <CommunicationApp.Entity.ClauseType, CommunicationApp.Web.Models.ClausesTypeModel>();
            foreach (var ClauseTypeService in ClauseTypeServices)
            {
                var _model = Mapper.Map <CommunicationApp.Entity.ClauseType, CommunicationApp.Web.Models.ClausesTypeModel>(ClauseTypeService);
                var ids    = ClouseIds();
                if (ids.Contains(_model.Id))
                {
                    _model.Ischeked = true;
                }
                else
                {
                    _model.Ischeked = false;
                }
                ClausesTypeModelList.Add(_model);
            }

            OfferPrepFormModel.ChattelsIds            = ChattelsIds();
            OfferPrepFormModel.ChattelsTypesModelList = ChattelsTypesModelList;
            OfferPrepFormModel.ClausesTypeModelList   = ClausesTypeModelList;
            ViewBag.EmailList = new SelectList(_OfficeLocationService.GetOfficeLocations(), "Email", "City");
            return(View(OfferPrepFormModel));
        }
Esempio n. 2
0
        public ActionResult OfferPrepFormDetail(int OfferPrepFormId)
        {
            OfferPrepFormModel        OfferPrepFormModel     = new Web.Models.OfferPrepFormModel();
            List <ChattelsTypesModel> ChattelsTypesModelList = new List <ChattelsTypesModel>();
            List <ClausesTypeModel>   ClausesTypeModelList   = new List <ClausesTypeModel>();

            if (OfferPrepFormId != 0)
            {
                var chattelcount  = 0;
                var Offerprepform = _OfferPrepFormService.GetOfferPrepForm(OfferPrepFormId);
                Mapper.CreateMap <CommunicationApp.Entity.OfferPrepForm, CommunicationApp.Web.Models.OfferPrepFormModel>();
                OfferPrepFormModel       = Mapper.Map <CommunicationApp.Entity.OfferPrepForm, CommunicationApp.Web.Models.OfferPrepFormModel>(Offerprepform);
                OfferPrepFormModel.Email = _OfficeLocationService.GetOfficeLocations().Where(c => c.Email == OfferPrepFormModel.Email).FirstOrDefault().City;
                List <int> ChattelsIds           = Offerprepform.ChattelsIncluded.Split(',').Select(int.Parse).ToList();
                var        ChattelsTypesServices = _ChattelsTypesServices.GetChattelsTypes().Where(c => ChattelsIds.Contains(c.Id));
                Mapper.CreateMap <CommunicationApp.Entity.ChattelsTypes, CommunicationApp.Web.Models.ChattelsTypesModel>();
                var splitChattels = OfferPrepFormModel.ChattelsCount.Split(',').Where(c => c != "").ToArray();

                foreach (var ChattelsTypesService in ChattelsTypesServices)
                {
                    var _model = Mapper.Map <CommunicationApp.Entity.ChattelsTypes, CommunicationApp.Web.Models.ChattelsTypesModel>(ChattelsTypesService);
                    if (splitChattels.Count() > chattelcount)
                    {
                        _model.ChattelsCount = splitChattels[chattelcount];
                    }

                    ChattelsTypesModelList.Add(_model);
                    chattelcount += 1;
                }

                List <int> ClausesIds         = Offerprepform.Clauses.Split(',').Select(int.Parse).ToList();
                var        ClauseTypeServices = _ClauseTypeServices.GetClauseTypes().Where(c => ClausesIds.Contains(c.Id));
                Mapper.CreateMap <CommunicationApp.Entity.ClauseType, CommunicationApp.Web.Models.ClausesTypeModel>();
                foreach (var ClauseTypeService in ClauseTypeServices)
                {
                    var _model = Mapper.Map <CommunicationApp.Entity.ClauseType, CommunicationApp.Web.Models.ClausesTypeModel>(ClauseTypeService);
                    ClausesTypeModelList.Add(_model);
                }

                if (OfferPrepFormModel.AgreementofPurchaseandSale == ((int)EnumValue.AgreementofPurchaseandSale.TownHouseWithFee).ToString())
                {
                    OfferPrepFormModel.AgreementofPurchaseandSale = EnumValue.GetEnumDescription(EnumValue.AgreementofPurchaseandSale.TownHouseWithFee);
                }
                else if (OfferPrepFormModel.AgreementofPurchaseandSale == ((int)EnumValue.AgreementofPurchaseandSale.CONDO).ToString())
                {
                    OfferPrepFormModel.AgreementofPurchaseandSale = EnumValue.GetEnumDescription(EnumValue.AgreementofPurchaseandSale.CONDO);
                }
                else if (OfferPrepFormModel.AgreementofPurchaseandSale == ((int)EnumValue.AgreementofPurchaseandSale.FREEHOLD).ToString())
                {
                    OfferPrepFormModel.AgreementofPurchaseandSale = EnumValue.GetEnumDescription(EnumValue.AgreementofPurchaseandSale.FREEHOLD);
                }

                if (OfferPrepFormModel.Deposit == ((int)EnumValue.Deposit.HereWith).ToString())
                {
                    OfferPrepFormModel.Deposit = EnumValue.GetEnumDescription(EnumValue.Deposit.HereWith).ToString();
                }
                else if (OfferPrepFormModel.Deposit == ((int)EnumValue.Deposit.Uponacceptance).ToString())
                {
                    OfferPrepFormModel.Deposit = EnumValue.GetEnumDescription(EnumValue.Deposit.Uponacceptance).ToString();
                }


                if (OfferPrepFormModel.Arewethe == ((int)EnumValue.Arewethe.Co_OperatingBrokerage).ToString())
                {
                    OfferPrepFormModel.Arewethe = EnumValue.Arewethe.Co_OperatingBrokerage.ToString();
                }
                else if (OfferPrepFormModel.Arewethe == ((int)EnumValue.Arewethe.ListingBrokerageCoOperatingBrokerage).ToString())
                {
                    OfferPrepFormModel.Arewethe = EnumValue.Arewethe.ListingBrokerageCoOperatingBrokerage.ToString();
                }

                if (OfferPrepFormModel.FinalView_Option == ((int)EnumValue.FinalView_Option.One).ToString())
                {
                    OfferPrepFormModel.FinalView_Option = EnumValue.FinalView_Option.One.ToString();
                }
                else if (OfferPrepFormModel.FinalView_Option == ((int)EnumValue.FinalView_Option.TwoMoreTimes).ToString())
                {
                    OfferPrepFormModel.FinalView_Option = EnumValue.FinalView_Option.TwoMoreTimes.ToString();
                }



                //OfferPrepFormModel.StainlessSteelFridge = splitChattels[0];
                //OfferPrepFormModel.Fridge = splitChattels[1];
                //OfferPrepFormModel.StainlessSteelStove = splitChattels[2];
                //OfferPrepFormModel.Stove = splitChattels[3];
                //OfferPrepFormModel.FrontLoadingWasher = splitChattels[4];
                //OfferPrepFormModel.Washer = splitChattels[5];
                //OfferPrepFormModel.FrontLoadingDryer = splitChattels[6];
                //OfferPrepFormModel.Dryer = splitChattels[7];
            }

            OfferPrepFormModel.ChattelsTypesModelList = ChattelsTypesModelList;
            OfferPrepFormModel.ClausesTypeModelList   = ClausesTypeModelList;
            ViewBag.EmailList = new SelectList(_OfficeLocationService.GetOfficeLocations(), "Email", "Email");
            return(View(OfferPrepFormModel));
        }