Exemplo n.º 1
0
        public HttpResponseMessage GetAllProperty(string PropertyTypeStatus)
        {
            int PropertyStatusId = 0;

            try
            {
                if (PropertyTypeStatus == "" || PropertyTypeStatus == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, Common.CreateMessage("error", "Property Type Status cannot be blank."), Configuration.Formatters.JsonFormatter));
                }
                if (PropertyTypeStatus == EnumValue.GetEnumDescription(EnumValue.PropertySatus.ExclusiveCommercial))
                {
                    PropertyStatusId = (int)EnumValue.PropertySatus.ExclusiveCommercial;
                }
                else if (PropertyTypeStatus == EnumValue.GetEnumDescription(EnumValue.PropertySatus.ExclusiveResidential))
                {
                    PropertyStatusId = (int)EnumValue.PropertySatus.ExclusiveResidential;
                }
                else if (PropertyTypeStatus == EnumValue.GetEnumDescription(EnumValue.PropertySatus.NewHotListingCommercial))
                {
                    PropertyStatusId = (int)EnumValue.PropertySatus.NewHotListingCommercial;
                }
                else if (PropertyTypeStatus == EnumValue.GetEnumDescription(EnumValue.PropertySatus.NewHotListingResidential))
                {
                    PropertyStatusId = (int)EnumValue.PropertySatus.NewHotListingResidential;
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, Common.CreateMessage("error", "Property Type Status is incorrect."), Configuration.Formatters.JsonFormatter));
                }
                //int? PropertyTypeStatusValue = CheckPropertyStatus(PropertyTypeStatus);


                if (PropertyStatusId != 0)
                {
                    var Properties = _PropertyService.GetPropertys().Where(c => c.PropertyStatusId == PropertyStatusId).OrderByDescending(c => c.PropertyId);
                    var models     = new List <PropertyModel>();
                    Mapper.CreateMap <CommunicationApp.Entity.Property, CommunicationApp.Web.Models.PropertyModel>();
                    foreach (var Property in Properties)
                    {
                        PropertyModel PropertyModel = new Web.Models.PropertyModel();
                    }

                    return(Request.CreateResponse(HttpStatusCode.OK, Common.CreateMessage("success", models), Configuration.Formatters.JsonFormatter));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, Common.CreateMessage("error", "No record found"), Configuration.Formatters.JsonFormatter));
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.OK, Common.CreateMessage("error", "Please try later."), Configuration.Formatters.JsonFormatter));
            }
        }
Exemplo n.º 2
0
        public JsonResult UpdateAgent(string PropertyId, string IsCheked)
        {
            try
            {
                var Status = "";
                var Agent  = _AgentService.GetAgent(Convert.ToInt32(PropertyId));
                if (Agent != null)
                {
                    if (IsCheked == "Yes")
                    {
                        if (Agent.IsActive == false)
                        {
                            Agent.IsActive = true;
                            Status         = "Yes";
                            PropertyModel PropertyModel = new Web.Models.PropertyModel();
                            if (Agent.AgentStatusId == (int)EnumValue.AgentSatus.AgentAvailable)
                            {
                                PropertyModel.PropertyType = EnumValue.GetEnumDescription(EnumValue.AgentSatus.AgentAvailable);
                            }
                            else if (Agent.AgentStatusId == (int)EnumValue.AgentSatus.AgentRequired)
                            {
                                PropertyModel.PropertyType = EnumValue.GetEnumDescription(EnumValue.AgentSatus.AgentRequired);
                            }
                            PropertyModel.MLS = Agent.MLS;
                            PropertyModel.PropertyTypeStatus = "Open House property";
                            var Customer  = _CustomerService.GetCustomer(Convert.ToInt32(Agent.CustomerId));
                            var FirstName = Customer.FirstName + " " + Customer.MiddleName + " " + Customer.LastName;
                            if (Customer != null)
                            {
                                SendMailToUser(FirstName, Customer.EmailId, PropertyModel);
                            }
                        }
                    }
                    else if (IsCheked == "No")
                    {
                        Agent.IsActive = false;
                        Status         = "No";
                    }

                    _AgentService.UpdateAgent(Agent);
                }

                return(Json(Status));
            }

            catch (Exception ex)
            {
                ErrorLogging.LogError(ex);
                return(Json("error"));
            }
        }
Exemplo n.º 3
0
        public JsonResult UpdateProperty(string propertyId, string IsCheked)
        {
            try
            {
                //For get Property For StatusId with sql.
                CommonClass CommonClass = new CommonClass();
                string      QStr        = "";
                DataTable   dt          = new DataTable();
                QStr = "Select PropertyStatusId, IsActive From Property where PropertyId=" + propertyId;
                dt   = CommonClass.GetDataSet(QStr).Tables[0];
                List <CustomerModel> CustomerList = new List <CustomerModel>();
                var PropertyForStatusId           = Convert.ToInt32(dt.Rows[0]["PropertyStatusId"]);
                var IsActive = Convert.ToBoolean(dt.Rows[0]["IsActive"]);
                //End

                var Status   = "";
                var Property = _PropertyService.GetProperty(Convert.ToInt32(propertyId));
                if (Property != null)
                {
                    if (IsCheked == "Yes")
                    {
                        if (IsActive == false)
                        {
                            Property.IsActive = true;
                            Status            = "Yes";
                            PropertyModel PropertyModel = new Web.Models.PropertyModel();
                            if (PropertyForStatusId == (int)EnumValue.PropertySatus.ExclusiveCommercial)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.ExclusiveCommercial);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.ExclusiveResidential)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.ExclusiveResidential);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.ExclusiveResidentialCondo)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.ExclusiveResidentialCondo);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.LookingForCommercial)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.LookingForCommercial);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.LookingForResidential)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.LookingForResidential);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.LookingForResidentialCondo)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.LookingForResidentialCondo);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.NewHotListingCommercial)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.NewHotListingCommercial);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.NewHotListingResidential)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.NewHotListingResidential);
                            }
                            else if (PropertyForStatusId == (int)EnumValue.PropertySatus.NewHotListingResidentialCondo)
                            {
                                PropertyModel.PropertyTypeStatus = EnumValue.GetEnumDescription(EnumValue.PropertySatus.NewHotListingResidentialCondo);
                            }
                            PropertyModel.PropertyType     = Property.PropertyType;
                            PropertyModel.Style            = Property.Style;
                            PropertyModel.LocationPrefered = Property.LocationPrefered;
                            PropertyModel.MLS = Property.MLS;
                            PropertyModel.PropertyTypeStatus = PropertyModel.PropertyTypeStatus;
                            // PropertyModel.prop
                            var Customer  = _CustomerService.GetCustomer(Convert.ToInt32(Property.CustomerId));
                            var FirstName = Customer.FirstName + " " + Customer.MiddleName + " " + Customer.LastName;
                            PropertyModel.CustomerTrebId = Customer.TrebId;
                            if (Customer != null)
                            {
                                if (Property.IsPropertyUpdated == false)
                                {
                                    SendMailToUser(FirstName, Customer.EmailId, PropertyModel);
                                }
                                else
                                {
                                    SendMailToUpdatedUser(FirstName, Customer.EmailId, PropertyModel);
                                }
                            }
                        }
                    }
                    else if (IsCheked == "No")
                    {
                        Property.IsActive = false;
                        Status            = "No";
                    }

                    _PropertyService.UpdateProperty(Property);
                }

                return(Json(Status));
            }


            catch (Exception ex)
            {
                ErrorLogging.LogError(ex);
                return(Json("error"));
            }
        }