public bool RealEstateOwnersInfo_Update(RealEstateOwnersInfo data)
 {
     using (DbCommand cmd = db.GetStoredProcCommand("RealEstateOwners_Update"))
     {
         cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersID", data.RealEstateOwnersID));
         cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersType", data.RealEstateOwnersType));
         cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersName", data.RealEstateOwnersName));
         cmd.Parameters.Add(new SqlParameter("@CLUR", data.CLUR));
         cmd.Parameters.Add(new SqlParameter("@Address", data.Address));
         cmd.Parameters.Add(new SqlParameter("@MobilePhone", data.MobilePhone));
         cmd.Parameters.Add(new SqlParameter("@Email", data.Email));
         cmd.Parameters.Add(new SqlParameter("@Gender", data.Gender));
         cmd.Parameters.Add(new SqlParameter("@IdentityCard", data.IdentityCard));
         try
         {
             db.ExecuteNonQuery(cmd);
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
             //throw ex;
         }
         finally
         {
             if (cmd != null)
             {
                 cmd.Dispose();
             }
         }
     }
 }
Example #2
0
        public RealEstateOwnersInfo RealEstateOwnersInfoIDataReader(IDataReader dr)
        {
            RealEstateOwnersInfo obj = new RealEstateOwnersInfo();

            obj.RealEstateOwnersID   = (dr["RealEstateOwnersID"] is DBNull) ? string.Empty : dr["RealEstateOwnersID"].ToString();
            obj.RealEstateOwnersType = (dr["RealEstateOwnersType"] is DBNull) ? string.Empty : dr["RealEstateOwnersType"].ToString();
            obj.RealEstateOwnersName = (dr["RealEstateOwnersName"] is DBNull) ? string.Empty : dr["RealEstateOwnersName"].ToString();
            obj.CLUR         = (dr["CLUR"] is DBNull) ? string.Empty : dr["CLUR"].ToString();
            obj.Address      = (dr["Address"] is DBNull) ? string.Empty : dr["Address"].ToString();
            obj.MobilePhone  = (dr["MobilePhone"] is DBNull) ? string.Empty : dr["MobilePhone"].ToString();
            obj.Email        = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString();
            obj.Gender       = (dr["Gender"] is DBNull) ? string.Empty : dr["Gender"].ToString();
            obj.IdentityCard = (dr["IdentityCard"] is DBNull) ? string.Empty : dr["IdentityCard"].ToString();
            return(obj);
        }
 public int RealEstateOwnersInfo_Insert(RealEstateOwnersInfo data, int ID)
 {
     using (SqlCommand cmd = new SqlCommand("RealEstateOwners_Insert", GetConnection()))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         //cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersID", data.RealEstateOwnersID));
         cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersType", data.RealEstateOwnersType));
         cmd.Parameters.Add(new SqlParameter("@RealEstateOwnersName", data.RealEstateOwnersName));
         cmd.Parameters.Add(new SqlParameter("@CLUR", data.CLUR));
         cmd.Parameters.Add(new SqlParameter("@Address", data.Address));
         cmd.Parameters.Add(new SqlParameter("@MobilePhone", data.MobilePhone));
         cmd.Parameters.Add(new SqlParameter("@Email", data.Email));
         cmd.Parameters.Add(new SqlParameter("@Gender", data.Gender));
         cmd.Parameters.Add(new SqlParameter("@IdentityCard", data.IdentityCard));
         //cmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));
         try
         {
             SqlDataReader reader = cmd.ExecuteReader();
             if (reader.HasRows)
             {
                 while (reader.Read())
                 {
                     ID = int.Parse(reader[0].ToString());
                 }
             }
             reader.Close();
         }
         catch (Exception ex)
         {
             //throw ex;
             return(-1);
         }
         finally
         {
             if (cmd != null)
             {
                 cmd.Dispose();
             }
         }
         return(ID);
     }
 }