public string PutProperty(ClsAllProperties prProperty) { // update try { int lcRecCount = ClsDbConnection.Execute("UPDATE PropertyInfo SET " + "RegionName = @RegionName, PropertyAddress = @PropertyAddress, " + "PropertyPrice = @PropertyPrice, PropertyDescription = @PropertyDesc, " + "DateModified = @DateModified, IsAvailable = @IsAvailable, PropertyType = @PropertyType, " + "PropertyArea = @PropertyArea, RateableValue = @RateableValue, PropertyTerm = @PropertyTerm, " + "LetFee = @LetFee, Furnishing = @Furnishing " + "WHERE PropertyId = @PropertyId", preparePropertyParameters(prProperty)); if (lcRecCount == 1) { return("One Property updated"); } else { return("Unexpected artist update count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
private Dictionary <string, object> preparePropertyParameters(ClsAllProperties prProperty) { Dictionary <string, object> par = new Dictionary <string, object>(12); par.Add("RegionName", prProperty.RegionName); par.Add("PropertyAddress", prProperty.PropertyAddress); par.Add("PropertyPrice", prProperty.PropertyPrice); par.Add("PropertyDescription", prProperty.PropertyDesc); par.Add("DateModified", prProperty.DateModified); par.Add("IsAvailable", prProperty.IsAvailable); par.Add("PropertyType", prProperty.PropertyType); par.Add("PropertyArea", prProperty.PropertyArea); par.Add("RateableValue", prProperty.RateableValue); par.Add("PropertyTerm", prProperty.PropertyTerm); par.Add("LetFee", prProperty.LetFee); par.Add("Furnishing", prProperty.Furnishing); return(par); }
public string PostProperty(ClsAllProperties prProperty) { try { int lcRecCount = ClsDbConnection.Execute("INSERT INTO PropertyInfo " + "(RegionName, PropertyAddress, PropertyPrice, PropertyDescription, DateModified, IsAvailable, PropertyType, PropertyArea, RateableValue, PropertyTerm, LetFee, Furnishing)" + "VALUES (@RegionName, @PropertyAddress, @PropertyPrice, @PropertyDesc, @DateModified, @IsAvailable, @PropertyType, @PropertyArea, @RateableValue, @PropertyTerm, @LetFee, @Furnishing)", preparePropertyParameters(prProperty)); if (lcRecCount == 1) { return("Property Added"); } else { return("Unexpected Property insert count" + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }