예제 #1
0
        public ActionResult EditPropertyFeature(Guid propertyId, byte featureId, PropertyFeatureDetailDTO featureDetail)
        {
            if (ModelState.IsValid)
            {
                PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector);
                PartnerBLL.UpdatePropertyFeatureDetailResult result = partnerBLL.UpdatePropertyFeature(Account, propertyId, featureId, featureDetail);
                switch (result)
                {
                case PartnerBLL.UpdatePropertyFeatureDetailResult.OK:
                    TempData["Result"] = "PropertyFeatureDetailHasBeenEdited";
                    return(RedirectToAction("ViewProperty", new { id = propertyId }));

                case PartnerBLL.UpdatePropertyFeatureDetailResult.NotFound: return(HttpNotFound());

                case PartnerBLL.UpdatePropertyFeatureDetailResult.FeatureAlreadyAdded:
                    AddError("Feature", "FeatureAlreadyAdded");
                    EditPropertyFeature_Base(propertyId);
                    return(View(featureDetail));

                default: return(BadRequest());
                }
            }
            else
            {
                EditPropertyFeature_Base(propertyId);
                return(BadRequestWithErrors());
            }
        }
예제 #2
0
        public ActionResult DeletePropertyFeature(Guid propertyId, byte featureId)
        {
            PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector);

            if (Request.HttpMethod == "GET")
            {
                PropertyFeatureDetailDTO featureDetail = partnerBLL.ReadPropertyFeatureDetailById(Account, propertyId, featureId);
                if (featureDetail != null)
                {
                    ViewBag.PropertyId = propertyId;
                    return(View(featureDetail));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            else
            {
                PartnerBLL.DeletePropertyFeatureDetailResult result = partnerBLL.DeletePropertyFeatureDetail(Account, propertyId, featureId);
                switch (result)
                {
                case PartnerBLL.DeletePropertyFeatureDetailResult.OK:
                    TempData["Result"] = "PropertyFeatureDetailHasBeenDeleted";
                    return(RedirectToAction("ViewProperty", new { id = propertyId }));

                case PartnerBLL.DeletePropertyFeatureDetailResult.NotFound: return(HttpNotFound());

                default: return(BadRequest());
                }
            }
        }
예제 #3
0
        public ActionResult AddPropertyFeature(Guid id, PropertyFeatureDetailDTO featureDetail)
        {
            if (ModelState.IsValid)
            {
                PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector);
                PartnerBLL.AddPropertyFeatureDetailResult result = partnerBLL.AddPropertyFeatureDetail(Account, id, featureDetail);
                switch (result)
                {
                case PartnerBLL.AddPropertyFeatureDetailResult.OK:
                    TempData["Result"] = "PropertyFeatureDetailHasBeenAdded";
                    return(RedirectToAction("ViewProperty"));

                case PartnerBLL.AddPropertyFeatureDetailResult.NotFound: return(HttpNotFound());

                case PartnerBLL.AddPropertyFeatureDetailResult.FeatureAlreadyAdded:
                    AddError("Feature", "FeatureAlreadyAdded");
                    AddEditPropertyFeature_Base(id);
                    return(View(featureDetail));

                default: return(BadRequest());
                }
            }
            else
            {
                return(AddEditPropertyFeature_Base(id) != null?BadRequestWithErrors() as ActionResult : HttpNotFound());
            }
        }
예제 #4
0
        public ActionResult EditPropertyFeature(Guid propertyId, byte featureId)
        {
            PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector);
            PropertyFeatureDetailDTO featureDetail = partnerBLL.ReadPropertyFeatureDetailById(Account, propertyId, featureId);

            EditPropertyFeature_Base(propertyId);
            return(View(featureDetail));
        }
예제 #5
0
 public void Insert(PropertyFeatureDetailDTO featureDetail)
 {
     Connector.ExecuteNonQuery(insertQuery, new Dictionary <string, object>()
     {
         { "Property", featureDetail.Property },
         { "Feature", featureDetail.Feature },
         { "Value", featureDetail.Value }
     });
 }
예제 #6
0
 public CreateResult Create(PropertyFeatureDetailDTO featureDetail)
 {
     try
     {
         Repository.Insert(featureDetail);
         return(CreateResult.OK);
     }
     catch (Exception exception)
     {
         if (exception.Message.Contains("PK_Business_PropertyFeatureDetail"))
         {
             return(CreateResult.FeatureAlreadyAdded);
         }
         else
         {
             throw exception;
         }
     }
 }
예제 #7
0
 public AddPropertyFeatureDetailResult AddPropertyFeatureDetail(PartnerDTO partner, Guid propertyId, PropertyFeatureDetailDTO featureDetail)
 {
     Connector.IsTransaction = true;
     try
     {
         PropertyBLL propertyBLL = new PropertyBLL(Connector);
         PropertyDTO property    = propertyBLL.ReadById(propertyId);
         if (property.Partner.Id == partner.Id)
         {
             PropertyFeatureDetailBLL propertyFeatureDetailBLL = new PropertyFeatureDetailBLL(Connector);
             featureDetail.Property = property;
             PropertyFeatureDetailBLL.CreateResult result = propertyFeatureDetailBLL.Create(featureDetail);
             if (result == PropertyFeatureDetailBLL.CreateResult.OK)
             {
                 Connector.CommitTransaction();
                 return(AddPropertyFeatureDetailResult.OK);
             }
             else
             {
                 Connector.RollbackTransaction();
                 if (result == PropertyFeatureDetailBLL.CreateResult.FeatureAlreadyAdded)
                 {
                     return(AddPropertyFeatureDetailResult.FeatureAlreadyAdded);
                 }
                 else
                 {
                     return(AddPropertyFeatureDetailResult.NotFound);
                 }
             }
         }
         else
         {
             return(AddPropertyFeatureDetailResult.NotFound);
         }
     }
     catch (Exception exception)
     {
         Connector.RollbackTransaction();
         throw exception;
     }
 }