Exemplo n.º 1
0
    public COMN_UserType GetCOMN_UserTypeFromReader(IDataReader reader)
    {
        try
        {
            COMN_UserType cOMN_UserType = new COMN_UserType
                (

                     DataAccessObject.IsNULL<int>(reader["UserTypeID"]),
                     DataAccessObject.IsNULL<string>(reader["UserTypeName"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]),
                     DataAccessObject.IsNULL<int>(reader["RowStatusID"])
                );
             return cOMN_UserType;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
Exemplo n.º 2
0
    public bool UpdateCOMN_UserType(COMN_UserType cOMN_UserType)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateCOMN_UserType", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@UserTypeID", SqlDbType.Int).Value = cOMN_UserType.UserTypeID;
            cmd.Parameters.Add("@UserTypeName", SqlDbType.NVarChar).Value = cOMN_UserType.UserTypeName;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = cOMN_UserType.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = cOMN_UserType.UpdateDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = cOMN_UserType.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }