public bool HomeInfo_Update(Homes data)
        {
            using (DbCommand cmd = db.GetStoredProcCommand("Home_Update"))
            {
                cmd.Parameters.Add(new SqlParameter("@HomeID", data.HomeID));
                cmd.Parameters.Add(new SqlParameter("@HomeTypeID", data.HomeTypeID));
                cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersID", data.RealEstateOwnersID));
                //cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersTypeID", data.RealEstateOwnersTypeID));
                cmd.Parameters.Add(new SqlParameter("@RealEstateID", data.RealEstateID));
                cmd.Parameters.Add(new SqlParameter("@Name", data.Name));
                cmd.Parameters.Add(new SqlParameter("@Name", data.Title));
                cmd.Parameters.Add(new SqlParameter("@Name", data.CreateDate));
                cmd.Parameters.Add(new SqlParameter("@Title", data.TransactionType));
                cmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));
                cmd.Parameters.Add(new SqlParameter("@Description", data.Description));
                cmd.Parameters.Add(new SqlParameter("@Address", data.Address));
                cmd.Parameters.Add(new SqlParameter("@Price", data.Price));
                cmd.Parameters.Add(new SqlParameter("@TotalArea", data.TotalArea));
                cmd.Parameters.Add(new SqlParameter("@FloorArea", data.FloorArea));
                cmd.Parameters.Add(new SqlParameter("@GargenArea", data.GargenArea));
                cmd.Parameters.Add(new SqlParameter("@HomeArea", data.HomeArea));
                cmd.Parameters.Add(new SqlParameter("@BedroomNumber", data.BedroomNumber));
                cmd.Parameters.Add(new SqlParameter("@TierNumber", data.TierNumber));
                cmd.Parameters.Add(new SqlParameter("@Image1", data.Image1));
                cmd.Parameters.Add(new SqlParameter("@Image2", data.Image2));
                cmd.Parameters.Add(new SqlParameter("@Image3", data.Image3));
                cmd.Parameters.Add(new SqlParameter("@Image4", data.Image4));
                cmd.Parameters.Add(new SqlParameter("@Image5", data.Image5));
                cmd.Parameters.Add(new SqlParameter("@Image6", data.Image6));

                cmd.Parameters.Add(new SqlParameter("@HomeTypeName", data.HomeTypeName));
                cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersName", data.RealEstateOwnersName));
                try
                {
                    db.ExecuteNonQuery(cmd);
                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                    //throw ex;
                }
                finally
                {
                    if (cmd != null)
                    {
                        cmd.Dispose();
                    }
                }
            }
        }
Beispiel #2
0
        public Homes HomesIDataReader(IDataReader dr)
        {
            Homes obj = new Homes();

            //obj.HomeID = (dr["HomeID"] is DBNull) ? string.Empty : dr["HomeID"].ToString();
            obj.HomeTypeID         = (dr["HomeTypeID"] is DBNull) ? string.Empty : dr["HomeTypeID"].ToString();
            obj.RealEstateOwnersID = (dr["RealEstateOwnersID"] is DBNull) ? string.Empty : dr["RealEstateOwnersID"].ToString();
            //obj.RealEstateOwnersTypeID = (dr["RealEstateOwnersTypeID"] is DBNull) ? string.Empty : dr["RealEstateOwnersTypeID"].ToString();
            //obj.RealEstateID = (dr["RealEstateID"] is DBNull) ? string.Empty : dr["RealEstateID"].ToString();
            obj.Name            = (dr["Name"] is DBNull) ? string.Empty : dr["Name"].ToString();
            obj.Title           = (dr["Title"] is DBNull) ? string.Empty : dr["Title"].ToString();
            obj.CreateDate      = (dr["CreateDate"] is DBNull) ? string.Empty : dr["CreateDate"].ToString();
            obj.TransactionType = (dr["TransactionType"] is DBNull) ? string.Empty : dr["TransactionType"].ToString();
            obj.Tag             = (dr["Tag"] is DBNull) ? string.Empty : dr["Tag"].ToString();
            obj.Description     = (dr["Description"] is DBNull) ? string.Empty : dr["Description"].ToString();
            obj.Address         = (dr["Address"] is DBNull) ? string.Empty : dr["Address"].ToString();
            obj.Price           = (dr["Price"] is DBNull) ? string.Empty : dr["Price"].ToString();
            obj.TotalArea       = (dr["TotalArea"] is DBNull) ? string.Empty : dr["TotalArea"].ToString();
            obj.FloorArea       = (dr["FloorArea"] is DBNull) ? string.Empty : dr["FloorArea"].ToString();
            obj.GargenArea      = (dr["GargenArea"] is DBNull) ? string.Empty : dr["GargenArea"].ToString();
            obj.HomeArea        = (dr["HomeArea"] is DBNull) ? string.Empty : dr["HomeArea"].ToString();
            obj.BedroomNumber   = (dr["BedroomNumber"] is DBNull) ? string.Empty : dr["BedroomNumber"].ToString();
            obj.TierNumber      = (dr["TierNumber"] is DBNull) ? string.Empty : dr["TierNumber"].ToString();
            obj.CreateBy        = (dr["CreateBy"] is DBNull) ? string.Empty : dr["CreateBy"].ToString();
            obj.Image1          = (dr["Image1"] is DBNull) ? string.Empty : dr["Image1"].ToString();
            obj.Image2          = (dr["Image2"] is DBNull) ? string.Empty : dr["Image2"].ToString();
            obj.Image3          = (dr["Image3"] is DBNull) ? string.Empty : dr["Image3"].ToString();
            obj.Image4          = (dr["Image4"] is DBNull) ? string.Empty : dr["Image4"].ToString();
            obj.Image5          = (dr["Image5"] is DBNull) ? string.Empty : dr["Image5"].ToString();
            obj.Image6          = (dr["Image6"] is DBNull) ? string.Empty : dr["Image6"].ToString();

            //obj.RealEstateName = (dr["RealEstateName"] is DBNull) ? string.Empty : dr["RealEstateName"].ToString();
            //obj.RealEstateTypeID = (dr["RealEstateTypeID"] is DBNull) ? string.Empty : dr["RealEstateTypeID"].ToString();
            //obj.LocationID = (dr["LocationID"] is DBNull) ? string.Empty : dr["LocationID"].ToString();
            //obj.CityID = (dr["CityID"] is DBNull) ? string.Empty : dr["CityID"].ToString();
            //obj.RegionID = (dr["RegionID"] is DBNull) ? string.Empty : dr["RegionID"].ToString();
            //obj.DistrictID = (dr["DistrictID"] is DBNull) ? string.Empty : dr["DistrictID"].ToString();
            //obj.CategoryID = (dr["CategoryID"] is DBNull) ? string.Empty : dr["CategoryID"].ToString();
            obj.HomeTypeName         = (dr["HomeTypeName"] is DBNull) ? string.Empty : dr["HomeTypeName"].ToString();
            obj.RealEstateOwnersName = (dr["RealEstateOwnersName"] is DBNull) ? string.Empty : dr["RealEstateOwnersName"].ToString();
            return(obj);
        }