Esempio n. 1
0
        private static UserPhoneNumber GetUserPhoneNumber(DataRow singleRowData)
        {
            // Load Object by dataRow
            UserPhoneNumber obj = new UserPhoneNumber();

            try
            {
                obj = FillObjectFromRowData(singleRowData);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(obj);
        }
Esempio n. 2
0
 public static void Update(UserPhoneNumber userphonenumber)
 {
     try
     {
         DbCommand commandWrapper = GetDbCommand("spr_UpdateUserPhoneNumber");
         commandWrapper.Parameters.Add(new SqlParameter("@PhoneNumberID", userphonenumber.PhoneNumberID));
         commandWrapper.Parameters.Add(new SqlParameter("@UserID", userphonenumber.UserID));
         commandWrapper.Parameters.Add(new SqlParameter("@PhoneNumberTypeID", userphonenumber.PhoneNumberTypeID));
         commandWrapper.Parameters.Add(new SqlParameter("@PhoneNumber", userphonenumber.PhoneNumber));
         commandWrapper.Parameters.Add(new SqlParameter("@IsPrimary", userphonenumber.IsPrimary));
         commandWrapper.Parameters.Add(new SqlParameter("@IsPublic", userphonenumber.IsPublic));
         ExecuteNonQuery(commandWrapper);
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
 }
Esempio n. 3
0
        private static UserPhoneNumber  FillObjectFromRowData(DataRow returnRow)
        {
            UserPhoneNumber obj = new UserPhoneNumber();

            if (returnRow["PhoneNumberID"] != DBNull.Value)
            {
                obj.PhoneNumberID = (int)returnRow["PhoneNumberID"];
            }
            if (returnRow["UserID"] != DBNull.Value)
            {
                obj.UserID = (int)returnRow["UserID"];
            }
            if (returnRow["PhoneNumberTypeID"] != DBNull.Value)
            {
                obj.PhoneNumberTypeID = (int)returnRow["PhoneNumberTypeID"];
            }

            if (returnRow["PhoneNumber"] != DBNull.Value)
            {
                obj.PhoneNumber = returnRow["PhoneNumber"].ToString();
            }
            if (returnRow["PhoneNumberType"] != DBNull.Value)
            {
                obj.PhoneNumberType = returnRow["PhoneNumberType"].ToString();
            }


            if (returnRow["IsPrimary"] != DBNull.Value)
            {
                obj.IsPrimary = (bool)returnRow["IsPrimary"];
            }
            if (returnRow["IsPublic"] != DBNull.Value)
            {
                obj.IsPublic = (bool)returnRow["IsPublic"];
            }
            return(obj);
        }
Esempio n. 4
0
        public static int Add(UserPhoneNumber userphonenumber)
        {
            int phonenumberid = -1;

            try
            {
                DbCommand    commandWrapper = GetDbCommand("spr_AddUserPhoneNumber");
                SqlParameter returnParam    = new SqlParameter("@PhoneNumberID", SqlDbType.Int);
                returnParam.Direction = ParameterDirection.Output;
                commandWrapper.Parameters.Add(returnParam);
                commandWrapper.Parameters.Add(new SqlParameter("@UserID", userphonenumber.UserID));
                commandWrapper.Parameters.Add(new SqlParameter("@PhoneNumberTypeID", userphonenumber.PhoneNumberTypeID));
                commandWrapper.Parameters.Add(new SqlParameter("@PhoneNumber", userphonenumber.PhoneNumber));
                commandWrapper.Parameters.Add(new SqlParameter("@IsPrimary", userphonenumber.IsPrimary));
                commandWrapper.Parameters.Add(new SqlParameter("@IsPublic", userphonenumber.IsPublic));
                ExecuteNonQuery(commandWrapper);
                phonenumberid = (int)returnParam.Value;
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(phonenumberid);
        }
Esempio n. 5
0
      /// <summary>
      /// Determines whether the specified System.Object is equal to the current object.
      /// </summary>
      /// <param name="obj">The System.Object to compare with the current object.</param>
      /// <returns>Returns true if the specified System.Object is equal to the current object; otherwise, false.</returns>
      public override bool Equals(Object obj)
      {
          UserPhoneNumber Obj = obj as UserPhoneNumber;

          return((Obj == null) ? false : (this.PhoneNumberID == Obj.PhoneNumberID));
      }